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