From 2ab3fddc66a086be21df37951b1c72a1c0964b5f Mon Sep 17 00:00:00 2001 From: bill Date: Thu, 18 Feb 2021 20:38:43 +0800 Subject: [PATCH] Bug fixed: unreachable code; symbol(value) not implemented. --- src/main/jflex/chocopy/pa1/ChocoPy.jflex | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/jflex/chocopy/pa1/ChocoPy.jflex b/src/main/jflex/chocopy/pa1/ChocoPy.jflex index ccb7187..9cc41de 100644 --- a/src/main/jflex/chocopy/pa1/ChocoPy.jflex +++ b/src/main/jflex/chocopy/pa1/ChocoPy.jflex @@ -39,7 +39,7 @@ import java.util.ArrayList; /** Return a terminal symbol of syntactic category TYPE and no * semantic value at the current source location. */ private Symbol symbol(int type) { - return symbol(type); + return symbol(type, null); } /** Return a terminal symbol of syntactic category TYPE and semantic @@ -142,8 +142,9 @@ if True: if(top()< currIndent) { /* - If current indentation is more than indents current level should have, - start a new level which will have `currIndent' spaces. + If current indentation is more than the number of indents + current level should have, start a new level which will have + `currIndent' indents. */ push(currIndent); return symbol(ChocoPyTokens.INDENT, currIndent); @@ -153,7 +154,7 @@ if True: { /* Delimiters. */ - {LineBreak} { return symbol(ChocoPyTokens.NEWLINE); yybegin(YYINITIAL); currIndent = 0;} + {LineBreak} { yybegin(YYINITIAL); currIndent = 0;return symbol(ChocoPyTokens.NEWLINE);} ":" { return symbol(ChocoPyTokens.COLON); } "," { return symbol(ChocoPyTokens.COMMA); }