basic: still broken but we're getting there

This commit is contained in:
minjaesong
2020-12-13 00:12:20 +09:00
parent 24cd1a030f
commit 5a09c4915d
3 changed files with 201 additions and 198 deletions

View File

@@ -247,12 +247,12 @@ bF._parseStmt = function(lnum, tokens, states, recDepth) {
}
catch (e) {
bF.parserPrintdbgline('$', 'Error!', lnum, recDepth);
throw new ParserError("Statement cannot be parsed: "+e.stack);
throw new ParserError("Statement cannot be parsed in "+lnum+": "+e.stack);
}
/*************************************************************************/
throw new ParserError("Statement cannot be parsed");
throw new ParserError("Statement cannot be parsed in "+lnum);
} // END of STMT
@@ -412,7 +412,7 @@ bF._parseExpr = function(lnum, tokens, states, recDepth, ifMode) {
/*************************************************************************/
throw new ParserError("Expression cannot be parsed");
throw new ParserError("Expression cannot be parsed in "+lnum);
} // END of EXPR

View File

@@ -7,6 +7,7 @@ linenumber = digits ;
stmt =
"IF" , expr_sans_asgn , "THEN" , stmt , ["ELSE" , stmt]
| "FOR" , expr // TODO
| "DEFUN" , [ident] , "(" , [ident , {" , " , ident}] , ")" , "=" , expr
| "ON" , expr_sans_asgn , ("GOTO" | "GOSUB") , expr_sans_asgn , {"," , expr_sans_asgn}
| "(" , stmt , ")"
@@ -69,6 +70,9 @@ IF (type: function, value: IF)
2. true
[3. false]
FOR (type: function, value: FOR)
1. expr (normally (=) but not necessarily)
DEFUN (type: function, value: DEFUN)
1. funcname
1. arg0