File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,12 @@ def __init__(self, name):
35
35
super ().__init__ ()
36
36
self .name = name
37
37
38
+ def __eq__ (self , other ):
39
+ return self .name == other .name
40
+
41
+ def __hash__ (self ):
42
+ return hash (self .__class__ .__name__ + self .name )
43
+
38
44
def __repr__ (self ):
39
45
if not self .children :
40
46
return self .name
Original file line number Diff line number Diff line change @@ -83,8 +83,8 @@ class Tokens:
83
83
PVAR : r'PVAR\b'
84
84
GVAR : r'GVAR\b'
85
85
RULE : r'RULE\b'
86
- ANNOTATION : r'[_a-zA-Z0-9][_a-zA-Z0-9]*:(?!\n)'
87
86
OWID : fr'({ "|" .join (OWID )} )(?=[\b\s\n\(\),]+)'
87
+ ANNOTATION : r'[_a-zA-Z0-9][_a-zA-Z0-9]*:(?!\n)'
88
88
RULEBLOCK : r'(EVENT|CONDITIONS|ACTIONS)\b'
89
89
NAME : r'[_a-zA-Z][_\-a-zA-Z0-9]*'
90
90
WHITESPACE : r'[ \t]+'
Original file line number Diff line number Diff line change @@ -258,7 +258,7 @@ def visitGlobalVar(self, node):
258
258
for scope in self .scopes [::- 1 ]:
259
259
if node .name in scope .namespace :
260
260
value = scope .namespace .get (node .name )
261
- if value == node :
261
+ if type ( value ) == type ( node ) and value == node :
262
262
continue
263
263
result = self .visit (value )
264
264
return result
@@ -330,7 +330,7 @@ def visitCall(self, node):
330
330
if method == 'append' :
331
331
try :
332
332
assert len (args ) == 1
333
- value = node .args [0 ]
333
+ value = self . visit ( node .args [0 ])
334
334
self .arrays [callee .parent .name ].append (value )
335
335
index = self .lookup (callee .parent )
336
336
if type (callee .parent ) == GlobalVar :
@@ -350,7 +350,7 @@ def visitCall(self, node):
350
350
scope = Scope (name = callee .name )
351
351
scope .namespace .update (dict (zip (params , node .args )))
352
352
self .scopes .append (scope )
353
- code += self .visitChildren ( function )
353
+ code += ( '; \n ' + self .tabs ). join ( map ( self . visit , function . children ) )
354
354
self .scopes .pop ()
355
355
else :
356
356
try :
You can’t perform that action at this time.
0 commit comments