From: miettinen Date: Fri, 14 Feb 2014 13:01:30 +0000 (+0000) Subject: Allow variables starting and ending with ' characters in Sysdyn ExpressionParser... X-Git-Tag: 1.8.1~138 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=ea08cbb8cd971a5bf28651da99ce147b502a3ad9;p=simantics%2Fsysdyn.git Allow variables starting and ending with ' characters in Sysdyn ExpressionParser (refs #2924). git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@28846 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java index a369e706..bcb3d09e 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java @@ -86,6 +86,7 @@ public class ExpressionParser implements ExpressionParserConstants { case 78: case 79: case IDENT: + case QIDENT: case STRING: case UNSIGNED_INTEGER: case UNSIGNED_NUMBER: @@ -139,6 +140,7 @@ public class ExpressionParser implements ExpressionParserConstants { case 78: case 79: case IDENT: + case QIDENT: case STRING: case UNSIGNED_INTEGER: case UNSIGNED_NUMBER: @@ -433,6 +435,7 @@ public class ExpressionParser implements ExpressionParserConstants { } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: + case QIDENT: component_reference(null); break; case 60: @@ -479,11 +482,14 @@ public class ExpressionParser implements ExpressionParserConstants { Token concatToken = null; Token continuationToken = null; String fullStr = null; - jj_consume_token(IDENT); - concatToken = token; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: - continuationToken = ident(); + jj_consume_token(IDENT); + concatToken = token; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENT: + case QIDENT: + continuationToken = ident(); fullStr = new String(""); // Replace whitespace sequence with a single space character. fullStr += concatToken.image + " " + continuationToken.image; @@ -494,12 +500,22 @@ public class ExpressionParser implements ExpressionParserConstants { tempToken.endLine = token.endLine; tempToken.endColumn = token.endColumn; concatToken = tempToken; + break; + default: + jj_la1[21] = jj_gen; + ; + } + {if (true) return concatToken;} + break; + case QIDENT: + jj_consume_token(QIDENT); + {if (true) return token;} break; default: - jj_la1[21] = jj_gen; - ; + jj_la1[22] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } - {if (true) return concatToken;} throw new Error("Missing return statement in function"); } @@ -516,7 +532,7 @@ public class ExpressionParser implements ExpressionParserConstants { name(); break; default: - jj_la1[22] = jj_gen; + jj_la1[23] = jj_gen; ; } } @@ -564,7 +580,7 @@ public class ExpressionParser implements ExpressionParserConstants { array_subscripts(identToken); break; default: - jj_la1[23] = jj_gen; + jj_la1[24] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -573,7 +589,7 @@ public class ExpressionParser implements ExpressionParserConstants { component_reference(name); break; default: - jj_la1[24] = jj_gen; + jj_la1[25] = jj_gen; ; } } @@ -594,13 +610,14 @@ public class ExpressionParser implements ExpressionParserConstants { case 78: case 79: case IDENT: + case QIDENT: case STRING: case UNSIGNED_INTEGER: case UNSIGNED_NUMBER: function_arguments(); break; default: - jj_la1[25] = jj_gen; + jj_la1[26] = jj_gen; ; } jj_consume_token(61); @@ -619,7 +636,7 @@ public class ExpressionParser implements ExpressionParserConstants { function_arguments(); break; default: - jj_la1[26] = jj_gen; + jj_la1[27] = jj_gen; ; } } else { @@ -637,6 +654,7 @@ public class ExpressionParser implements ExpressionParserConstants { case 78: case 79: case IDENT: + case QIDENT: case STRING: case UNSIGNED_INTEGER: case UNSIGNED_NUMBER: @@ -654,18 +672,18 @@ public class ExpressionParser implements ExpressionParserConstants { for_indices(); break; default: - jj_la1[27] = jj_gen; + jj_la1[28] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[28] = jj_gen; + jj_la1[29] = jj_gen; ; } break; default: - jj_la1[29] = jj_gen; + jj_la1[30] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -681,7 +699,7 @@ public class ExpressionParser implements ExpressionParserConstants { ; break; default: - jj_la1[30] = jj_gen; + jj_la1[31] = jj_gen; break label_8; } jj_consume_token(69); @@ -706,7 +724,7 @@ public class ExpressionParser implements ExpressionParserConstants { forRanges.add(forRange); break; default: - jj_la1[31] = jj_gen; + jj_la1[32] = jj_gen; ; } forIndex = false; @@ -739,13 +757,14 @@ void named_arguments() : { case 78: case 79: case IDENT: + case QIDENT: case STRING: case UNSIGNED_INTEGER: case UNSIGNED_NUMBER: expression(); break; default: - jj_la1[32] = jj_gen; + jj_la1[33] = jj_gen; ; } label_9: @@ -755,7 +774,7 @@ void named_arguments() : { ; break; default: - jj_la1[33] = jj_gen; + jj_la1[34] = jj_gen; break label_9; } jj_consume_token(69); @@ -773,13 +792,14 @@ void named_arguments() : { case 78: case 79: case IDENT: + case QIDENT: case STRING: case UNSIGNED_INTEGER: case UNSIGNED_NUMBER: expression(); break; default: - jj_la1[34] = jj_gen; + jj_la1[35] = jj_gen; ; } } @@ -794,7 +814,7 @@ void named_arguments() : { ; break; default: - jj_la1[35] = jj_gen; + jj_la1[36] = jj_gen; break label_10; } jj_consume_token(69); @@ -817,7 +837,7 @@ void named_arguments() : { ; break; default: - jj_la1[36] = jj_gen; + jj_la1[37] = jj_gen; break label_11; } jj_consume_token(69); @@ -837,7 +857,7 @@ void named_arguments() : { currentRange.add(token); break; default: - jj_la1[38] = jj_gen; + jj_la1[39] = jj_gen; if (jj_2_3(2147483647)) { functionCall = null; name(); @@ -850,6 +870,7 @@ void named_arguments() : { } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENT: + case QIDENT: case UNSIGNED_INTEGER: rangeIndex(rangeToken, true); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -858,7 +879,7 @@ void named_arguments() : { rangeIndex(rangeToken, false); break; default: - jj_la1[37] = jj_gen; + jj_la1[38] = jj_gen; ; } rangeToken.endColumn = token.endColumn; @@ -866,7 +887,7 @@ void named_arguments() : { currentRange.add(rangeToken); break; default: - jj_la1[39] = jj_gen; + jj_la1[40] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -884,11 +905,12 @@ void named_arguments() : { rangeToken.image = rangeToken.image + token.image; break; case IDENT: + case QIDENT: identToken = ident(); rangeToken.image = rangeToken.image + identToken; break; default: - jj_la1[40] = jj_gen; + jj_la1[41] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -915,59 +937,24 @@ void named_arguments() : { finally { jj_save(2, xla); } } - private boolean jj_3R_13() { - if (jj_3R_14()) return true; - if (jj_scan_token(86)) return true; - if (jj_3R_16()) return true; - return false; - } - - private boolean jj_3R_66() { - if (jj_scan_token(21)) return true; - if (jj_3R_70()) return true; - return false; - } - - private boolean jj_3R_36() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(76)) { - jj_scanpos = xsp; - if (jj_scan_token(77)) { - jj_scanpos = xsp; - if (jj_scan_token(78)) { - jj_scanpos = xsp; - if (jj_scan_token(79)) return true; - } - } - } - return false; - } - - private boolean jj_3R_28() { - if (jj_scan_token(9)) return true; - if (jj_3R_27()) return true; + private boolean jj_3R_34() { + if (jj_3R_38()) return true; return false; } private boolean jj_3R_32() { - if (jj_3R_36()) return true; - return false; - } - - private boolean jj_3R_30() { Token xsp; xsp = jj_scanpos; - if (jj_3R_32()) jj_scanpos = xsp; - if (jj_3R_33()) return true; + if (jj_3R_34()) jj_scanpos = xsp; + if (jj_3R_35()) return true; while (true) { xsp = jj_scanpos; - if (jj_3R_34()) { jj_scanpos = xsp; break; } + if (jj_3R_36()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_35() { + private boolean jj_3R_37() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(70)) { @@ -989,72 +976,52 @@ void named_arguments() : { return false; } - private boolean jj_3R_50() { - if (jj_3R_14()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_55()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_56()) jj_scanpos = xsp; + private boolean jj_3R_15() { + if (jj_scan_token(66)) return true; + if (jj_3R_12()) return true; return false; } - private boolean jj_3R_23() { + private boolean jj_3R_74() { if (jj_scan_token(67)) return true; - if (jj_3R_22()) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_26()) jj_scanpos = xsp; + if (jj_3R_73()) return true; return false; } private boolean jj_3R_25() { - if (jj_scan_token(22)) return true; + if (jj_scan_token(67)) return true; if (jj_3R_24()) return true; - return false; - } - - private boolean jj_3R_29() { - if (jj_3R_30()) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_31()) jj_scanpos = xsp; + if (jj_3R_28()) jj_scanpos = xsp; return false; } - private boolean jj_3R_15() { - if (jj_scan_token(66)) return true; - if (jj_3R_12()) return true; - return false; - } - - private boolean jj_3R_72() { - if (jj_scan_token(67)) return true; - if (jj_3R_71()) return true; + private boolean jj_3R_27() { + if (jj_scan_token(22)) return true; + if (jj_3R_26()) return true; return false; } - private boolean jj_3R_77() { + private boolean jj_3R_79() { if (jj_scan_token(41)) return true; if (jj_3R_16()) return true; return false; } - private boolean jj_3R_27() { + private boolean jj_3R_31() { + if (jj_3R_32()) return true; Token xsp; xsp = jj_scanpos; - if (jj_scan_token(12)) jj_scanpos = xsp; - if (jj_3R_29()) return true; + if (jj_3R_33()) jj_scanpos = xsp; return false; } - private boolean jj_3R_24() { - if (jj_3R_27()) return true; + private boolean jj_3R_29() { Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_28()) { jj_scanpos = xsp; break; } - } + xsp = jj_scanpos; + if (jj_scan_token(12)) jj_scanpos = xsp; + if (jj_3R_31()) return true; return false; } @@ -1066,142 +1033,157 @@ void named_arguments() : { return false; } - private boolean jj_3R_74() { + private boolean jj_3R_76() { if (jj_scan_token(69)) return true; - if (jj_3R_73()) return true; + if (jj_3R_75()) return true; return false; } - private boolean jj_3R_22() { - if (jj_3R_24()) return true; + private boolean jj_3R_26() { + if (jj_3R_29()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_25()) { jj_scanpos = xsp; break; } + if (jj_3R_30()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_65() { + private boolean jj_3R_67() { if (jj_scan_token(69)) return true; - if (jj_3R_53()) return true; + if (jj_3R_55()) return true; return false; } - private boolean jj_3R_62() { + private boolean jj_3R_64() { Token xsp; xsp = jj_scanpos; - if (jj_3R_65()) { + if (jj_3R_67()) { jj_scanpos = xsp; - if (jj_3R_66()) return true; + if (jj_3R_68()) return true; } return false; } - private boolean jj_3R_56() { + private boolean jj_3R_58() { if (jj_scan_token(66)) return true; - if (jj_3R_50()) return true; + if (jj_3R_52()) return true; return false; } - private boolean jj_3R_76() { + private boolean jj_3R_78() { if (jj_3R_14()) return true; return false; } - private boolean jj_3R_73() { + private boolean jj_3R_75() { if (jj_3R_14()) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_77()) jj_scanpos = xsp; + if (jj_3R_79()) jj_scanpos = xsp; return false; } - private boolean jj_3R_20() { - if (jj_3R_22()) return true; + private boolean jj_3R_24() { + if (jj_3R_26()) return true; Token xsp; - xsp = jj_scanpos; - if (jj_3R_23()) jj_scanpos = xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_27()) { jj_scanpos = xsp; break; } + } return false; } - private boolean jj_3R_75() { + private boolean jj_3R_77() { if (jj_scan_token(UNSIGNED_INTEGER)) return true; return false; } - private boolean jj_3R_71() { + private boolean jj_3R_73() { Token xsp; xsp = jj_scanpos; - if (jj_3R_75()) { + if (jj_3R_77()) { jj_scanpos = xsp; - if (jj_3R_76()) return true; + if (jj_3R_78()) return true; } return false; } - private boolean jj_3R_52() { - if (jj_scan_token(68)) return true; - if (jj_3R_51()) return true; + private boolean jj_3_2() { + if (jj_3R_13()) return true; return false; } - private boolean jj_3R_19() { - if (jj_scan_token(31)) return true; - if (jj_3R_16()) return true; - if (jj_scan_token(28)) return true; - if (jj_3R_16()) return true; + private boolean jj_3R_22() { + if (jj_3R_24()) return true; Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_21()) { jj_scanpos = xsp; break; } - } - if (jj_scan_token(15)) return true; - if (jj_3R_16()) return true; + xsp = jj_scanpos; + if (jj_3R_25()) jj_scanpos = xsp; return false; } - private boolean jj_3_2() { - if (jj_3R_13()) return true; + private boolean jj_3R_18() { + if (jj_scan_token(QIDENT)) return true; return false; } - private boolean jj_3R_70() { - if (jj_3R_73()) return true; + private boolean jj_3R_72() { + if (jj_3R_75()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_74()) { jj_scanpos = xsp; break; } + if (jj_3R_76()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_18() { - if (jj_3R_20()) return true; + private boolean jj_3R_54() { + if (jj_scan_token(68)) return true; + if (jj_3R_53()) return true; return false; } - private boolean jj_3R_16() { + private boolean jj_3R_20() { + if (jj_scan_token(31)) return true; + if (jj_3R_16()) return true; + if (jj_scan_token(28)) return true; + if (jj_3R_16()) return true; Token xsp; - xsp = jj_scanpos; - if (jj_3R_18()) { - jj_scanpos = xsp; - if (jj_3R_19()) return true; + while (true) { + xsp = jj_scanpos; + if (jj_3R_23()) { jj_scanpos = xsp; break; } } + if (jj_scan_token(15)) return true; + if (jj_3R_16()) return true; return false; } - private boolean jj_3R_59() { + private boolean jj_3R_61() { if (jj_3R_16()) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_62()) jj_scanpos = xsp; + if (jj_3R_64()) jj_scanpos = xsp; return false; } - private boolean jj_3R_64() { + private boolean jj_3R_66() { if (jj_scan_token(69)) return true; - if (jj_3R_63()) return true; + if (jj_3R_65()) return true; + return false; + } + + private boolean jj_3R_19() { + if (jj_3R_22()) return true; + return false; + } + + private boolean jj_3R_16() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_19()) { + jj_scanpos = xsp; + if (jj_3R_20()) return true; + } return false; } @@ -1211,176 +1193,204 @@ void named_arguments() : { return false; } - private boolean jj_3R_69() { - if (jj_3R_71()) return true; + private boolean jj_3R_71() { + if (jj_3R_73()) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_72()) jj_scanpos = xsp; + if (jj_3R_74()) jj_scanpos = xsp; return false; } - private boolean jj_3R_58() { + private boolean jj_3R_60() { if (jj_3R_13()) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_61()) jj_scanpos = xsp; + if (jj_3R_63()) jj_scanpos = xsp; return false; } - private boolean jj_3R_53() { + private boolean jj_3R_55() { Token xsp; xsp = jj_scanpos; - if (jj_3R_58()) { + if (jj_3R_60()) { jj_scanpos = xsp; - if (jj_3R_59()) return true; + if (jj_3R_61()) return true; } return false; } - private boolean jj_3R_17() { + private boolean jj_3R_56() { + if (jj_3R_55()) return true; + return false; + } + + private boolean jj_3R_21() { if (jj_3R_14()) return true; return false; } - private boolean jj_3R_14() { + private boolean jj_3R_70() { + if (jj_3R_12()) return true; + if (jj_3R_51()) return true; + return false; + } + + private boolean jj_3R_17() { if (jj_scan_token(IDENT)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_17()) jj_scanpos = xsp; + if (jj_3R_21()) jj_scanpos = xsp; return false; } - private boolean jj_3R_54() { - if (jj_3R_53()) return true; + private boolean jj_3R_14() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_17()) { + jj_scanpos = xsp; + if (jj_3R_18()) return true; + } return false; } - private boolean jj_3R_48() { + private boolean jj_3R_51() { + if (jj_scan_token(60)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_56()) jj_scanpos = xsp; + if (jj_scan_token(61)) return true; + return false; + } + + private boolean jj_3R_50() { if (jj_scan_token(85)) return true; - if (jj_3R_39()) return true; + if (jj_3R_41()) return true; return false; } - private boolean jj_3R_68() { - if (jj_3R_12()) return true; - if (jj_3R_49()) return true; + private boolean jj_3R_57() { + if (jj_3R_62()) return true; return false; } - private boolean jj_3_1() { - if (jj_3R_12()) return true; - if (jj_scan_token(60)) return true; + private boolean jj_3R_69() { + if (jj_scan_token(67)) return true; return false; } - private boolean jj_3R_49() { - if (jj_scan_token(60)) return true; + private boolean jj_3R_65() { Token xsp; xsp = jj_scanpos; - if (jj_3R_54()) jj_scanpos = xsp; - if (jj_scan_token(61)) return true; + if (jj_3R_69()) { + jj_scanpos = xsp; + if (jj_3R_70()) { + jj_scanpos = xsp; + if (jj_3R_71()) return true; + } + } return false; } - private boolean jj_3R_46() { + private boolean jj_3_1() { + if (jj_3R_12()) return true; + if (jj_scan_token(60)) return true; + return false; + } + + private boolean jj_3R_48() { if (jj_scan_token(62)) return true; - if (jj_3R_53()) return true; + if (jj_3R_55()) return true; if (jj_scan_token(63)) return true; return false; } - private boolean jj_3R_45() { + private boolean jj_3R_47() { if (jj_scan_token(64)) return true; - if (jj_3R_51()) return true; + if (jj_3R_53()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_52()) { jj_scanpos = xsp; break; } + if (jj_3R_54()) { jj_scanpos = xsp; break; } } if (jj_scan_token(65)) return true; return false; } - private boolean jj_3R_44() { + private boolean jj_3R_46() { if (jj_scan_token(60)) return true; if (jj_3R_16()) return true; if (jj_scan_token(61)) return true; return false; } - private boolean jj_3R_55() { - if (jj_3R_60()) return true; + private boolean jj_3R_45() { + if (jj_3R_52()) return true; return false; } - private boolean jj_3R_67() { - if (jj_scan_token(67)) return true; + private boolean jj_3R_59() { + if (jj_scan_token(69)) return true; + if (jj_3R_16()) return true; return false; } - private boolean jj_3R_63() { + private boolean jj_3R_62() { + if (jj_scan_token(64)) return true; + if (jj_3R_65()) return true; Token xsp; - xsp = jj_scanpos; - if (jj_3R_67()) { - jj_scanpos = xsp; - if (jj_3R_68()) { - jj_scanpos = xsp; - if (jj_3R_69()) return true; - } + while (true) { + xsp = jj_scanpos; + if (jj_3R_66()) { jj_scanpos = xsp; break; } } + if (jj_scan_token(65)) return true; return false; } - private boolean jj_3R_43() { - if (jj_3R_50()) return true; - return false; - } - - private boolean jj_3R_42() { + private boolean jj_3R_44() { if (jj_3R_12()) return true; - if (jj_3R_49()) return true; + if (jj_3R_51()) return true; return false; } - private boolean jj_3R_47() { + private boolean jj_3R_49() { if (jj_scan_token(84)) return true; - if (jj_3R_39()) return true; + if (jj_3R_41()) return true; return false; } - private boolean jj_3R_40() { + private boolean jj_3R_42() { Token xsp; xsp = jj_scanpos; - if (jj_3R_47()) { + if (jj_3R_49()) { jj_scanpos = xsp; - if (jj_3R_48()) return true; + if (jj_3R_50()) return true; } return false; } - private boolean jj_3R_39() { + private boolean jj_3R_41() { Token xsp; xsp = jj_scanpos; + if (jj_scan_token(92)) { + jj_scanpos = xsp; if (jj_scan_token(91)) { jj_scanpos = xsp; if (jj_scan_token(90)) { jj_scanpos = xsp; - if (jj_scan_token(89)) { - jj_scanpos = xsp; if (jj_scan_token(6)) { jj_scanpos = xsp; if (jj_scan_token(33)) { jj_scanpos = xsp; - if (jj_3R_42()) { - jj_scanpos = xsp; - if (jj_3R_43()) { - jj_scanpos = xsp; if (jj_3R_44()) { jj_scanpos = xsp; if (jj_3R_45()) { jj_scanpos = xsp; if (jj_3R_46()) { jj_scanpos = xsp; + if (jj_3R_47()) { + jj_scanpos = xsp; + if (jj_3R_48()) { + jj_scanpos = xsp; if (jj_scan_token(35)) return true; } } @@ -1395,49 +1405,31 @@ void named_arguments() : { return false; } - private boolean jj_3R_57() { - if (jj_scan_token(69)) return true; - if (jj_3R_16()) return true; - return false; - } - - private boolean jj_3R_60() { - if (jj_scan_token(64)) return true; - if (jj_3R_63()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_64()) { jj_scanpos = xsp; break; } - } - if (jj_scan_token(65)) return true; + private boolean jj_3R_28() { + if (jj_scan_token(67)) return true; + if (jj_3R_24()) return true; return false; } - private boolean jj_3R_26() { - if (jj_scan_token(67)) return true; - if (jj_3R_22()) return true; + private boolean jj_3R_40() { + if (jj_3R_43()) return true; + if (jj_3R_39()) return true; return false; } - private boolean jj_3R_38() { - if (jj_3R_41()) return true; + private boolean jj_3R_33() { if (jj_3R_37()) return true; + if (jj_3R_32()) return true; return false; } - private boolean jj_3R_31() { + private boolean jj_3R_36() { + if (jj_3R_38()) return true; if (jj_3R_35()) return true; - if (jj_3R_30()) return true; return false; } - private boolean jj_3R_34() { - if (jj_3R_36()) return true; - if (jj_3R_33()) return true; - return false; - } - - private boolean jj_3R_41() { + private boolean jj_3R_43() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(80)) { @@ -1453,25 +1445,44 @@ void named_arguments() : { return false; } - private boolean jj_3R_37() { - if (jj_3R_39()) return true; + private boolean jj_3R_39() { + if (jj_3R_41()) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_40()) jj_scanpos = xsp; + if (jj_3R_42()) jj_scanpos = xsp; return false; } - private boolean jj_3R_51() { + private boolean jj_3R_53() { if (jj_3R_16()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_57()) { jj_scanpos = xsp; break; } + if (jj_3R_59()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_21() { + private boolean jj_3R_63() { + if (jj_scan_token(69)) return true; + if (jj_3R_55()) return true; + return false; + } + + private boolean jj_3R_13() { + if (jj_3R_14()) return true; + if (jj_scan_token(86)) return true; + if (jj_3R_16()) return true; + return false; + } + + private boolean jj_3R_68() { + if (jj_scan_token(21)) return true; + if (jj_3R_72()) return true; + return false; + } + + private boolean jj_3R_23() { if (jj_scan_token(20)) return true; if (jj_3R_16()) return true; if (jj_scan_token(28)) return true; @@ -1479,19 +1490,45 @@ void named_arguments() : { return false; } - private boolean jj_3R_33() { - if (jj_3R_37()) return true; + private boolean jj_3R_35() { + if (jj_3R_39()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_38()) { jj_scanpos = xsp; break; } + if (jj_3R_40()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_61() { - if (jj_scan_token(69)) return true; - if (jj_3R_53()) return true; + private boolean jj_3R_38() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(76)) { + jj_scanpos = xsp; + if (jj_scan_token(77)) { + jj_scanpos = xsp; + if (jj_scan_token(78)) { + jj_scanpos = xsp; + if (jj_scan_token(79)) return true; + } + } + } + return false; + } + + private boolean jj_3R_52() { + if (jj_3R_14()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_57()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_58()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_30() { + if (jj_scan_token(9)) return true; + if (jj_3R_29()) return true; return false; } @@ -1506,7 +1543,7 @@ void named_arguments() : { private Token jj_scanpos, jj_lastpos; private int jj_la; private int jj_gen; - final private int[] jj_la1 = new int[41]; + final private int[] jj_la1 = new int[42]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; @@ -1516,13 +1553,13 @@ void named_arguments() : { jj_la1_init_2(); } private static void jj_la1_init_0() { - 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,0x0,0x80001040,0x0,0x200000,0x200000,0x80001040,0x0,0x0,0x80001040,0x0,0x80001040,0x0,0x0,0x0,0x0,0x0,0x0,}; + 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,0x0,0x0,0x80001040,0x0,0x200000,0x200000,0x80001040,0x0,0x0,0x80001040,0x0,0x80001040,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_1() { - jj_la1_1 = new int[] {0x0,0x5000000a,0x0,0x5000000a,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x50000008,0x0,0x0,0x0,0x0,0x5000000a,0x0,0x0,0x0,0x5000000a,0x0,0x200,0x5000000a,0x0,0x5000000a,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_1 = new int[] {0x0,0x5000000a,0x0,0x5000000a,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x50000008,0x0,0x0,0x0,0x0,0x0,0x5000000a,0x0,0x0,0x0,0x5000000a,0x0,0x200,0x5000000a,0x0,0x5000000a,0x0,0x0,0x0,0x0,0x0,0x0,}; } private static void jj_la1_init_2() { - jj_la1_2 = new int[] {0x0,0xf00f001,0x0,0xf00f001,0x8,0x8,0x0,0x0,0x0,0xfc0,0xfc0,0xf000,0xf000,0xf000,0xf0000,0x300000,0x300000,0xf0000,0x10,0xe000000,0x1000001,0x1000000,0x4,0x1,0x4,0xf00f001,0x20,0x20,0x20,0xf00f001,0x20,0x0,0xf00f001,0x20,0xf00f001,0x20,0x20,0x8,0x8,0x5000000,0x5000000,}; + jj_la1_2 = new int[] {0x0,0x1f00f001,0x0,0x1f00f001,0x8,0x8,0x0,0x0,0x0,0xfc0,0xfc0,0xf000,0xf000,0xf000,0xf0000,0x300000,0x300000,0xf0000,0x10,0x1c000000,0x3000001,0x3000000,0x3000000,0x4,0x1,0x4,0x1f00f001,0x20,0x20,0x20,0x1f00f001,0x20,0x0,0x1f00f001,0x20,0x1f00f001,0x20,0x20,0x8,0x8,0xb000000,0xb000000,}; } final private JJCalls[] jj_2_rtns = new JJCalls[3]; private boolean jj_rescan = false; @@ -1539,7 +1576,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 41; i++) jj_la1[i] = -1; + for (int i = 0; i < 42; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1554,7 +1591,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 41; i++) jj_la1[i] = -1; + for (int i = 0; i < 42; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1565,7 +1602,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 41; i++) jj_la1[i] = -1; + for (int i = 0; i < 42; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1576,7 +1613,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 41; i++) jj_la1[i] = -1; + for (int i = 0; i < 42; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1586,7 +1623,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 41; i++) jj_la1[i] = -1; + for (int i = 0; i < 42; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1596,7 +1633,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 41; i++) jj_la1[i] = -1; + for (int i = 0; i < 42; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1708,12 +1745,12 @@ void named_arguments() : { /** Generate ParseException. */ public ParseException generateParseException() { jj_expentries.clear(); - boolean[] la1tokens = new boolean[92]; + boolean[] la1tokens = new boolean[93]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 41; i++) { + for (int i = 0; i < 42; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1< +| + /* Excluded "#","$","%","&","(",")","<",">","[","]","{","}","|", and "\"" because of Sysdyn */ + /* Excluded "\?", "\a", and "\v" because of JavaCC */ + /* Excluded "\n","\r", and "\t" just in case */ | { matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); } | @@ -235,7 +240,13 @@ Token ident() : { } )? { return concatToken; - } } + } + | + + { + return token; + } +} void name() : { Token identToken = null; } { diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserConstants.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserConstants.java index 59c2d075..62dfa364 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserConstants.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserConstants.java @@ -19,11 +19,13 @@ public interface ExpressionParserConstants { /** RegularExpression Id. */ int IDENT = 88; /** RegularExpression Id. */ - int STRING = 89; + int QIDENT = 89; /** RegularExpression Id. */ - int UNSIGNED_INTEGER = 90; + int STRING = 90; /** RegularExpression Id. */ - int UNSIGNED_NUMBER = 91; + int UNSIGNED_INTEGER = 91; + /** RegularExpression Id. */ + int UNSIGNED_NUMBER = 92; /** Lexical state. */ int DEFAULT = 0; @@ -119,6 +121,7 @@ public interface ExpressionParserConstants { "\"=\"", "\":=\"", "", + "", "", "", "", diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserTokenManager.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserTokenManager.java index 7c7a5cfc..011bc205 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserTokenManager.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParserTokenManager.java @@ -19,15 +19,15 @@ private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) switch (pos) { case 0: + if ((active1 & 0x2cc004L) != 0L) + return 12; if ((active0 & 0xffffffffffffff0L) != 0L) { jjmatchedKind = 88; return 2; } if ((active1 & 0x20000L) != 0L) - return 13; - if ((active1 & 0x2cc004L) != 0L) - return 9; + return 16; return -1; case 1: if ((active0 & 0x84020080400000L) != 0L) @@ -182,7 +182,7 @@ private int jjMoveStringLiteralDfa0_0() jjmatchedKind = 66; return jjMoveStringLiteralDfa1_0(0x0L, 0x2cc000L); case 47: - return jjStartNfaWithStates_0(0, 81, 13); + return jjStartNfaWithStates_0(0, 81, 16); case 58: jjmatchedKind = 67; return jjMoveStringLiteralDfa1_0(0x0L, 0x800000L); @@ -830,7 +830,7 @@ static final long[] jjbitVec0 = { private int jjMoveNfa_0(int startState, int curPos) { int startsAt = 0; - jjnewStateCnt = 31; + jjnewStateCnt = 34; int i = 1; jjstateSet[0] = startState; int kind = 0x7fffffff; @@ -845,22 +845,12 @@ private int jjMoveNfa_0(int startState, int curPos) { switch(jjstateSet[--i]) { - case 13: - if (curChar == 47) - { - if (kind > 3) - kind = 3; - jjCheckNAdd(20); - } - else if (curChar == 42) - jjCheckNAddStates(0, 2); - break; case 0: if ((0x3ff000000000000L & l) != 0L) { - if (kind > 90) - kind = 90; - jjCheckNAddStates(3, 7); + if (kind > 91) + kind = 91; + jjCheckNAddStates(0, 4); } else if ((0x100002600L & l) != 0L) { @@ -868,10 +858,22 @@ private int jjMoveNfa_0(int startState, int curPos) kind = 1; } else if (curChar == 47) - jjAddStates(8, 9); + jjAddStates(5, 6); else if (curChar == 46) - jjCheckNAdd(9); + jjCheckNAdd(12); else if (curChar == 34) + jjCheckNAddStates(7, 9); + else if (curChar == 39) + jjCheckNAddTwoStates(4, 5); + break; + case 16: + if (curChar == 47) + { + if (kind > 3) + kind = 3; + jjCheckNAdd(23); + } + else if (curChar == 42) jjCheckNAddStates(10, 12); break; case 2: @@ -882,126 +884,138 @@ private int jjMoveNfa_0(int startState, int curPos) jjstateSet[jjnewStateCnt++] = 2; break; case 3: - if (curChar == 34) - jjCheckNAddStates(10, 12); + if (curChar == 39) + jjCheckNAddTwoStates(4, 5); break; case 4: - if ((0xfffffffbfffffbffL & l) != 0L) - jjCheckNAddStates(10, 12); + if ((0xaffffc8300001100L & l) != 0L) + jjCheckNAddTwoStates(4, 5); + break; + case 5: + if (curChar == 39 && kind > 89) + kind = 89; break; case 6: - if ((0xfffffffffffffbffL & l) != 0L) - jjCheckNAddStates(10, 12); + if (curChar == 34) + jjCheckNAddStates(7, 9); break; case 7: - if (curChar == 34 && kind > 89) - kind = 89; + if ((0xfffffffbfffffbffL & l) != 0L) + jjCheckNAddStates(7, 9); break; - case 8: + case 9: + if ((0xfffffffffffffbffL & l) != 0L) + jjCheckNAddStates(7, 9); + break; + case 10: + if (curChar == 34 && kind > 90) + kind = 90; + break; + case 11: if (curChar == 46) - jjCheckNAdd(9); + jjCheckNAdd(12); break; - case 9: + case 12: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 91) - kind = 91; - jjCheckNAddTwoStates(9, 10); + if (kind > 92) + kind = 92; + jjCheckNAddTwoStates(12, 13); break; - case 11: + case 14: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 91) - kind = 91; - jjstateSet[jjnewStateCnt++] = 11; + if (kind > 92) + kind = 92; + jjstateSet[jjnewStateCnt++] = 14; break; - case 12: + case 15: if (curChar == 47) - jjAddStates(8, 9); + jjAddStates(5, 6); break; - case 14: + case 17: if ((0xfffffbffffffffffL & l) != 0L) - jjCheckNAddStates(0, 2); + jjCheckNAddStates(10, 12); break; - case 15: + case 18: if (curChar == 42) - jjstateSet[jjnewStateCnt++] = 16; + jjstateSet[jjnewStateCnt++] = 19; break; - case 16: + case 19: if ((0xffff7fffffffffffL & l) != 0L) - jjCheckNAddStates(0, 2); + jjCheckNAddStates(10, 12); break; - case 17: + case 20: if (curChar == 47 && kind > 2) kind = 2; break; - case 18: + case 21: if (curChar == 42) - jjstateSet[jjnewStateCnt++] = 17; + jjstateSet[jjnewStateCnt++] = 20; break; - case 19: + case 22: if (curChar != 47) break; if (kind > 3) kind = 3; - jjCheckNAdd(20); + jjCheckNAdd(23); break; - case 20: + case 23: if ((0xfffffffffffffbffL & l) == 0L) break; if (kind > 3) kind = 3; - jjCheckNAdd(20); + jjCheckNAdd(23); break; - case 21: + case 24: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 90) - kind = 90; - jjCheckNAddStates(3, 7); + if (kind > 91) + kind = 91; + jjCheckNAddStates(0, 4); break; - case 22: + case 25: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 90) - kind = 90; - jjCheckNAdd(22); + if (kind > 91) + kind = 91; + jjCheckNAdd(25); break; - case 23: + case 26: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(23, 24); + jjCheckNAddTwoStates(26, 27); break; - case 24: + case 27: if (curChar != 46) break; - if (kind > 91) - kind = 91; - jjCheckNAddTwoStates(25, 26); + if (kind > 92) + kind = 92; + jjCheckNAddTwoStates(28, 29); break; - case 25: + case 28: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 91) - kind = 91; - jjCheckNAddTwoStates(25, 26); + if (kind > 92) + kind = 92; + jjCheckNAddTwoStates(28, 29); break; - case 27: + case 30: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 91) - kind = 91; - jjstateSet[jjnewStateCnt++] = 27; + if (kind > 92) + kind = 92; + jjstateSet[jjnewStateCnt++] = 30; break; - case 28: + case 31: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(28, 29); + jjCheckNAddTwoStates(31, 32); break; - case 30: + case 33: if ((0x3ff000000000000L & l) == 0L) break; - if (kind > 91) - kind = 91; - jjstateSet[jjnewStateCnt++] = 30; + if (kind > 92) + kind = 92; + jjstateSet[jjnewStateCnt++] = 33; break; default : break; } @@ -1023,37 +1037,41 @@ private int jjMoveNfa_0(int startState, int curPos) jjCheckNAdd(2); break; case 4: + if ((0x47fffffed7ffffffL & l) != 0L) + jjAddStates(13, 14); + break; + case 7: if ((0xffffffffefffffffL & l) != 0L) - jjCheckNAddStates(10, 12); + jjCheckNAddStates(7, 9); break; - case 5: + case 8: if (curChar == 92) - jjstateSet[jjnewStateCnt++] = 6; + jjstateSet[jjnewStateCnt++] = 9; break; - case 6: - jjCheckNAddStates(10, 12); + case 9: + jjCheckNAddStates(7, 9); break; - case 10: + case 13: if ((0x2000000020L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 11; + jjstateSet[jjnewStateCnt++] = 14; break; - case 14: - case 16: - jjCheckNAddStates(0, 2); + case 17: + case 19: + jjCheckNAddStates(10, 12); break; - case 20: + case 23: if (kind > 3) kind = 3; - jjstateSet[jjnewStateCnt++] = 20; - break; - case 26: - if ((0x2000000020L & l) != 0L) - jjstateSet[jjnewStateCnt++] = 27; + jjstateSet[jjnewStateCnt++] = 23; break; case 29: if ((0x2000000020L & l) != 0L) jjstateSet[jjnewStateCnt++] = 30; break; + case 32: + if ((0x2000000020L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 33; + break; default : break; } } while(i != startsAt); @@ -1066,22 +1084,22 @@ private int jjMoveNfa_0(int startState, int curPos) { switch(jjstateSet[--i]) { - case 4: - case 6: + case 7: + case 9: if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddStates(10, 12); + jjCheckNAddStates(7, 9); break; - case 14: - case 16: + case 17: + case 19: if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddStates(0, 2); + jjCheckNAddStates(10, 12); break; - case 20: + case 23: if ((jjbitVec0[i2] & l2) == 0L) break; if (kind > 3) kind = 3; - jjstateSet[jjnewStateCnt++] = 20; + jjstateSet[jjnewStateCnt++] = 23; break; default : break; } @@ -1094,14 +1112,14 @@ private int jjMoveNfa_0(int startState, int curPos) kind = 0x7fffffff; } ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 31 - (jjnewStateCnt = startsAt))) + if ((i = jjnewStateCnt) == (startsAt = 34 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } } static final int[] jjnextStates = { - 14, 15, 18, 22, 23, 24, 28, 29, 13, 19, 4, 5, 7, + 25, 26, 27, 31, 32, 16, 22, 7, 8, 10, 17, 18, 21, 4, 5, }; /** Token literal values. */ @@ -1126,21 +1144,21 @@ public static final String[] jjstrLiteralImages = { "\145\170\164\145\162\156\141\154", "\154\157\157\160", "\162\145\143\157\162\144", "\50", "\51", "\173", "\175", "\133", "\135", "\56", "\72", "\73", "\54", "\74", "\74\75", "\76", "\76\75", "\75\75", "\74\76", "\53", "\55", "\56\53", "\56\55", "\52", "\57", "\56\52", "\56\57", -"\136", "\56\136", "\75", "\72\75", null, null, null, null, }; +"\136", "\56\136", "\75", "\72\75", null, null, null, null, null, }; /** Lexer state names. */ public static final String[] lexStateNames = { "DEFAULT", }; static final long[] jjtoToken = { - 0xfffffffffffffff1L, 0xfffffffL, + 0xfffffffffffffff1L, 0x1fffffffL, }; static final long[] jjtoSkip = { 0xeL, 0x0L, }; protected SimpleCharStream input_stream; -private final int[] jjrounds = new int[31]; -private final int[] jjstateSet = new int[62]; +private final int[] jjrounds = new int[34]; +private final int[] jjstateSet = new int[68]; private final StringBuilder jjimage = new StringBuilder(); private StringBuilder image = jjimage; private int jjimageLen; @@ -1171,7 +1189,7 @@ private void ReInitRounds() { int i; jjround = 0x80000001; - for (i = 31; i-- > 0;) + for (i = 34; i-- > 0;) jjrounds[i] = 0x80000000; } @@ -1292,7 +1310,7 @@ void TokenLexicalActions(Token matchedToken) { switch(jjmatchedKind) { - case 89 : + case 90 : image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))); matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); break;