|
|
@ -39,7 +39,7 @@ import java.util.ArrayList;
|
|
|
|
/** Return a terminal symbol of syntactic category TYPE and no
|
|
|
|
/** Return a terminal symbol of syntactic category TYPE and no
|
|
|
|
* semantic value at the current source location. */
|
|
|
|
* semantic value at the current source location. */
|
|
|
|
private Symbol symbol(int type) {
|
|
|
|
private Symbol symbol(int type) {
|
|
|
|
return symbol(type);
|
|
|
|
return symbol(type, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Return a terminal symbol of syntactic category TYPE and semantic
|
|
|
|
/** Return a terminal symbol of syntactic category TYPE and semantic
|
|
|
@ -142,8 +142,9 @@ if True:
|
|
|
|
if(top()< currIndent)
|
|
|
|
if(top()< currIndent)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
If current indentation is more than indents current level should have,
|
|
|
|
If current indentation is more than the number of indents
|
|
|
|
start a new level which will have `currIndent' spaces.
|
|
|
|
current level should have, start a new level which will have
|
|
|
|
|
|
|
|
`currIndent' indents.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
push(currIndent);
|
|
|
|
push(currIndent);
|
|
|
|
return symbol(ChocoPyTokens.INDENT, currIndent);
|
|
|
|
return symbol(ChocoPyTokens.INDENT, currIndent);
|
|
|
@ -153,7 +154,7 @@ if True:
|
|
|
|
<AFTER> {
|
|
|
|
<AFTER> {
|
|
|
|
|
|
|
|
|
|
|
|
/* Delimiters. */
|
|
|
|
/* 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.COLON); }
|
|
|
|
"," { return symbol(ChocoPyTokens.COMMA); }
|
|
|
|
"," { return symbol(ChocoPyTokens.COMMA); }
|
|
|
|
|
|
|
|
|
|
|
|