|
|
|
@ -2,6 +2,7 @@ package chocopy.pa1;
|
|
|
|
|
import java_cup.runtime.*;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
|
|
|
|
|
|
%%
|
|
|
|
|
|
|
|
|
|
/*** Do not change the flags below unless you know what you are doing. ***/
|
|
|
|
@ -81,6 +82,7 @@ import java.util.Iterator;
|
|
|
|
|
WhiteSpace = [ \t]
|
|
|
|
|
LineBreak = \r|\n|\r\n
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IntegerLiteral = 0|[1-9][0-9]* // Accroding to the manual, 00+ is illeagal
|
|
|
|
|
StringLiteral = ([^\"\\]|(\\\")|(\\t)|(\\r)|(\\n)|(\\\\))+ // \n, \r, \t, \\, \" and Anything except \ and "
|
|
|
|
|
Identifiers = (_|[a-z]|[A-Z])(_|[a-z]|[A-Z]|[0-9])*
|
|
|
|
@ -188,6 +190,7 @@ if True:
|
|
|
|
|
/* Literals. */
|
|
|
|
|
{IntegerLiteral} { return symbol(ChocoPyTokens.NUMBER,
|
|
|
|
|
Integer.parseInt(yytext())); }
|
|
|
|
|
|
|
|
|
|
"\"" {yybegin(STR); str_l = yyline + 1; str_c = yycolumn + 1; currString = "";} //Start taking a string when see a "
|
|
|
|
|
"False" { return symbol(ChocoPyTokens.BOOL, false); }
|
|
|
|
|
"True" { return symbol(ChocoPyTokens.BOOL, true); }
|
|
|
|
|