basic: NEXT of FOR loop now works but now unary op is not parsed correctly

This commit is contained in:
minjaesong
2020-12-13 20:07:23 +09:00
parent e106327b4b
commit 45b37d40b1
3 changed files with 40 additions and 13 deletions

View File

@@ -11,7 +11,7 @@ stmt =
| "DEFUN" , [ident] , "(" , [ident , {" , " , ident}] , ")" , "=" , expr
| "ON" , expr_sans_asgn , ("GOTO" | "GOSUB") , expr_sans_asgn , {"," , expr_sans_asgn}
| "(" , stmt , ")"
| expr ;
| expr ; (* if the statement contains only one word, treat it as function_call e.g. NEXT for FOR loop *)
expr = (* this basically blocks some funny attemps such as using DEFUN as anon function because everything is global in BASIC *)
lit