mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 19:51:51 +09:00
yet another state machine fix
This commit is contained in:
@@ -357,15 +357,14 @@ basicFunctions._interpretLine = function(lnum, cmd) {
|
||||
/* do nothing */
|
||||
}
|
||||
else if (0x22 == charCode) {
|
||||
sb = "";
|
||||
mode = "quote"
|
||||
}
|
||||
else if (basicFunctions._isParen(charCode)) {
|
||||
sb = "";
|
||||
sb = "" + char;
|
||||
mode = "paren";
|
||||
}
|
||||
else if (basicFunctions._isSeparator(charCode)) {
|
||||
sb = "";
|
||||
sb = "" + char;
|
||||
mode = "sep";
|
||||
}
|
||||
else {
|
||||
@@ -430,6 +429,9 @@ basicFunctions._interpretLine = function(lnum, cmd) {
|
||||
if (tokens.length != states.length) throw "InternalError: size of tokens and states does not match (line: "+lnum+")";
|
||||
// END TOKENISE
|
||||
|
||||
println(tokens.join("~"));
|
||||
println(states.join(" "));
|
||||
|
||||
// ELABORATION : distinguish numbers and operators from literals
|
||||
k = 0;
|
||||
while (k < states.length) { // using while loop because array size will change during the execution
|
||||
@@ -517,6 +519,11 @@ basicFunctions._interpretLine = function(lnum, cmd) {
|
||||
}
|
||||
// END ELABORATION
|
||||
|
||||
|
||||
println(tokens.join("~"));
|
||||
println(states.join(" "));
|
||||
|
||||
|
||||
// PARSING (SYNTAX ANALYSIS)
|
||||
var syntaxTree = basicFunctions._parseTokens(lnum, tokens, states, 0);
|
||||
println("k bye");
|
||||
@@ -524,10 +531,6 @@ basicFunctions._interpretLine = function(lnum, cmd) {
|
||||
// END PARSING
|
||||
|
||||
|
||||
println(tokens.join("~"));
|
||||
println(states.join(" "));
|
||||
|
||||
|
||||
|
||||
return lnum + 1;
|
||||
}; // end INTERPRETLINE
|
||||
|
||||
Reference in New Issue
Block a user