From 2a048e11a2c1fbd07286fec175c3c32954912fdb Mon Sep 17 00:00:00 2001 From: miettinen Date: Thu, 26 Sep 2013 08:57:29 +0000 Subject: [PATCH] Sysdyn variable names with space characters allowed, added the corresponding compiled JavaCC result files (refs #2930). git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@27889 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../expressionParser/ExpressionParser.java | 694 ++++++++++++++++-- .../sysdyn/modelParser/ModelParser.java | 11 +- .../simantics/sysdyn/unitParser/UnitParser.jj | 2 +- .../unitParser/UnitParserTokenManager.java | 55 +- 4 files changed, 695 insertions(+), 67 deletions(-) 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 5f51ebba..0c38a0e9 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.ArrayList; import java.util.HashMap; - +@SuppressWarnings({"unused", "serial"}) public class ExpressionParser implements ExpressionParserConstants { public class ForRange { @@ -474,26 +474,58 @@ public class ExpressionParser implements ExpressionParserConstants { } } - final public void name() throws ParseException { + final public Token ident() throws ParseException { + 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(); + fullStr = new String(""); + // Replace whitespace sequence with a single space character. + fullStr += concatToken.image + " " + continuationToken.image; + + Token tempToken = new Token(concatToken.kind, fullStr); + tempToken.beginLine = concatToken.beginLine; + tempToken.beginColumn = concatToken.beginColumn; + tempToken.endLine = token.endLine; + tempToken.endColumn = token.endColumn; + concatToken = tempToken; + System.out.println(concatToken.image); + break; + default: + jj_la1[21] = jj_gen; + ; + } + {if (true) return concatToken;} + throw new Error("Missing return statement in function"); + } + + final public void name() throws ParseException { + Token identToken = null; + identToken = ident(); if (functionCall == null) - functionCall = token.image; + functionCall = identToken.image; else - functionCall += "." + token.image; + functionCall += "." + identToken.image; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 66: jj_consume_token(66); name(); break; default: - jj_la1[21] = jj_gen; + jj_la1[22] = jj_gen; ; } } final public void component_reference(String prevToken) throws ParseException { - jj_consume_token(IDENT); - String name = token.image; + Token identToken = null; + //IDENT [ array_subscripts ] [ "." component_reference ] + identToken = ident(); + String name = identToken.image; // forIndex == true and prevToken != null => this is the second part of an enumeration in for-index if(forIndex == true) { if(prevToken != null) { @@ -501,7 +533,7 @@ public class ExpressionParser implements ExpressionParserConstants { enumerationReferences.put(prevToken, new ArrayList()); } List list = enumerationReferences.get(prevToken); - list.add(token); + list.add(identToken); // forIndex == true and prevToken == null => this is the enumeration in for-index } else { @@ -509,7 +541,7 @@ public class ExpressionParser implements ExpressionParserConstants { enumerationReferences.put(name, new ArrayList()); } List list = enumerationReferences.get(name); - list.add(token); + list.add(identToken); } } else { if(prevToken != null) @@ -518,21 +550,21 @@ public class ExpressionParser implements ExpressionParserConstants { references.put(name, new ArrayList()); } List list = references.get(name); - list.add(token); + list.add(identToken); if(functionCall != null) { if(!functionCallReferences.containsKey(functionCall)) functionCallReferences.put(functionCall, new ArrayList()); List functionReferencelist = getFunctionCallReferences().get(functionCall); - functionReferencelist.add(token); + functionReferencelist.add(identToken); } } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 64: - array_subscripts(); + array_subscripts(identToken); break; default: - jj_la1[22] = jj_gen; + jj_la1[23] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -541,7 +573,7 @@ public class ExpressionParser implements ExpressionParserConstants { component_reference(name); break; default: - jj_la1[23] = jj_gen; + jj_la1[24] = jj_gen; ; } } @@ -568,7 +600,7 @@ public class ExpressionParser implements ExpressionParserConstants { function_arguments(); break; default: - jj_la1[24] = jj_gen; + jj_la1[25] = jj_gen; ; } jj_consume_token(61); @@ -579,7 +611,7 @@ public class ExpressionParser implements ExpressionParserConstants { } final public void function_arguments() throws ParseException { - if (jj_2_2(2)) { + if (jj_2_2(2147483647)) { named_argument(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 69: @@ -587,7 +619,7 @@ public class ExpressionParser implements ExpressionParserConstants { function_arguments(); break; default: - jj_la1[25] = jj_gen; + jj_la1[26] = jj_gen; ; } } else { @@ -622,18 +654,18 @@ public class ExpressionParser implements ExpressionParserConstants { for_indices(); break; default: - jj_la1[26] = jj_gen; + jj_la1[27] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[27] = jj_gen; + jj_la1[28] = jj_gen; ; } break; default: - jj_la1[28] = jj_gen; + jj_la1[29] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -649,7 +681,7 @@ public class ExpressionParser implements ExpressionParserConstants { ; break; default: - jj_la1[29] = jj_gen; + jj_la1[30] = jj_gen; break label_8; } jj_consume_token(69); @@ -658,8 +690,10 @@ public class ExpressionParser implements ExpressionParserConstants { } final public void for_index() throws ParseException { - jj_consume_token(IDENT); - forIndices.put(token, currentRange); + Token identToken = null; + //IDENT [ in expression ] + identToken = ident(); + forIndices.put(identToken, currentRange); forIndex = true; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 41: @@ -672,7 +706,7 @@ public class ExpressionParser implements ExpressionParserConstants { forRanges.add(forRange); break; default: - jj_la1[30] = jj_gen; + jj_la1[31] = jj_gen; ; } forIndex = false; @@ -685,7 +719,7 @@ void named_arguments() : { } */ final public void named_argument() throws ParseException { - jj_consume_token(IDENT); + ident(); jj_consume_token(86); expression(); } @@ -711,7 +745,7 @@ void named_arguments() : { expression(); break; default: - jj_la1[31] = jj_gen; + jj_la1[32] = jj_gen; ; } label_9: @@ -721,7 +755,7 @@ void named_arguments() : { ; break; default: - jj_la1[32] = jj_gen; + jj_la1[33] = jj_gen; break label_9; } jj_consume_token(69); @@ -745,7 +779,7 @@ void named_arguments() : { expression(); break; default: - jj_la1[33] = jj_gen; + jj_la1[34] = jj_gen; ; } } @@ -760,7 +794,7 @@ void named_arguments() : { ; break; default: - jj_la1[34] = jj_gen; + jj_la1[35] = jj_gen; break label_10; } jj_consume_token(69); @@ -768,11 +802,11 @@ void named_arguments() : { } } - final public void array_subscripts() throws ParseException { - if(ranges.get(token.image) == null) { - ranges.put(token.image, new ArrayList>()); + final public void array_subscripts(Token prevToken) throws ParseException { + if(ranges.get(prevToken.image) == null) { + ranges.put(prevToken.image, new ArrayList>()); } - List> rangesList = ranges.get(token.image); + List> rangesList = ranges.get(prevToken.image); currentRange = new ArrayList(); jj_consume_token(64); subscript(currentRange); @@ -783,7 +817,7 @@ void named_arguments() : { ; break; default: - jj_la1[35] = jj_gen; + jj_la1[36] = jj_gen; break label_11; } jj_consume_token(69); @@ -803,7 +837,7 @@ void named_arguments() : { currentRange.add(token); break; default: - jj_la1[37] = jj_gen; + jj_la1[38] = jj_gen; if (jj_2_3(2147483647)) { functionCall = null; name(); @@ -824,7 +858,7 @@ void named_arguments() : { rangeIndex(rangeToken, false); break; default: - jj_la1[36] = jj_gen; + jj_la1[37] = jj_gen; ; } rangeToken.endColumn = token.endColumn; @@ -832,7 +866,7 @@ void named_arguments() : { currentRange.add(rangeToken); break; default: - jj_la1[38] = jj_gen; + jj_la1[39] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -841,6 +875,7 @@ void named_arguments() : { } final public void rangeIndex(Token rangeToken, boolean first) throws ParseException { + Token identToken = null; if(!first) rangeToken.image = rangeToken.image + ":"; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -849,11 +884,11 @@ void named_arguments() : { rangeToken.image = rangeToken.image + token.image; break; case IDENT: - jj_consume_token(IDENT); - rangeToken.image = rangeToken.image + token.image; + identToken = ident(); + rangeToken.image = rangeToken.image + identToken; break; default: - jj_la1[39] = jj_gen; + jj_la1[40] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -881,8 +916,227 @@ void named_arguments() : { } private boolean jj_3R_13() { - if (jj_scan_token(IDENT)) return true; + 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; + 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; + while (true) { + xsp = jj_scanpos; + if (jj_3R_34()) { jj_scanpos = xsp; break; } + } + 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; + return false; + } + + private boolean jj_3R_35() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(70)) { + jj_scanpos = xsp; + if (jj_scan_token(71)) { + jj_scanpos = xsp; + if (jj_scan_token(72)) { + jj_scanpos = xsp; + if (jj_scan_token(73)) { + jj_scanpos = xsp; + if (jj_scan_token(74)) { + jj_scanpos = xsp; + if (jj_scan_token(75)) return true; + } + } + } + } + } + return false; + } + + private boolean jj_3R_23() { + 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; + return false; + } + + private boolean jj_3R_25() { + if (jj_scan_token(22)) 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; + 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; + return false; + } + + private boolean jj_3R_77() { + if (jj_scan_token(41)) return true; + if (jj_3R_16()) return true; + return false; + } + + private boolean jj_3R_27() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(12)) jj_scanpos = xsp; + if (jj_3R_29()) return true; + return false; + } + + private boolean jj_3R_12() { + if (jj_3R_14()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_15()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_24() { + if (jj_3R_27()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_28()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_74() { + if (jj_scan_token(69)) return true; + if (jj_3R_73()) return true; + return false; + } + + private boolean jj_3R_65() { + if (jj_scan_token(69)) return true; + if (jj_3R_53()) return true; + return false; + } + + private boolean jj_3R_62() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_65()) { + jj_scanpos = xsp; + if (jj_3R_66()) return true; + } + return false; + } + + private boolean jj_3R_56() { + if (jj_scan_token(66)) return true; + if (jj_3R_50()) return true; + return false; + } + + private boolean jj_3R_22() { + if (jj_3R_24()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_25()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_76() { + if (jj_3R_14()) return true; + return false; + } + + private boolean jj_3R_73() { + if (jj_3R_14()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_77()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_20() { + if (jj_3R_22()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_23()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_75() { + if (jj_scan_token(UNSIGNED_INTEGER)) return true; + return false; + } + + private boolean jj_3R_71() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_75()) { + jj_scanpos = xsp; + if (jj_3R_76()) return true; + } return false; } @@ -891,29 +1145,353 @@ void named_arguments() : { return false; } - private boolean jj_3_1() { + private boolean jj_3R_52() { + if (jj_scan_token(68)) return true; + if (jj_3R_51()) 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; + 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; + return false; + } + + private boolean jj_3R_70() { + if (jj_3R_73()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_74()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_18() { + if (jj_3R_20()) return true; + return false; + } + + private boolean jj_3R_16() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_18()) { + jj_scanpos = xsp; + if (jj_3R_19()) return true; + } + return false; + } + + private boolean jj_3R_59() { + if (jj_3R_16()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_62()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_64() { + if (jj_scan_token(69)) return true; + if (jj_3R_63()) return true; + return false; + } + + private boolean jj_3_3() { if (jj_3R_12()) return true; if (jj_scan_token(60)) return true; return false; } - private boolean jj_3R_12() { + private boolean jj_3R_69() { + if (jj_3R_71()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_72()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_58() { + if (jj_3R_13()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_61()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_53() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_58()) { + jj_scanpos = xsp; + if (jj_3R_59()) return true; + } + return false; + } + + private boolean jj_3R_17() { + if (jj_3R_14()) return true; + return false; + } + + private boolean jj_3R_54() { + if (jj_3R_53()) return true; + return false; + } + + private boolean jj_3R_14() { if (jj_scan_token(IDENT)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_14()) jj_scanpos = xsp; + if (jj_3R_17()) jj_scanpos = xsp; return false; } - private boolean jj_3_3() { + private boolean jj_3R_68() { if (jj_3R_12()) return true; + if (jj_3R_49()) return true; + return false; + } + + private boolean jj_3R_48() { + if (jj_scan_token(85)) return true; + if (jj_3R_39()) return true; + return false; + } + + private boolean jj_3R_49() { if (jj_scan_token(60)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_54()) jj_scanpos = xsp; + if (jj_scan_token(61)) return true; return false; } - private boolean jj_3R_14() { - if (jj_scan_token(66)) return true; + private boolean jj_3_1() { + if (jj_3R_12()) return true; + if (jj_scan_token(60)) return true; + return false; + } + + private boolean jj_3R_46() { + if (jj_scan_token(62)) return true; + if (jj_3R_53()) return true; + if (jj_scan_token(63)) return true; + return false; + } + + private boolean jj_3R_45() { + if (jj_scan_token(64)) return true; + if (jj_3R_51()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_52()) { jj_scanpos = xsp; break; } + } + if (jj_scan_token(65)) return true; + return false; + } + + private boolean jj_3R_55() { + if (jj_3R_60()) return true; + return false; + } + + private boolean jj_3R_44() { + 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_67() { + if (jj_scan_token(67)) return true; + return false; + } + + private boolean jj_3R_63() { + 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; + } + } + return false; + } + + private boolean jj_3R_43() { + if (jj_3R_50()) return true; + return false; + } + + private boolean jj_3R_42() { if (jj_3R_12()) return true; + if (jj_3R_49()) return true; + return false; + } + + private boolean jj_3R_47() { + if (jj_scan_token(84)) return true; + if (jj_3R_39()) return true; + return false; + } + + private boolean jj_3R_40() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_47()) { + jj_scanpos = xsp; + if (jj_3R_48()) return true; + } + 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_39() { + Token xsp; + xsp = jj_scanpos; + 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_scan_token(35)) 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; + return false; + } + + private boolean jj_3R_26() { + if (jj_scan_token(67)) return true; + if (jj_3R_22()) return true; + return false; + } + + private boolean jj_3R_38() { + if (jj_3R_41()) return true; + if (jj_3R_37()) return true; + return false; + } + + private boolean jj_3R_31() { + 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() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(80)) { + jj_scanpos = xsp; + if (jj_scan_token(81)) { + jj_scanpos = xsp; + if (jj_scan_token(82)) { + jj_scanpos = xsp; + if (jj_scan_token(83)) return true; + } + } + } + return false; + } + + private boolean jj_3R_37() { + if (jj_3R_39()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_40()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_51() { + if (jj_3R_16()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_57()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_21() { + if (jj_scan_token(20)) return true; + if (jj_3R_16()) return true; + if (jj_scan_token(28)) return true; + if (jj_3R_16()) return true; + return false; + } + + private boolean jj_3R_33() { + if (jj_3R_37()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_38()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_61() { + if (jj_scan_token(69)) return true; + if (jj_3R_53()) return true; return false; } @@ -928,7 +1506,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[40]; + final private int[] jj_la1 = new int[41]; static private int[] jj_la1_0; static private int[] jj_la1_1; static private int[] jj_la1_2; @@ -938,13 +1516,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,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,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,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,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,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,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,}; } final private JJCalls[] jj_2_rtns = new JJCalls[3]; private boolean jj_rescan = false; @@ -961,7 +1539,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 40; i++) jj_la1[i] = -1; + for (int i = 0; i < 41; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -976,7 +1554,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 40; i++) jj_la1[i] = -1; + for (int i = 0; i < 41; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -987,7 +1565,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 40; i++) jj_la1[i] = -1; + for (int i = 0; i < 41; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -998,7 +1576,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 40; i++) jj_la1[i] = -1; + for (int i = 0; i < 41; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1008,7 +1586,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 40; i++) jj_la1[i] = -1; + for (int i = 0; i < 41; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1018,7 +1596,7 @@ void named_arguments() : { token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 40; i++) jj_la1[i] = -1; + for (int i = 0; i < 41; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -1135,7 +1713,7 @@ void named_arguments() : { la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 40; i++) { + for (int i = 0; i < 41; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1< inputs = new ArrayList(); @@ -2683,11 +2684,6 @@ public class ModelParser implements ModelParserConstants { finally { jj_save(9, xla); } } - private boolean jj_3R_52() { - if (jj_3R_69()) return true; - return false; - } - private boolean jj_3R_51() { if (jj_scan_token(59)) return true; return false; @@ -3578,6 +3574,11 @@ public class ModelParser implements ModelParserConstants { return false; } + private boolean jj_3R_52() { + if (jj_3R_69()) return true; + return false; + } + /** Generated Token Manager. */ public ModelParserTokenManager token_source; SimpleCharStream jj_input_stream; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParser.jj b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParser.jj index 789c7474..d0dc7828 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParser.jj +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParser.jj @@ -48,7 +48,7 @@ TOKEN: | "*" | "/" | ".*" | "./" | "^" | ".^" | "=" | ":=" -| +| | { matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); } | diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserTokenManager.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserTokenManager.java index c4473fa3..bc5fb62c 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserTokenManager.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/unitParser/UnitParserTokenManager.java @@ -820,6 +820,12 @@ private int jjStartNfaWithStates_0(int pos, int kind, int state) return jjMoveNfa_0(state, pos + 1); } static final long[] jjbitVec0 = { + 0x0L, 0x0L, 0x100000000000L, 0x0L +}; +static final long[] jjbitVec1 = { + 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +static final long[] jjbitVec3 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; private int jjMoveNfa_0(int startState, int curPos) @@ -1055,24 +1061,35 @@ private int jjMoveNfa_0(int startState, int curPos) } else { + int hiByte = (int)(curChar >> 8); + int i1 = hiByte >> 6; + long l1 = 1L << (hiByte & 077); int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); do { switch(jjstateSet[--i]) { + case 0: + case 2: + if (!jjCanMove_0(hiByte, i1, i2, l1, l2)) + break; + if (kind > 88) + kind = 88; + jjCheckNAdd(2); + break; case 4: case 6: - if ((jjbitVec0[i2] & l2) != 0L) + if (jjCanMove_1(hiByte, i1, i2, l1, l2)) jjCheckNAddStates(10, 12); break; case 14: case 16: - if ((jjbitVec0[i2] & l2) != 0L) + if (jjCanMove_2(hiByte, i1, i2, l1, l2)) jjCheckNAddStates(0, 2); break; case 20: - if ((jjbitVec0[i2] & l2) == 0L) + if (!jjCanMove_2(hiByte, i1, i2, l1, l2)) break; if (kind > 3) kind = 3; @@ -1098,6 +1115,38 @@ private int jjMoveNfa_0(int startState, int curPos) static final int[] jjnextStates = { 14, 15, 18, 22, 23, 24, 28, 29, 13, 19, 4, 5, 7, }; +private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 32: + return ((jjbitVec0[i2] & l2) != 0L); + default : + return false; + } +} +private static final boolean jjCanMove_1(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec3[i2] & l2) != 0L); + default : + if ((jjbitVec1[i1] & l1) != 0L) + return true; + return false; + } +} +private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2) +{ + switch(hiByte) + { + case 0: + return ((jjbitVec3[i2] & l2) != 0L); + default : + return false; + } +} /** Token literal values. */ public static final String[] jjstrLiteralImages = { -- 2.47.1