File tree 2 files changed +12
-13
lines changed
2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -253,15 +253,14 @@ def __init__(self, children):
253
253
super ().__init__ (None , children )
254
254
255
255
def Evaluate (self ):
256
- self .children [0 ].Evaluate ()
257
- compiler .newInstruction (f"CMP EBX, False" )
258
- compiler .newInstruction (f"JE exit_{ self .i } " )
259
- self .children [1 ].Evaluate ()
260
- compiler .newInstruction (f"exit_{ self .i } : ;" )
261
-
262
- if not (self .children [2 ] is None ):
263
- self .children [0 ].Evaluate ()
264
- compiler .newInstruction (f"CMP EBX, False" )
265
- compiler .newInstruction (f"JNE exit_else_{ self .i } " )
266
- self .children [2 ].Evaluate ()
267
- compiler .newInstruction (f"exit_else_{ self .i } : ;" )
256
+ if (self .children [0 ].Evaluate ()[0 ] != 'STRING' ):
257
+ if (self .children [2 ] is None ):
258
+ if (self .children [0 ].Evaluate ()[1 ]):
259
+ self .children [1 ].Evaluate ()
260
+ else :
261
+ if (self .children [0 ].Evaluate ()[1 ]):
262
+ self .children [1 ].Evaluate ()
263
+ else :
264
+ self .children [2 ].Evaluate ()
265
+ else :
266
+ raise NameError ("Cannot use string as single argument." )
Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ def parseFactor():
205
205
result = Identifier (Parser .tokens .actual .value )
206
206
Parser .tokens .selectNext ()
207
207
208
- elif (Parser .tokens .actual .type == 'TRUE' or Parser .tokens .actual .type == 'TRUE ' ):
208
+ elif (Parser .tokens .actual .type == 'TRUE' or Parser .tokens .actual .type == 'FALSE ' ):
209
209
result = BoolVal (Parser .tokens .actual .value )
210
210
Parser .tokens .selectNext ()
211
211
You can’t perform that action at this time.
0 commit comments