\r
public class ExpressionParser implements ExpressionParserConstants {\r
\r
+ public class ForRange {\r
+ public Token start;\r
+ public Token end;\r
+ }\r
+\r
boolean forIndex = false;\r
+ Token firstToken;\r
+\r
+ public Token getFirstToken() {\r
+ return firstToken;\r
+ }\r
+\r
+ List<ForRange> forRanges = new ArrayList<ForRange>();\r
+\r
+ public List<ForRange> getForRanges() {\r
+ return forRanges;\r
+ }\r
\r
HashMap<String, List<Token>> references = new HashMap<String, List<Token>>();\r
\r
// [ add_op ] -> ( add_op() )?\r
// { add_op term } -> ( add_op() term() )*\r
final public void expr() throws ParseException {\r
- references = new HashMap<String, List<Token>>();\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case 6:\r
case 12:\r
case STRING:\r
case UNSIGNED_INTEGER:\r
case UNSIGNED_NUMBER:\r
+ firstToken = token;\r
simple_expression();\r
jj_consume_token(0);\r
break;\r
case 31:\r
+ firstToken = token;\r
jj_consume_token(31);\r
expression();\r
jj_consume_token(28);\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case 41:\r
jj_consume_token(41);\r
+ ForRange forRange = new ForRange();\r
+ forRange.start = token;\r
expression();\r
+ forRange.start = forRange.start.next;\r
+ forRange.end = token;\r
+ forRanges.add(forRange);\r
break;\r
default:\r
jj_la1[29] = jj_gen;\r
\r
final public void subscript(List<Token> currentRange) throws ParseException {\r
Token rangeToken = new Token(token.kind, "");\r
- rangeToken.beginColumn = token.beginColumn;\r
+ rangeToken.beginColumn = token.beginColumn + 1;\r
rangeToken.beginLine = token.beginLine;\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case 69:\r
finally { jj_save(1, xla); }\r
}\r
\r
- private boolean jj_3R_45() {\r
- if (jj_scan_token(87)) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_53() {\r
- if (jj_3R_13()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_49() {\r
- if (jj_3R_13()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_44() {\r
- if (jj_scan_token(64)) return true;\r
- if (jj_3R_50()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_48() {\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_53()) jj_scanpos = xsp;\r
- while (true) {\r
- xsp = jj_scanpos;\r
- if (jj_3R_54()) { jj_scanpos = xsp; break; }\r
- }\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_43() {\r
- if (jj_scan_token(66)) return true;\r
- if (jj_3R_49()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_40() {\r
- if (jj_3R_12()) return true;\r
- if (jj_3R_46()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_42() {\r
- if (jj_scan_token(62)) return true;\r
- if (jj_3R_48()) return true;\r
- if (jj_scan_token(63)) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_38() {\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_scan_token(86)) {\r
- jj_scanpos = xsp;\r
- if (jj_3R_45()) return true;\r
- }\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_41() {\r
- if (jj_3R_47()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_37() {\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_scan_token(93)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(92)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(91)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(6)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(33)) {\r
- jj_scanpos = xsp;\r
- if (jj_3R_40()) {\r
- jj_scanpos = xsp;\r
- if (jj_3R_41()) {\r
- jj_scanpos = xsp;\r
- if (jj_3R_42()) {\r
- jj_scanpos = xsp;\r
- if (jj_3R_43()) {\r
- jj_scanpos = xsp;\r
- if (jj_3R_44()) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(35)) return true;\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_58() {\r
- if (jj_scan_token(IDENT)) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_18() {\r
- if (jj_scan_token(71)) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_14() {\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_18()) {\r
- jj_scanpos = xsp;\r
- if (jj_3R_19()) return true;\r
- }\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_57() {\r
- if (jj_3R_58()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_36() {\r
- if (jj_3R_39()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_29() {\r
- if (jj_3R_33()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_32() {\r
- if (jj_3R_34()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_39() {\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_scan_token(82)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(83)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(84)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(85)) return true;\r
- }\r
- }\r
- }\r
- return false;\r
- }\r
-\r
private boolean jj_3R_35() {\r
if (jj_3R_37()) return true;\r
Token xsp;\r
return false;\r
}\r
\r
+ private boolean jj_3R_54() {\r
+ if (jj_scan_token(71)) return true;\r
+ return false;\r
+ }\r
+\r
private boolean jj_3R_13() {\r
Token xsp;\r
xsp = jj_scanpos;\r
return false;\r
}\r
\r
- private boolean jj_3R_15() {\r
- if (jj_scan_token(68)) return true;\r
- if (jj_3R_12()) return true;\r
+ private boolean jj_3R_56() {\r
+ if (jj_scan_token(66)) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_54() {\r
- if (jj_scan_token(71)) return true;\r
+ private boolean jj_3R_15() {\r
+ if (jj_scan_token(68)) return true;\r
+ if (jj_3R_12()) return true;\r
return false;\r
}\r
\r
return false;\r
}\r
\r
- private boolean jj_3R_56() {\r
- if (jj_scan_token(66)) return true;\r
+ private boolean jj_3R_53() {\r
+ if (jj_3R_13()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_49() {\r
+ if (jj_3R_13()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_48() {\r
+ Token xsp;\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_53()) jj_scanpos = xsp;\r
+ while (true) {\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_54()) { jj_scanpos = xsp; break; }\r
+ }\r
return false;\r
}\r
\r
return false;\r
}\r
\r
+ private boolean jj_3R_58() {\r
+ if (jj_scan_token(IDENT)) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_45() {\r
+ if (jj_scan_token(87)) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_57() {\r
+ if (jj_3R_58()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_44() {\r
+ if (jj_scan_token(64)) return true;\r
+ if (jj_3R_50()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_43() {\r
+ if (jj_scan_token(66)) return true;\r
+ if (jj_3R_49()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_40() {\r
+ if (jj_3R_12()) return true;\r
+ if (jj_3R_46()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_42() {\r
+ if (jj_scan_token(62)) return true;\r
+ if (jj_3R_48()) return true;\r
+ if (jj_scan_token(63)) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_38() {\r
+ Token xsp;\r
+ xsp = jj_scanpos;\r
+ if (jj_scan_token(86)) {\r
+ jj_scanpos = xsp;\r
+ if (jj_3R_45()) return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_41() {\r
+ if (jj_3R_47()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_37() {\r
+ Token xsp;\r
+ xsp = jj_scanpos;\r
+ if (jj_scan_token(93)) {\r
+ jj_scanpos = xsp;\r
+ if (jj_scan_token(92)) {\r
+ jj_scanpos = xsp;\r
+ if (jj_scan_token(91)) {\r
+ jj_scanpos = xsp;\r
+ if (jj_scan_token(6)) {\r
+ jj_scanpos = xsp;\r
+ if (jj_scan_token(33)) {\r
+ jj_scanpos = xsp;\r
+ if (jj_3R_40()) {\r
+ jj_scanpos = xsp;\r
+ if (jj_3R_41()) {\r
+ jj_scanpos = xsp;\r
+ if (jj_3R_42()) {\r
+ jj_scanpos = xsp;\r
+ if (jj_3R_43()) {\r
+ jj_scanpos = xsp;\r
+ if (jj_3R_44()) {\r
+ jj_scanpos = xsp;\r
+ if (jj_scan_token(35)) return true;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_18() {\r
+ if (jj_scan_token(71)) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_14() {\r
+ Token xsp;\r
+ xsp = jj_scanpos;\r
+ if (jj_3R_18()) {\r
+ jj_scanpos = xsp;\r
+ if (jj_3R_19()) return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_36() {\r
+ if (jj_3R_39()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_29() {\r
+ if (jj_3R_33()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_32() {\r
+ if (jj_3R_34()) return true;\r
+ return false;\r
+ }\r
+\r
+ private boolean jj_3R_39() {\r
+ Token xsp;\r
+ xsp = jj_scanpos;\r
+ if (jj_scan_token(82)) {\r
+ jj_scanpos = xsp;\r
+ if (jj_scan_token(83)) {\r
+ jj_scanpos = xsp;\r
+ if (jj_scan_token(84)) {\r
+ jj_scanpos = xsp;\r
+ if (jj_scan_token(85)) return true;\r
+ }\r
+ }\r
+ }\r
+ return false;\r
+ }\r
+\r
/** Generated Token Manager. */\r
public ExpressionParserTokenManager token_source;\r
SimpleCharStream jj_input_stream;\r