return enumerationReferences;\r
}\r
\r
+/*\r
+ Collect EACH function call and all references that are inside the call brackets.\r
+ These are later used to exclude spread sheet references out of the normal functions.\r
+*/\r
+ String functionCall = null;\r
+ HashMap<String, List<Token>> functionCallReferences = new HashMap<String, List<Token>>();\r
+\r
+ public HashMap<String, List<Token>> getFunctionCallReferences() {\r
+ return functionCallReferences;\r
+ }\r
+\r
/*** Parser ********************************************************/\r
\r
// https://javacc.dev.java.net/doc/javaccgrm.html\r
default:\r
jj_la1[19] = jj_gen;\r
if (jj_2_1(2147483647)) {\r
+ functionCall = null;\r
name();\r
function_call_args();\r
+ functionCall = null;\r
} else {\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case IDENT:\r
\r
final public void name() throws ParseException {\r
jj_consume_token(IDENT);\r
+ if (functionCall == null)\r
+ functionCall = token.image;\r
+ else\r
+ functionCall += "." + token.image;\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case 68:\r
jj_consume_token(68);\r
final public void component_reference(String prevToken) throws ParseException {\r
jj_consume_token(IDENT);\r
String name = token.image;\r
- // prevToken != null => this is the second part of an enumeration\r
- if(forIndex == true && prevToken != null) {\r
- if(enumerationReferences.get(prevToken) == null) {\r
- enumerationReferences.put(prevToken, new ArrayList<Token>());\r
- }\r
- List<Token> list = enumerationReferences.get(prevToken);\r
- list.add(token);\r
-\r
- // forIndex == true, prevToken == null => this is the enumeration\r
- } else if(forIndex == true && prevToken == null) {\r
- if(enumerationReferences.get(name) == null) {\r
- enumerationReferences.put(name, new ArrayList<Token>());\r
- }\r
- List<Token> list = enumerationReferences.get(name);\r
- list.add(token);\r
+ // forIndex == true and prevToken != null => this is the second part of an enumeration in for-index\r
+ if(forIndex == true) {\r
+ if(prevToken != null) {\r
+ if(enumerationReferences.get(prevToken) == null) {\r
+ enumerationReferences.put(prevToken, new ArrayList<Token>());\r
+ }\r
+ List<Token> list = enumerationReferences.get(prevToken);\r
+ list.add(token);\r
+\r
+ // forIndex == true and prevToken == null => this is the enumeration in for-index\r
+ } else {\r
+ if(enumerationReferences.get(name) == null) {\r
+ enumerationReferences.put(name, new ArrayList<Token>());\r
+ }\r
+ List<Token> list = enumerationReferences.get(name);\r
+ list.add(token);\r
+ }\r
} else {\r
if(prevToken != null)\r
name = prevToken + "." + name;\r
}\r
List<Token> list = references.get(name);\r
list.add(token);\r
+\r
+ if(functionCall != null) {\r
+ if(!functionCallReferences.containsKey(functionCall))\r
+ functionCallReferences.put(functionCall, new ArrayList<Token>());\r
+ List<Token> functionReferencelist = getFunctionCallReferences().get(functionCall);\r
+ functionReferencelist.add(token);\r
+ }\r
}\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
case 66:\r
\r
final public void function_arguments() throws ParseException {\r
if (jj_2_2(2)) {\r
- expression();\r
+ named_argument();\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
- case 21:\r
case 71:\r
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
- case 71:\r
- jj_consume_token(71);\r
- function_arguments();\r
- break;\r
- case 21:\r
- jj_consume_token(21);\r
- for_indices();\r
- break;\r
- default:\r
- jj_la1[25] = jj_gen;\r
- jj_consume_token(-1);\r
- throw new ParseException();\r
- }\r
+ jj_consume_token(71);\r
+ function_arguments();\r
break;\r
default:\r
- jj_la1[26] = jj_gen;\r
+ jj_la1[25] = jj_gen;\r
;\r
}\r
} else {\r
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
+ case 6:\r
+ case 12:\r
+ case 31:\r
+ case 33:\r
+ case 35:\r
+ case 62:\r
+ case 64:\r
+ case 66:\r
+ case 78:\r
+ case 79:\r
+ case 80:\r
+ case 81:\r
case IDENT:\r
- named_arguments();\r
+ case STRING:\r
+ case UNSIGNED_INTEGER:\r
+ case UNSIGNED_NUMBER:\r
+ expression();\r
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
+ case 21:\r
+ case 71:\r
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
+ case 71:\r
+ jj_consume_token(71);\r
+ function_arguments();\r
+ break;\r
+ case 21:\r
+ jj_consume_token(21);\r
+ for_indices();\r
+ break;\r
+ default:\r
+ jj_la1[26] = jj_gen;\r
+ jj_consume_token(-1);\r
+ throw new ParseException();\r
+ }\r
+ break;\r
+ default:\r
+ jj_la1[27] = jj_gen;\r
+ ;\r
+ }\r
break;\r
default:\r
- jj_la1[27] = jj_gen;\r
+ jj_la1[28] = jj_gen;\r
jj_consume_token(-1);\r
throw new ParseException();\r
}\r
;\r
break;\r
default:\r
- jj_la1[28] = jj_gen;\r
+ jj_la1[29] = jj_gen;\r
break label_8;\r
}\r
jj_consume_token(71);\r
forRange.end = token;\r
forRanges.add(forRange);\r
break;\r
- default:\r
- jj_la1[29] = jj_gen;\r
- ;\r
- }\r
- forIndex = false;\r
- }\r
-\r
- final public void named_arguments() throws ParseException {\r
- named_argument();\r
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {\r
- case 71:\r
- jj_consume_token(71);\r
- named_arguments();\r
- break;\r
default:\r
jj_la1[30] = jj_gen;\r
;\r
}\r
+ forIndex = false;\r
}\r
\r
+/* Removed by Teemu. Refactored in function_arguments)\r
+void named_arguments() : {\r
+} {\r
+ named_argument() ( "," named_arguments() )?\r
+}\r
+*/\r
final public void named_argument() throws ParseException {\r
jj_consume_token(IDENT);\r
jj_consume_token(88);\r
finally { jj_save(1, xla); }\r
}\r
\r
- private boolean jj_3R_35() {\r
- if (jj_3R_37()) return true;\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_38()) jj_scanpos = xsp;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_52() {\r
- if (jj_scan_token(68)) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_31() {\r
- if (jj_3R_35()) return true;\r
- Token xsp;\r
- while (true) {\r
- xsp = jj_scanpos;\r
- if (jj_3R_36()) { jj_scanpos = xsp; break; }\r
- }\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_34() {\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_scan_token(78)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(79)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(80)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(81)) return true;\r
- }\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_26() {\r
- if (jj_scan_token(9)) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_30() {\r
- if (jj_3R_34()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_55() {\r
- if (jj_3R_57()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_28() {\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_30()) jj_scanpos = xsp;\r
- if (jj_3R_31()) return true;\r
- while (true) {\r
- xsp = jj_scanpos;\r
- if (jj_3R_32()) { jj_scanpos = xsp; break; }\r
- }\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_33() {\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_scan_token(72)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(73)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(74)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(75)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(76)) {\r
- jj_scanpos = xsp;\r
- if (jj_scan_token(77)) return true;\r
- }\r
- }\r
- }\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_50() {\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3_2()) {\r
- jj_scanpos = xsp;\r
- if (jj_3R_55()) return true;\r
- }\r
- return false;\r
- }\r
-\r
- private boolean jj_3_2() {\r
- if (jj_3R_13()) return true;\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_14()) jj_scanpos = xsp;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_22() {\r
- if (jj_scan_token(69)) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_24() {\r
- if (jj_scan_token(22)) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_27() {\r
- if (jj_3R_28()) return true;\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_29()) jj_scanpos = xsp;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_46() {\r
- if (jj_scan_token(62)) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_25() {\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_scan_token(12)) jj_scanpos = xsp;\r
- if (jj_3R_27()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_51() {\r
- if (jj_3R_56()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_23() {\r
- if (jj_3R_25()) return true;\r
- Token xsp;\r
- while (true) {\r
- xsp = jj_scanpos;\r
- if (jj_3R_26()) { jj_scanpos = xsp; break; }\r
- }\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_21() {\r
- if (jj_3R_23()) return true;\r
- Token xsp;\r
- while (true) {\r
- xsp = jj_scanpos;\r
- if (jj_3R_24()) { jj_scanpos = xsp; break; }\r
- }\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_20() {\r
- if (jj_3R_21()) return true;\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_22()) jj_scanpos = xsp;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_17() {\r
- if (jj_scan_token(31)) return true;\r
- if (jj_3R_13()) return true;\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
- if (jj_3R_16()) {\r
- jj_scanpos = xsp;\r
- if (jj_3R_17()) return true;\r
- }\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_16() {\r
- if (jj_3R_20()) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_56() {\r
- if (jj_scan_token(66)) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_15() {\r
+ private boolean jj_3R_14() {\r
if (jj_scan_token(68)) return true;\r
if (jj_3R_12()) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_19() {\r
- if (jj_scan_token(21)) return true;\r
- return false;\r
- }\r
-\r
- private boolean jj_3R_47() {\r
+ private boolean jj_3R_13() {\r
if (jj_scan_token(IDENT)) return true;\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_51()) jj_scanpos = xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_52()) jj_scanpos = xsp;\r
+ if (jj_scan_token(88)) 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
+ private boolean jj_3_2() {\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
- private boolean jj_3R_12() {\r
- if (jj_scan_token(IDENT)) return true;\r
- Token xsp;\r
- xsp = jj_scanpos;\r
- if (jj_3R_15()) jj_scanpos = xsp;\r
- return false;\r
- }\r
-\r
private boolean jj_3_1() {\r
if (jj_3R_12()) return true;\r
if (jj_scan_token(62)) return true;\r
return false;\r
}\r
\r
- private boolean jj_3R_58() {\r
+ private boolean jj_3R_12() {\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
+ if (jj_3R_14()) jj_scanpos = xsp;\r
return false;\r
}\r
\r
jj_la1_init_2();\r
}\r
private static void jj_la1_init_0() {\r
- jj_la1_0 = new int[] {0x100000,0x80001040,0x100000,0x80001040,0x0,0x0,0x400000,0x200,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x80001040,0x200000,0x200000,0x0,0x0,0x0,0x0,0x80001040,0x0,0x80001040,0x0,0x0,0x0,0x0,0x0,};\r
+ jj_la1_0 = new int[] {0x100000,0x80001040,0x100000,0x80001040,0x0,0x0,0x400000,0x200,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x80001040,0x0,0x200000,0x200000,0x80001040,0x0,0x0,0x80001040,0x0,0x80001040,0x0,0x0,0x0,0x0,0x0,};\r
}\r
private static void jj_la1_init_1() {\r
- jj_la1_1 = new int[] {0x0,0x4000000a,0x0,0x4000000a,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x40000008,0x0,0x0,0x0,0x4000000a,0x0,0x0,0x0,0x0,0x200,0x0,0x4000000a,0x0,0x4000000a,0x0,0x0,0x0,0x0,0x0,};\r
+ jj_la1_1 = new int[] {0x0,0x4000000a,0x0,0x4000000a,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x40000008,0x0,0x0,0x0,0x4000000a,0x0,0x0,0x0,0x4000000a,0x0,0x200,0x4000000a,0x0,0x4000000a,0x0,0x0,0x0,0x0,0x0,};\r
}\r
private static void jj_la1_init_2() {\r
- jj_la1_2 = new int[] {0x0,0x3c03c005,0x0,0x3c03c005,0x20,0x20,0x0,0x0,0x0,0x3f00,0x3f00,0x3c000,0x3c000,0x3c000,0x3c0000,0xc00000,0xc00000,0x3c0000,0x40,0x38000000,0x4000005,0x10,0x4,0x10,0x3c03c005,0x80,0x80,0x4000000,0x80,0x0,0x80,0x3c03c005,0x80,0x3c03c005,0x80,0x80,0x20,0x14000020,0x14000000,};\r
+ jj_la1_2 = new int[] {0x0,0x3c03c005,0x0,0x3c03c005,0x20,0x20,0x0,0x0,0x0,0x3f00,0x3f00,0x3c000,0x3c000,0x3c000,0x3c0000,0xc00000,0xc00000,0x3c0000,0x40,0x38000000,0x4000005,0x10,0x4,0x10,0x3c03c005,0x80,0x80,0x80,0x3c03c005,0x80,0x0,0x3c03c005,0x80,0x3c03c005,0x80,0x80,0x20,0x14000020,0x14000000,};\r
}\r
final private JJCalls[] jj_2_rtns = new JJCalls[2];\r
private boolean jj_rescan = false;\r