Skip to content

Commit 9db86f8

Browse files
authored
Merge pull request #211 from boriel/feature/refact_symbols
Refactorize code
2 parents c4ddbad + 9d3402b commit 9db86f8

17 files changed

Lines changed: 41 additions & 41 deletions

symbols/arraydecl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class SymbolARRAYDECL(Symbol):
1515
""" Defines an Array declaration
1616
"""
1717
def __init__(self, entry):
18-
Symbol.__init__(self, entry)
18+
super(SymbolARRAYDECL, self).__init__(entry)
1919

2020
@property
2121
def name(self):

symbols/arrayload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
class SymbolARRAYLOAD(SymbolARRAYACCESS):
16-
''' This class is the same as SymbolARRAYACCESS, we just declare it to make
16+
""" This class is the same as SymbolARRAYACCESS, we just declare it to make
1717
a distinction. (e.g. the Token is gotten from the class name)
18-
'''
18+
"""
1919
pass

symbols/asm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414

1515
class SymbolASM(Symbol):
16-
''' Defines an ASM sentence
17-
'''
16+
""" Defines an ASM sentence
17+
"""
1818
def __init__(self, asm, lineno):
19-
Symbol.__init__(self)
19+
super(SymbolASM, self).__init__()
2020
self.asm = asm
2121
self.lineno = lineno

symbols/bound.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, lower, upper):
3232
assert isinstance(upper, int)
3333
assert upper >= lower >= 0
3434

35-
Symbol.__init__(self)
35+
super(SymbolBOUND, self).__init__()
3636
self.lower = lower
3737
self.upper = upper
3838

symbols/boundlist.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414

1515

1616
class SymbolBOUNDLIST(Symbol):
17-
''' Defines a bound list for an array
18-
'''
17+
""" Defines a bound list for an array
18+
"""
1919
def __init__(self, *bounds):
2020
for bound in bounds:
2121
assert isinstance(bound, SymbolBOUND)
2222

23-
Symbol.__init__(self, *bounds)
23+
super(SymbolBOUNDLIST, self).__init__(*bounds)
2424

2525
def __len__(self): # Number of bounds:
2626
return len(self.children)
@@ -33,8 +33,8 @@ def __str__(self):
3333

3434
@classmethod
3535
def make_node(cls, node, *args):
36-
''' Creates an array BOUND LIST.
37-
'''
36+
""" Creates an array BOUND LIST.
37+
"""
3838
if node is None:
3939
return cls.make_node(SymbolBOUNDLIST(), *args)
4040

symbols/builtin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class SymbolBUILTIN(Symbol):
2323
def __init__(self, lineno, fname, type_=None, *operands):
2424
assert isinstance(lineno, int)
2525
assert type_ is None or isinstance(type_, SymbolTYPE)
26-
Symbol.__init__(self, *operands)
26+
super(SymbolBUILTIN, self).__init__(*operands)
2727
self.lineno = lineno
2828
self.fname = fname
2929
self.type_ = type_

symbols/function.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class SymbolFUNCTION(SymbolVAR):
2222
"""
2323

2424
def __init__(self, varname, lineno, offset=None, type_=None):
25-
SymbolVAR.__init__(self, varname, lineno, offset, class_=CLASS.function, type_=type_)
25+
super(SymbolFUNCTION, self).__init__(varname, lineno, offset, class_=CLASS.function, type_=type_)
2626
self.reset()
2727

2828
def reset(self, lineno=None, offset=None, type_=None):

symbols/label.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class SymbolLABEL(SymbolVAR):
1818
prefix = '__LABEL__'
1919

2020
def __init__(self, name, lineno):
21-
SymbolVAR.__init__(self, name, lineno)
21+
super(SymbolLABEL, self).__init__(name, lineno)
2222
self.class_ = CLASS.label
2323
self._scope_owner = [] # list of nested functions containing this label (scope)
2424

symbols/number.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, value, lineno, type_=None):
4444

4545
assert isinstance(value, numbers.Number)
4646

47-
super(Symbol, self).__init__()
47+
super(SymbolNUMBER, self).__init__()
4848
self.class_ = CLASS.const
4949

5050
if int(value) == value:

symbols/paramdecl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818

1919

2020
class SymbolPARAMDECL(SymbolVAR):
21-
''' Defines a parameter declaration
22-
'''
21+
""" Defines a parameter declaration
22+
"""
2323
def __init__(self, varname, lineno, type_=None):
24-
SymbolVAR.__init__(self, varname, lineno, type_=type_, class_=CLASS.var)
24+
super(SymbolPARAMDECL, self).__init__(varname, lineno, type_=type_, class_=CLASS.var)
2525
self.byref = OPTIONS.byref.value # By default all params By value (false)
2626
self.offset = None # Set by PARAMLIST, contains positive offset from top of the stack
2727
self.scope = SCOPE.parameter

0 commit comments

Comments
 (0)