From 015360483a503a6583fe7519234beab229b22def Mon Sep 17 00:00:00 2001 From: lempinen Date: Tue, 3 May 2011 13:32:17 +0000 Subject: [PATCH] Complete Modelica model parser (for function editing) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@20747 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../sysdyn/modelParser/ModelParser.java | 3728 +++++++++++++++++ .../modelParser/ModelParserConstants.java | 131 + .../modelParser/ModelParserTokenManager.java | 1434 +++++++ .../sysdyn/modelParser/ModelicaParser.jj | 634 +++ .../sysdyn/modelParser/ParseException.java | 187 + .../sysdyn/modelParser/SimpleCharStream.java | 471 +++ .../simantics/sysdyn/modelParser/Token.java | 131 + .../sysdyn/modelParser/TokenMgrError.java | 147 + 8 files changed, 6863 insertions(+) create mode 100644 org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParser.java create mode 100644 org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParserConstants.java create mode 100644 org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParserTokenManager.java create mode 100644 org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelicaParser.jj create mode 100644 org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ParseException.java create mode 100644 org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/SimpleCharStream.java create mode 100644 org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/Token.java create mode 100644 org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/TokenMgrError.java diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParser.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParser.java new file mode 100644 index 00000000..b069dc03 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParser.java @@ -0,0 +1,3728 @@ +/* Generated By:JavaCC: Do not edit this line. ModelParser.java */ +package org.simantics.sysdyn.modelParser; + +public class ModelParser implements ModelParserConstants { + +/*** Parser ********************************************************/ + +// https://javacc.dev.java.net/doc/javaccgrm.html +// add_op -> add_op() +// [ add_op ] -> ( add_op() )? +// { add_op term } -> ( add_op() term() )* + final public void parse() throws ParseException { + stored_definition(); + jj_consume_token(0); + } + +/*** Stored Definition - Within ************************************/ + final public void stored_definition() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 53: + jj_consume_token(53); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + name(); + break; + default: + jj_la1[0] = jj_gen; + ; + } + jj_consume_token(70); + break; + default: + jj_la1[1] = jj_gen; + ; + } + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 7: + case 11: + case 17: + case 24: + case 26: + case 30: + case 34: + case 37: + case 38: + case 44: + case 47: + case 50: + case 61: + case 94: + case 95: + ; + break; + default: + jj_la1[2] = jj_gen; + break label_1; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 11: + jj_consume_token(11); + break; + default: + jj_la1[3] = jj_gen; + ; + } + class_definition(); + jj_consume_token(70); + } + } + +/*** Class Definition **********************************************/ + final public void class_definition() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 30: + jj_consume_token(30); + break; + default: + jj_la1[4] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 47: + jj_consume_token(47); + break; + default: + jj_la1[5] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 34: + jj_consume_token(34); + break; + case 7: + jj_consume_token(7); + break; + case 61: + jj_consume_token(61); + break; + case 24: + jj_consume_token(24); + break; + case 44: + case 50: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 50: + jj_consume_token(50); + break; + default: + jj_la1[6] = jj_gen; + ; + } + jj_consume_token(44); + break; + case 38: + jj_consume_token(38); + break; + case 37: + jj_consume_token(37); + break; + case 26: + jj_consume_token(26); + break; + case 17: + jj_consume_token(17); + break; + case 94: + jj_consume_token(94); + break; + case 95: + jj_consume_token(95); + break; + default: + jj_la1[7] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + class_specifier(); + } + + final public void class_specifier() throws ParseException { + if (jj_2_1(2)) { + jj_consume_token(IDENT); + string_comment(); + composition(); + jj_consume_token(35); + jj_consume_token(IDENT); + } else if (jj_2_2(2)) { + jj_consume_token(IDENT); + jj_consume_token(88); + base_prefix(); + name(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 66: + array_subscripts(); + break; + default: + jj_la1[8] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + class_modification(); + break; + default: + jj_la1[9] = jj_gen; + ; + } + comment(); + } else if (jj_2_3(3)) { + jj_consume_token(IDENT); + jj_consume_token(88); + jj_consume_token(40); + jj_consume_token(62); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENT: + enum_list(); + break; + default: + jj_la1[10] = jj_gen; + ; + } + jj_consume_token(63); + comment(); + } else if (jj_2_4(3)) { + jj_consume_token(IDENT); + jj_consume_token(88); + jj_consume_token(58); + jj_consume_token(62); + name(); + jj_consume_token(71); + jj_consume_token(IDENT); + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[11] = jj_gen; + break label_2; + } + jj_consume_token(71); + jj_consume_token(IDENT); + } + jj_consume_token(63); + comment(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 55: + jj_consume_token(55); + jj_consume_token(IDENT); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + class_modification(); + break; + default: + jj_la1[12] = jj_gen; + ; + } + string_comment(); + composition(); + jj_consume_token(35); + jj_consume_token(IDENT); + break; + default: + jj_la1[13] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + + final public void base_prefix() throws ParseException { + type_prefix(); + } + + final public void enum_list() throws ParseException { + enumeration_literal(); + label_3: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[14] = jj_gen; + break label_3; + } + jj_consume_token(71); + enumeration_literal(); + } + } + + final public void enumeration_literal() throws ParseException { + jj_consume_token(IDENT); + comment(); + } + + final public void parse_composition() throws ParseException { + composition(); + jj_consume_token(0); + } + + final public void composition() throws ParseException { + element_list(); + label_4: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 4: + case 45: + case 46: + case 52: + case 57: + ; + break; + default: + jj_la1[15] = jj_gen; + break label_4; + } + if (jj_2_5(2)) { + jj_consume_token(57); + element_list(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 52: + jj_consume_token(52); + element_list(); + break; + case 45: + case 46: + equation_section(); + break; + case 4: + algorithm_section(); + break; + default: + jj_la1[16] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 59: + jj_consume_token(59); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING: + language_specification(); + break; + default: + jj_la1[17] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + external_function_call(); + break; + default: + jj_la1[18] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 14: + annotation(); + break; + default: + jj_la1[19] = jj_gen; + ; + } + jj_consume_token(70); + break; + default: + jj_la1[20] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 14: + annotation(); + jj_consume_token(70); + break; + default: + jj_la1[21] = jj_gen; + ; + } + } + + final public void language_specification() throws ParseException { + jj_consume_token(STRING); + } + + final public void external_function_call() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + component_reference(); + jj_consume_token(88); + break; + default: + jj_la1[22] = jj_gen; + ; + } + jj_consume_token(IDENT); + jj_consume_token(62); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 31: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + expression_list(); + break; + default: + jj_la1[23] = jj_gen; + ; + } + jj_consume_token(63); + } + + final public void element_list() throws ParseException { + label_5: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 7: + case 8: + case 11: + case 13: + case 16: + case 17: + case 23: + case 24: + case 26: + case 27: + case 30: + case 32: + case 34: + case 36: + case 37: + case 38: + case 42: + case 44: + case 47: + case 49: + case 50: + case 51: + case 55: + case 56: + case 61: + case 68: + case IDENT: + case 94: + case 95: + ; + break; + default: + jj_la1[24] = jj_gen; + break label_5; + } + element(); + jj_consume_token(70); + } + } + + final public void element() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 36: + import_clause(); + break; + case 55: + extends_clause(); + break; + case 5: + case 7: + case 8: + case 11: + case 13: + case 16: + case 17: + case 23: + case 24: + case 26: + case 27: + case 30: + case 32: + case 34: + case 37: + case 38: + case 42: + case 44: + case 47: + case 49: + case 50: + case 51: + case 56: + case 61: + case 68: + case IDENT: + case 94: + case 95: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 8: + jj_consume_token(8); + break; + default: + jj_la1[25] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 11: + jj_consume_token(11); + break; + default: + jj_la1[26] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 51: + jj_consume_token(51); + break; + default: + jj_la1[27] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 27: + jj_consume_token(27); + break; + default: + jj_la1[28] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 7: + case 16: + case 17: + case 23: + case 24: + case 26: + case 30: + case 32: + case 34: + case 37: + case 38: + case 42: + case 44: + case 47: + case 49: + case 50: + case 56: + case 61: + case 68: + case IDENT: + case 94: + case 95: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 7: + case 17: + case 24: + case 26: + case 30: + case 34: + case 37: + case 38: + case 44: + case 47: + case 50: + case 61: + case 94: + case 95: + class_definition(); + break; + case 5: + case 16: + case 23: + case 32: + case 42: + case 49: + case 56: + case 68: + case IDENT: + component_clause(); + break; + default: + jj_la1[29] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + case 13: + jj_consume_token(13); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 7: + case 17: + case 24: + case 26: + case 30: + case 34: + case 37: + case 38: + case 44: + case 47: + case 50: + case 61: + case 94: + case 95: + class_definition(); + break; + case 5: + case 16: + case 23: + case 32: + case 42: + case 49: + case 56: + case 68: + case IDENT: + component_clause(); + break; + default: + jj_la1[30] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 54: + constraining_clause(); + comment(); + break; + default: + jj_la1[31] = jj_gen; + ; + } + break; + default: + jj_la1[32] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[33] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void import_clause() throws ParseException { + jj_consume_token(36); + if (jj_2_6(2)) { + jj_consume_token(IDENT); + jj_consume_token(88); + name(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + name(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + jj_consume_token(68); + jj_consume_token(82); + break; + default: + jj_la1[34] = jj_gen; + ; + } + break; + default: + jj_la1[35] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + comment(); + } + +/*** Extends *******************************************************/ + final public void extends_clause() throws ParseException { + jj_consume_token(55); + name(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + class_modification(); + break; + default: + jj_la1[36] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 14: + annotation(); + break; + default: + jj_la1[37] = jj_gen; + ; + } + } + + final public void constraining_clause() throws ParseException { + jj_consume_token(54); + name(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + class_modification(); + break; + default: + jj_la1[38] = jj_gen; + ; + } + } + +/*** Component Clause **********************************************/ + final public void component_clause() throws ParseException { + type_prefix(); + type_specifier(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 66: + array_subscripts(); + break; + default: + jj_la1[39] = jj_gen; + ; + } + component_list(); + } + + final public void type_prefix() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 16: + case 23: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 16: + jj_consume_token(16); + break; + case 23: + jj_consume_token(23); + break; + default: + jj_la1[40] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[41] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 42: + case 49: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + jj_consume_token(5); + break; + case 42: + jj_consume_token(42); + break; + case 49: + jj_consume_token(49); + break; + default: + jj_la1[42] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[43] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 32: + case 56: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 56: + jj_consume_token(56); + break; + case 32: + jj_consume_token(32); + break; + default: + jj_la1[44] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[45] = jj_gen; + ; + } + } + + final public void type_specifier() throws ParseException { + name(); + } + + final public void component_list() throws ParseException { + component_declaration(); + label_6: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[46] = jj_gen; + break label_6; + } + jj_consume_token(71); + component_declaration(); + } + } + + final public void component_declaration() throws ParseException { + declaration(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 31: + conditional_attribute(); + break; + default: + jj_la1[47] = jj_gen; + ; + } + comment(); + } + + final public void conditional_attribute() throws ParseException { + jj_consume_token(31); + expression(); + } + + final public void declaration() throws ParseException { + jj_consume_token(IDENT); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 66: + array_subscripts(); + break; + default: + jj_la1[48] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + case 88: + case 89: + modification(); + break; + default: + jj_la1[49] = jj_gen; + ; + } + } + +/*** Modification **********************************************/ + final public void modification() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + class_modification(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 88: + jj_consume_token(88); + expression(); + break; + default: + jj_la1[50] = jj_gen; + ; + } + break; + case 88: + jj_consume_token(88); + expression(); + break; + case 89: + jj_consume_token(89); + expression(); + break; + default: + jj_la1[51] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void class_modification() throws ParseException { + jj_consume_token(62); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 8: + case 10: + case 11: + case 13: + case 68: + case IDENT: + argument_list(); + break; + default: + jj_la1[52] = jj_gen; + ; + } + jj_consume_token(63); + } + + final public void argument_list() throws ParseException { + argument(); + label_7: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[53] = jj_gen; + break label_7; + } + jj_consume_token(71); + argument(); + } + } + + final public void argument() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 10: + case 11: + case 13: + case 68: + case IDENT: + element_modification_or_replaceable(); + break; + case 8: + element_redeclaration(); + break; + default: + jj_la1[54] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void element_modification_or_replaceable() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 10: + jj_consume_token(10); + break; + default: + jj_la1[55] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 11: + jj_consume_token(11); + break; + default: + jj_la1[56] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + element_modification(); + break; + case 13: + element_replaceable(); + break; + default: + jj_la1[57] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void element_modification() throws ParseException { + name(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + case 88: + case 89: + modification(); + break; + default: + jj_la1[58] = jj_gen; + ; + } + string_comment(); + } + + final public void element_redeclaration() throws ParseException { + jj_consume_token(8); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 10: + jj_consume_token(10); + break; + default: + jj_la1[59] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 11: + jj_consume_token(11); + break; + default: + jj_la1[60] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 7: + case 16: + case 17: + case 23: + case 24: + case 26: + case 30: + case 32: + case 34: + case 37: + case 38: + case 42: + case 44: + case 47: + case 49: + case 50: + case 56: + case 61: + case 68: + case IDENT: + case 94: + case 95: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 7: + case 17: + case 24: + case 26: + case 30: + case 34: + case 37: + case 38: + case 44: + case 47: + case 50: + case 61: + case 94: + case 95: + class_definition(); + break; + case 5: + case 16: + case 23: + case 32: + case 42: + case 49: + case 56: + case 68: + case IDENT: + component_clause1(); + break; + default: + jj_la1[61] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + case 13: + element_replaceable(); + break; + default: + jj_la1[62] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void element_replaceable() throws ParseException { + jj_consume_token(13); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 7: + case 17: + case 24: + case 26: + case 30: + case 34: + case 37: + case 38: + case 44: + case 47: + case 50: + case 61: + case 94: + case 95: + class_definition(); + break; + case 5: + case 16: + case 23: + case 32: + case 42: + case 49: + case 56: + case 68: + case IDENT: + component_clause1(); + break; + default: + jj_la1[63] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 54: + constraining_clause(); + break; + default: + jj_la1[64] = jj_gen; + ; + } + } + + final public void component_clause1() throws ParseException { + type_prefix(); + type_specifier(); + component_declaration1(); + } + + final public void component_declaration1() throws ParseException { + declaration(); + comment(); + } + +/*** Equations *************************************************/ + final public void equation_section() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 46: + jj_consume_token(46); + break; + default: + jj_la1[65] = jj_gen; + ; + } + jj_consume_token(45); + label_8: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 21: + case 31: + case 33: + case 35: + case 39: + case 43: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + ; + break; + default: + jj_la1[66] = jj_gen; + break label_8; + } + equation(); + jj_consume_token(70); + } + } + + final public void algorithm_section() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 46: + jj_consume_token(46); + break; + default: + jj_la1[67] = jj_gen; + ; + } + jj_consume_token(4); + label_9: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[68] = jj_gen; + break label_9; + } + statement(); + jj_consume_token(70); + } + } + + final public void equation() throws ParseException { + if (jj_2_7(3)) { + simple_expression(); + jj_consume_token(88); + expression(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 31: + if_equation(); + break; + case 21: + for_equation(); + break; + case 39: + connect_clause(); + break; + case 43: + when_equation(); + break; + case IDENT: + jj_consume_token(IDENT); + function_call_args(); + break; + default: + jj_la1[69] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + comment(); + } + + final public void statement() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + component_reference(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 89: + jj_consume_token(89); + expression(); + break; + case 62: + function_call_args(); + break; + default: + jj_la1[70] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + case 62: + jj_consume_token(62); + output_expression_list(); + jj_consume_token(63); + jj_consume_token(89); + component_reference(); + function_call_args(); + break; + case 29: + jj_consume_token(29); + break; + case 18: + jj_consume_token(18); + break; + case 31: + if_statement(); + break; + case 21: + for_statement(); + break; + case 48: + while_statement(); + break; + case 43: + when_statement(); + break; + default: + jj_la1[71] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + comment(); + } + + final public void if_equation() throws ParseException { + jj_consume_token(31); + expression(); + jj_consume_token(28); + label_10: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 21: + case 31: + case 33: + case 35: + case 39: + case 43: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + ; + break; + default: + jj_la1[72] = jj_gen; + break label_10; + } + equation(); + jj_consume_token(70); + } + label_11: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + ; + break; + default: + jj_la1[73] = jj_gen; + break label_11; + } + jj_consume_token(20); + expression(); + jj_consume_token(28); + label_12: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 21: + case 31: + case 33: + case 35: + case 39: + case 43: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + ; + break; + default: + jj_la1[74] = jj_gen; + break label_12; + } + equation(); + jj_consume_token(70); + } + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 15: + jj_consume_token(15); + label_13: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 21: + case 31: + case 33: + case 35: + case 39: + case 43: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + ; + break; + default: + jj_la1[75] = jj_gen; + break label_13; + } + equation(); + jj_consume_token(70); + } + break; + default: + jj_la1[76] = jj_gen; + ; + } + jj_consume_token(35); + jj_consume_token(31); + } + + final public void if_statement() throws ParseException { + jj_consume_token(31); + expression(); + jj_consume_token(28); + label_14: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[77] = jj_gen; + break label_14; + } + statement(); + jj_consume_token(70); + } + label_15: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + ; + break; + default: + jj_la1[78] = jj_gen; + break label_15; + } + jj_consume_token(20); + expression(); + jj_consume_token(28); + label_16: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[79] = jj_gen; + break label_16; + } + statement(); + jj_consume_token(70); + } + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 15: + jj_consume_token(15); + label_17: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[80] = jj_gen; + break label_17; + } + statement(); + jj_consume_token(70); + } + break; + default: + jj_la1[81] = jj_gen; + ; + } + jj_consume_token(35); + jj_consume_token(31); + } + + final public void for_equation() throws ParseException { + jj_consume_token(21); + for_indices(); + jj_consume_token(60); + label_18: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 21: + case 31: + case 33: + case 35: + case 39: + case 43: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + ; + break; + default: + jj_la1[82] = jj_gen; + break label_18; + } + equation(); + jj_consume_token(70); + } + jj_consume_token(35); + jj_consume_token(21); + } + + final public void for_statement() throws ParseException { + jj_consume_token(21); + for_indices(); + jj_consume_token(60); + label_19: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[83] = jj_gen; + break label_19; + } + statement(); + jj_consume_token(70); + } + jj_consume_token(35); + jj_consume_token(21); + } + + final public void for_indices() throws ParseException { + for_index(); + label_20: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[84] = jj_gen; + break label_20; + } + jj_consume_token(71); + for_index(); + } + } + + final public void for_index() throws ParseException { + jj_consume_token(IDENT); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 41: + jj_consume_token(41); + expression(); + break; + default: + jj_la1[85] = jj_gen; + ; + } + } + + final public void while_statement() throws ParseException { + jj_consume_token(48); + expression(); + jj_consume_token(60); + label_21: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[86] = jj_gen; + break label_21; + } + statement(); + jj_consume_token(70); + } + jj_consume_token(35); + jj_consume_token(48); + } + + final public void when_equation() throws ParseException { + jj_consume_token(43); + expression(); + jj_consume_token(28); + label_22: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 21: + case 31: + case 33: + case 35: + case 39: + case 43: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + ; + break; + default: + jj_la1[87] = jj_gen; + break label_22; + } + equation(); + jj_consume_token(70); + } + label_23: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 25: + ; + break; + default: + jj_la1[88] = jj_gen; + break label_23; + } + jj_consume_token(25); + expression(); + jj_consume_token(28); + label_24: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 21: + case 31: + case 33: + case 35: + case 39: + case 43: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + ; + break; + default: + jj_la1[89] = jj_gen; + break label_24; + } + equation(); + jj_consume_token(70); + } + } + jj_consume_token(35); + jj_consume_token(43); + } + + final public void when_statement() throws ParseException { + jj_consume_token(43); + expression(); + jj_consume_token(28); + label_25: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[90] = jj_gen; + break label_25; + } + statement(); + jj_consume_token(70); + } + label_26: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 25: + ; + break; + default: + jj_la1[91] = jj_gen; + break label_26; + } + jj_consume_token(25); + expression(); + jj_consume_token(28); + label_27: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[92] = jj_gen; + break label_27; + } + statement(); + jj_consume_token(70); + } + } + jj_consume_token(35); + jj_consume_token(43); + } + + final public void connect_clause() throws ParseException { + jj_consume_token(39); + jj_consume_token(62); + component_reference(); + jj_consume_token(71); + component_reference(); + jj_consume_token(63); + } + +/*** Expressions ***************************************************/ + final public void expr() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + simple_expression(); + jj_consume_token(0); + break; + case 31: + jj_consume_token(31); + expression(); + jj_consume_token(28); + expression(); + label_28: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + ; + break; + default: + jj_la1[93] = jj_gen; + break label_28; + } + jj_consume_token(20); + expression(); + jj_consume_token(28); + expression(); + } + jj_consume_token(15); + expression(); + jj_consume_token(0); + break; + default: + jj_la1[94] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void expression() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + simple_expression(); + break; + case 31: + jj_consume_token(31); + expression(); + jj_consume_token(28); + expression(); + label_29: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + ; + break; + default: + jj_la1[95] = jj_gen; + break label_29; + } + jj_consume_token(20); + expression(); + jj_consume_token(28); + expression(); + } + jj_consume_token(15); + expression(); + break; + default: + jj_la1[96] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void simple_expression() throws ParseException { + logical_expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 69: + jj_consume_token(69); + logical_expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 69: + jj_consume_token(69); + logical_expression(); + break; + default: + jj_la1[97] = jj_gen; + ; + } + break; + default: + jj_la1[98] = jj_gen; + ; + } + } + + final public void logical_expression() throws ParseException { + logical_term(); + label_30: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 22: + ; + break; + default: + jj_la1[99] = jj_gen; + break label_30; + } + jj_consume_token(22); + logical_term(); + } + } + + final public void logical_term() throws ParseException { + logical_factor(); + label_31: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 9: + ; + break; + default: + jj_la1[100] = jj_gen; + break label_31; + } + jj_consume_token(9); + logical_factor(); + } + } + + final public void logical_factor() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 12: + jj_consume_token(12); + break; + default: + jj_la1[101] = jj_gen; + ; + } + relation(); + } + + final public void relation() throws ParseException { + arithmetic_expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 72: + case 73: + case 74: + case 75: + case 76: + case 77: + rel_op(); + arithmetic_expression(); + break; + default: + jj_la1[102] = jj_gen; + ; + } + } + + final public void rel_op() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 72: + jj_consume_token(72); + break; + case 73: + jj_consume_token(73); + break; + case 74: + jj_consume_token(74); + break; + case 75: + jj_consume_token(75); + break; + case 76: + jj_consume_token(76); + break; + case 77: + jj_consume_token(77); + break; + default: + jj_la1[103] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void arithmetic_expression() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 78: + case 79: + case 80: + case 81: + add_op(); + break; + default: + jj_la1[104] = jj_gen; + ; + } + term(); + label_32: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 78: + case 79: + case 80: + case 81: + ; + break; + default: + jj_la1[105] = jj_gen; + break label_32; + } + add_op(); + term(); + } + } + + final public void add_op() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 78: + jj_consume_token(78); + break; + case 79: + jj_consume_token(79); + break; + case 80: + jj_consume_token(80); + break; + case 81: + jj_consume_token(81); + break; + default: + jj_la1[106] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void term() throws ParseException { + factor(); + label_33: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 82: + case 83: + case 84: + case 85: + ; + break; + default: + jj_la1[107] = jj_gen; + break label_33; + } + mul_op(); + factor(); + } + } + + final public void mul_op() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 82: + jj_consume_token(82); + break; + case 83: + jj_consume_token(83); + break; + case 84: + jj_consume_token(84); + break; + case 85: + jj_consume_token(85); + break; + default: + jj_la1[108] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void factor() throws ParseException { + primary(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 86: + case 87: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 86: + jj_consume_token(86); + break; + case 87: + jj_consume_token(87); + primary(); + break; + default: + jj_la1[109] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[110] = jj_gen; + ; + } + } + + final public void primary() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case UNSIGNED_NUMBER: + jj_consume_token(UNSIGNED_NUMBER); + break; + case UNSIGNED_INTEGER: + jj_consume_token(UNSIGNED_INTEGER); + break; + case STRING: + jj_consume_token(STRING); + break; + case 6: + jj_consume_token(6); + break; + case 33: + jj_consume_token(33); + break; + default: + jj_la1[113] = jj_gen; + if (jj_2_8(2147483647)) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + name(); + break; + case 58: + jj_consume_token(58); + break; + case 46: + jj_consume_token(46); + break; + default: + jj_la1[111] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + function_call_args(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + component_reference(); + break; + case 62: + jj_consume_token(62); + output_expression_list(); + jj_consume_token(63); + break; + case 66: + jj_consume_token(66); + expression_list(); + label_34: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 70: + ; + break; + default: + jj_la1[112] = jj_gen; + break label_34; + } + jj_consume_token(70); + expression_list(); + } + jj_consume_token(67); + break; + case 64: + jj_consume_token(64); + function_arguments(); + jj_consume_token(65); + break; + case 35: + jj_consume_token(35); + break; + default: + jj_la1[114] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + } + + final public void name() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + jj_consume_token(68); + break; + default: + jj_la1[115] = jj_gen; + ; + } + jj_consume_token(IDENT); + label_35: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + ; + break; + default: + jj_la1[116] = jj_gen; + break label_35; + } + jj_consume_token(68); + jj_consume_token(IDENT); + } + } + + final public void component_reference() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + jj_consume_token(68); + break; + default: + jj_la1[117] = jj_gen; + ; + } + jj_consume_token(IDENT); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 66: + array_subscripts(); + break; + default: + jj_la1[118] = jj_gen; + ; + } + label_36: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + ; + break; + default: + jj_la1[119] = jj_gen; + break label_36; + } + jj_consume_token(68); + jj_consume_token(IDENT); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 66: + array_subscripts(); + break; + default: + jj_la1[120] = jj_gen; + ; + } + } + } + + final public void function_call_args() throws ParseException { + jj_consume_token(62); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 31: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + function_arguments(); + break; + default: + jj_la1[121] = jj_gen; + ; + } + jj_consume_token(63); + } + + final public void function_arguments() throws ParseException { + if (jj_2_9(2)) { + expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 21: + case 71: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + jj_consume_token(71); + function_arguments(); + break; + case 21: + jj_consume_token(21); + for_indices(); + break; + default: + jj_la1[122] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[123] = jj_gen; + ; + } + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENT: + named_arguments(); + break; + default: + jj_la1[124] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + + final public void named_arguments() throws ParseException { + named_argument(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + jj_consume_token(71); + named_arguments(); + break; + default: + jj_la1[125] = jj_gen; + ; + } + } + + final public void named_argument() throws ParseException { + jj_consume_token(IDENT); + jj_consume_token(88); + expression(); + } + + final public void output_expression_list() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 31: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + expression(); + break; + default: + jj_la1[126] = jj_gen; + ; + } + label_37: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[127] = jj_gen; + break label_37; + } + jj_consume_token(71); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 31: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + expression(); + break; + default: + jj_la1[128] = jj_gen; + ; + } + } + } + + final public void expression_list() throws ParseException { + expression(); + label_38: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[129] = jj_gen; + break label_38; + } + jj_consume_token(71); + expression(); + } + } + + final public void array_subscripts() throws ParseException { + jj_consume_token(66); + subscript(); + label_39: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[130] = jj_gen; + break label_39; + } + jj_consume_token(71); + subscript(); + } + jj_consume_token(67); + } + + final public void subscript() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 69: + jj_consume_token(69); + break; + case 6: + case 12: + case 31: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + expression(); + break; + default: + jj_la1[131] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + + final public void comment() throws ParseException { + string_comment(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 14: + annotation(); + break; + default: + jj_la1[132] = jj_gen; + ; + } + } + + final public void string_comment() throws ParseException { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING: + jj_consume_token(STRING); + label_40: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 78: + ; + break; + default: + jj_la1[133] = jj_gen; + break label_40; + } + jj_consume_token(78); + jj_consume_token(STRING); + } + break; + default: + jj_la1[134] = jj_gen; + ; + } + } + + final public void annotation() throws ParseException { + jj_consume_token(14); + class_modification(); + } + + private boolean jj_2_1(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_1(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(0, xla); } + } + + private boolean jj_2_2(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_2(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(1, xla); } + } + + private boolean jj_2_3(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_3(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(2, xla); } + } + + private boolean jj_2_4(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_4(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(3, xla); } + } + + private boolean jj_2_5(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_5(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(4, xla); } + } + + private boolean jj_2_6(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_6(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(5, xla); } + } + + private boolean jj_2_7(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_7(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(6, xla); } + } + + private boolean jj_2_8(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_8(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(7, xla); } + } + + private boolean jj_2_9(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_9(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(8, xla); } + } + + private boolean jj_3R_72() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(8)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(11)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(51)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(27)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_77()) { + jj_scanpos = xsp; + if (jj_3R_78()) return true; + } + return false; + } + + private boolean jj_3R_95() { + if (jj_3R_101()) return true; + if (jj_3R_94()) return true; + return false; + } + + private boolean jj_3R_71() { + if (jj_3R_76()) return true; + return false; + } + + private boolean jj_3R_64() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_70()) { + jj_scanpos = xsp; + if (jj_3R_71()) { + jj_scanpos = xsp; + if (jj_3R_72()) return true; + } + } + return false; + } + + private boolean jj_3R_70() { + if (jj_3R_75()) return true; + return false; + } + + private boolean jj_3R_83() { + if (jj_3R_89()) return true; + if (jj_3R_82()) return true; + return false; + } + + private boolean jj_3R_88() { + if (jj_3R_93()) return true; + if (jj_3R_87()) return true; + return false; + } + + private boolean jj_3R_101() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(82)) { + jj_scanpos = xsp; + if (jj_scan_token(83)) { + jj_scanpos = xsp; + if (jj_scan_token(84)) { + jj_scanpos = xsp; + if (jj_scan_token(85)) return true; + } + } + } + return false; + } + + private boolean jj_3R_87() { + if (jj_3R_94()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_95()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_52() { + if (jj_3R_64()) return true; + return false; + } + + private boolean jj_3R_43() { + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_52()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_93() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(78)) { + jj_scanpos = xsp; + if (jj_scan_token(79)) { + jj_scanpos = xsp; + if (jj_scan_token(80)) { + jj_scanpos = xsp; + if (jj_scan_token(81)) return true; + } + } + } + return false; + } + + private boolean jj_3R_74() { + if (jj_scan_token(9)) return true; + if (jj_3R_73()) return true; + return false; + } + + private boolean jj_3R_86() { + if (jj_3R_93()) return true; + return false; + } + + private boolean jj_3R_82() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_86()) jj_scanpos = xsp; + if (jj_3R_87()) return true; + while (true) { + xsp = jj_scanpos; + if (jj_3R_88()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_89() { + Token xsp; + xsp = jj_scanpos; + 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)) { + jj_scanpos = xsp; + if (jj_scan_token(76)) { + jj_scanpos = xsp; + if (jj_scan_token(77)) return true; + } + } + } + } + } + return false; + } + + private boolean jj_3R_54() { + if (jj_scan_token(69)) return true; + if (jj_3R_53()) return true; + return false; + } + + private boolean jj_3R_66() { + if (jj_scan_token(22)) return true; + if (jj_3R_65()) return true; + return false; + } + + private boolean jj_3_7() { + if (jj_3R_44()) return true; + if (jj_scan_token(88)) return true; + if (jj_3R_45()) return true; + return false; + } + + private boolean jj_3R_79() { + if (jj_3R_82()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_83()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_51() { + if (jj_3R_63()) return true; + return false; + } + + private boolean jj_3R_50() { + if (jj_scan_token(59)) return true; + return false; + } + + private boolean jj_3R_49() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_5()) { + jj_scanpos = xsp; + if (jj_3R_60()) { + jj_scanpos = xsp; + if (jj_3R_61()) { + jj_scanpos = xsp; + if (jj_3R_62()) return true; + } + } + } + return false; + } + + private boolean jj_3_5() { + if (jj_scan_token(57)) return true; + if (jj_3R_43()) return true; + return false; + } + + private boolean jj_3R_73() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(12)) jj_scanpos = xsp; + if (jj_3R_79()) return true; + return false; + } + + private boolean jj_3R_42() { + if (jj_3R_43()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_49()) { jj_scanpos = xsp; break; } + } + xsp = jj_scanpos; + if (jj_3R_50()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_51()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_65() { + 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_69() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(46)) jj_scanpos = xsp; + if (jj_scan_token(4)) return true; + return false; + } + + private boolean jj_3R_53() { + if (jj_3R_65()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_66()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_68() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(46)) jj_scanpos = xsp; + if (jj_scan_token(45)) return true; + return false; + } + + private boolean jj_3R_90() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(50)) jj_scanpos = xsp; + if (jj_scan_token(44)) return true; + return false; + } + + private boolean jj_3R_44() { + if (jj_3R_53()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_54()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_56() { + if (jj_scan_token(31)) return true; + if (jj_3R_45()) return true; + return false; + } + + private boolean jj_3R_55() { + if (jj_3R_44()) return true; + return false; + } + + private boolean jj_3R_45() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_55()) { + jj_scanpos = xsp; + if (jj_3R_56()) return true; + } + return false; + } + + private boolean jj_3_4() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + if (jj_scan_token(58)) return true; + return false; + } + + private boolean jj_3_3() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + if (jj_scan_token(40)) return true; + return false; + } + + private boolean jj_3_2() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + return false; + } + + private boolean jj_3_1() { + if (jj_scan_token(IDENT)) return true; + if (jj_3R_41()) return true; + if (jj_3R_42()) return true; + if (jj_scan_token(35)) return true; + return false; + } + + private boolean jj_3R_84() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(30)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(47)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(34)) { + jj_scanpos = xsp; + if (jj_scan_token(7)) { + jj_scanpos = xsp; + if (jj_scan_token(61)) { + jj_scanpos = xsp; + if (jj_scan_token(24)) { + jj_scanpos = xsp; + if (jj_3R_90()) { + jj_scanpos = xsp; + if (jj_scan_token(38)) { + jj_scanpos = xsp; + if (jj_scan_token(37)) { + jj_scanpos = xsp; + if (jj_scan_token(26)) { + jj_scanpos = xsp; + if (jj_scan_token(17)) { + jj_scanpos = xsp; + if (jj_scan_token(94)) { + jj_scanpos = xsp; + if (jj_scan_token(95)) return true; + } + } + } + } + } + } + } + } + } + } + return false; + } + + private boolean jj_3R_59() { + if (jj_scan_token(21)) return true; + return false; + } + + private boolean jj_3R_63() { + if (jj_scan_token(14)) return true; + return false; + } + + private boolean jj_3R_48() { + if (jj_scan_token(STRING)) return true; + return false; + } + + private boolean jj_3R_41() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_48()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_127() { + if (jj_3R_45()) return true; + return false; + } + + private boolean jj_3R_123() { + if (jj_3R_45()) return true; + return false; + } + + private boolean jj_3R_98() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(56)) { + jj_scanpos = xsp; + if (jj_scan_token(32)) return true; + } + return false; + } + + private boolean jj_3R_119() { + if (jj_scan_token(71)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_123()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_125() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(69)) { + jj_scanpos = xsp; + if (jj_3R_127()) return true; + } + return false; + } + + private boolean jj_3R_120() { + if (jj_scan_token(71)) return true; + return false; + } + + private boolean jj_3R_122() { + if (jj_scan_token(66)) return true; + if (jj_3R_125()) return true; + return false; + } + + private boolean jj_3R_117() { + if (jj_scan_token(68)) return true; + if (jj_scan_token(IDENT)) return true; + return false; + } + + private boolean jj_3R_58() { + if (jj_scan_token(71)) return true; + return false; + } + + private boolean jj_3R_47() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_58()) { + jj_scanpos = xsp; + if (jj_3R_59()) return true; + } + return false; + } + + private boolean jj_3R_118() { + if (jj_3R_45()) return true; + return false; + } + + private boolean jj_3R_112() { + if (jj_3R_45()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_120()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_111() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_118()) jj_scanpos = xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_119()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_62() { + if (jj_3R_69()) return true; + return false; + } + + private boolean jj_3R_126() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + return false; + } + + private boolean jj_3R_108() { + if (jj_3R_57()) return true; + return false; + } + + private boolean jj_3R_124() { + if (jj_3R_126()) return true; + return false; + } + + private boolean jj_3R_116() { + if (jj_3R_122()) return true; + return false; + } + + private boolean jj_3R_121() { + if (jj_3R_124()) return true; + return false; + } + + private boolean jj_3R_92() { + if (jj_3R_57()) return true; + return false; + } + + private boolean jj_3R_114() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_9()) { + jj_scanpos = xsp; + if (jj_3R_121()) return true; + } + return false; + } + + private boolean jj_3_9() { + if (jj_3R_45()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_47()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_67() { + if (jj_scan_token(68)) return true; + if (jj_scan_token(IDENT)) return true; + return false; + } + + private boolean jj_3R_115() { + if (jj_3R_114()) return true; + return false; + } + + private boolean jj_3R_97() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(5)) { + jj_scanpos = xsp; + if (jj_scan_token(42)) { + jj_scanpos = xsp; + if (jj_scan_token(49)) return true; + } + } + return false; + } + + private boolean jj_3R_96() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(16)) { + jj_scanpos = xsp; + if (jj_scan_token(23)) return true; + } + return false; + } + + private boolean jj_3R_91() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_96()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_97()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_98()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_113() { + if (jj_scan_token(70)) return true; + return false; + } + + private boolean jj_3R_109() { + if (jj_scan_token(62)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_115()) jj_scanpos = xsp; + if (jj_scan_token(63)) return true; + return false; + } + + private boolean jj_3R_61() { + if (jj_3R_68()) return true; + return false; + } + + private boolean jj_3R_85() { + if (jj_3R_91()) return true; + if (jj_3R_92()) return true; + return false; + } + + private boolean jj_3R_110() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(68)) jj_scanpos = xsp; + if (jj_scan_token(IDENT)) return true; + xsp = jj_scanpos; + if (jj_3R_116()) jj_scanpos = xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_117()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_81() { + if (jj_3R_85()) return true; + return false; + } + + private boolean jj_3R_57() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(68)) jj_scanpos = xsp; + if (jj_scan_token(IDENT)) return true; + while (true) { + xsp = jj_scanpos; + if (jj_3R_67()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_46() { + if (jj_3R_57()) return true; + return false; + } + + private boolean jj_3_6() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + return false; + } + + private boolean jj_3_8() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_46()) { + jj_scanpos = xsp; + if (jj_scan_token(58)) { + jj_scanpos = xsp; + if (jj_scan_token(46)) return true; + } + } + if (jj_scan_token(62)) return true; + return false; + } + + private boolean jj_3R_107() { + if (jj_scan_token(87)) return true; + if (jj_3R_99()) return true; + return false; + } + + private boolean jj_3R_76() { + if (jj_scan_token(55)) return true; + return false; + } + + private boolean jj_3R_100() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(86)) { + jj_scanpos = xsp; + if (jj_3R_107()) return true; + } + return false; + } + + private boolean jj_3R_106() { + if (jj_scan_token(64)) return true; + if (jj_3R_114()) return true; + if (jj_scan_token(65)) return true; + return false; + } + + private boolean jj_3R_78() { + if (jj_scan_token(13)) return true; + return false; + } + + private boolean jj_3R_105() { + if (jj_scan_token(66)) return true; + if (jj_3R_112()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_113()) { jj_scanpos = xsp; break; } + } + if (jj_scan_token(67)) return true; + return false; + } + + private boolean jj_3R_75() { + if (jj_scan_token(36)) return true; + return false; + } + + private boolean jj_3R_104() { + if (jj_scan_token(62)) return true; + if (jj_3R_111()) return true; + if (jj_scan_token(63)) return true; + return false; + } + + private boolean jj_3R_102() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_108()) { + jj_scanpos = xsp; + if (jj_scan_token(58)) { + jj_scanpos = xsp; + if (jj_scan_token(46)) return true; + } + } + if (jj_3R_109()) return true; + return false; + } + + private boolean jj_3R_103() { + if (jj_3R_110()) return true; + return false; + } + + private boolean jj_3R_99() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(93)) { + jj_scanpos = xsp; + if (jj_scan_token(92)) { + jj_scanpos = xsp; + if (jj_scan_token(91)) { + jj_scanpos = xsp; + if (jj_scan_token(6)) { + jj_scanpos = xsp; + if (jj_scan_token(33)) { + jj_scanpos = xsp; + if (jj_3R_102()) { + jj_scanpos = xsp; + if (jj_3R_103()) { + jj_scanpos = xsp; + if (jj_3R_104()) { + jj_scanpos = xsp; + if (jj_3R_105()) { + jj_scanpos = xsp; + if (jj_3R_106()) { + jj_scanpos = xsp; + if (jj_scan_token(35)) return true; + } + } + } + } + } + } + } + } + } + } + return false; + } + + private boolean jj_3R_60() { + if (jj_scan_token(52)) return true; + return false; + } + + private boolean jj_3R_80() { + if (jj_3R_84()) return true; + return false; + } + + private boolean jj_3R_77() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_80()) { + jj_scanpos = xsp; + if (jj_3R_81()) return true; + } + return false; + } + + private boolean jj_3R_94() { + if (jj_3R_99()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_100()) jj_scanpos = xsp; + return false; + } + + /** Generated Token Manager. */ + public ModelParserTokenManager token_source; + SimpleCharStream jj_input_stream; + /** Current token. */ + public Token token; + /** Next token. */ + public Token jj_nt; + private int jj_ntk; + private Token jj_scanpos, jj_lastpos; + private int jj_la; + private int jj_gen; + final private int[] jj_la1 = new int[135]; + static private int[] jj_la1_0; + static private int[] jj_la1_1; + static private int[] jj_la1_2; + static { + jj_la1_init_0(); + jj_la1_init_1(); + jj_la1_init_2(); + } + private static void jj_la1_init_0() { + jj_la1_0 = new int[] {0x0,0x0,0x45020880,0x800,0x40000000,0x0,0x0,0x5020080,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x10,0x0,0x0,0x4000,0x0,0x4000,0x0,0x80001040,0x4d8329a0,0x100,0x800,0x0,0x8000000,0x458300a0,0x458300a0,0x0,0x458320a0,0x4d8329a0,0x0,0x0,0x0,0x4000,0x0,0x0,0x810000,0x810000,0x20,0x20,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x0,0x2d00,0x0,0x2d00,0x400,0x800,0x2000,0x0,0x400,0x800,0x458300a0,0x458320a0,0x458300a0,0x0,0x0,0x80201040,0x0,0xa0240000,0x80200000,0x0,0xa0240000,0x80201040,0x100000,0x80201040,0x80201040,0x8000,0xa0240000,0x100000,0xa0240000,0xa0240000,0x8000,0x80201040,0xa0240000,0x0,0x0,0xa0240000,0x80201040,0x2000000,0x80201040,0xa0240000,0x2000000,0xa0240000,0x100000,0x80001040,0x100000,0x80001040,0x0,0x0,0x400000,0x200,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80001040,0x200000,0x200000,0x0,0x0,0x80001040,0x0,0x80001040,0x0,0x0,0x80001040,0x4000,0x0,0x0,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x200000,0x20049064,0x0,0x0,0x8000,0x40000,0x20041064,0x0,0x40000000,0x0,0x0,0x40000000,0x800000,0x0,0x2106000,0x106000,0x0,0x0,0x0,0x8000000,0x0,0x0,0x4400400a,0x218e9475,0x0,0x0,0x80000,0x0,0x21069465,0x21069465,0x400000,0x21069465,0x218e9475,0x0,0x0,0x40000000,0x0,0x40000000,0x0,0x0,0x0,0x20400,0x20400,0x1000001,0x1000001,0x0,0x0,0x0,0x40000000,0x0,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,0x0,0x21069465,0x21069465,0x21069465,0x400000,0x4000,0x4400488a,0x4000,0x40010800,0x880,0x40000000,0x40010800,0x4400488a,0x0,0x4400488a,0x4400488a,0x0,0x40010800,0x0,0x40010800,0x40010800,0x0,0x4400488a,0x40010800,0x0,0x200,0x40010800,0x4400488a,0x0,0x4400488a,0x40010800,0x0,0x40010800,0x0,0x4400400a,0x0,0x4400400a,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4004000,0x0,0x2,0x40000008,0x0,0x0,0x0,0x0,0x0,0x0,0x4400400a,0x0,0x0,0x0,0x0,0x4400400a,0x0,0x4400400a,0x0,0x0,0x4400400a,0x0,0x0,0x0,}; + } + private static void jj_la1_init_2() { + jj_la1_2 = new int[] {0x4000010,0x0,0xc0000000,0x0,0x0,0x0,0x0,0xc0000000,0x4,0x0,0x4000000,0x80,0x0,0x0,0x80,0x0,0x0,0x8000000,0x4000010,0x0,0x0,0x0,0x4000010,0x3c03c015,0xc4000010,0x0,0x0,0x0,0x0,0xc4000010,0xc4000010,0x0,0xc4000010,0xc4000010,0x10,0x4000010,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x4,0x3000000,0x1000000,0x3000000,0x4000010,0x80,0x4000010,0x0,0x0,0x4000010,0x3000000,0x0,0x0,0xc4000010,0xc4000010,0xc4000010,0x0,0x0,0x3c03c015,0x0,0x4000010,0x4000000,0x2000000,0x4000010,0x3c03c015,0x0,0x3c03c015,0x3c03c015,0x0,0x4000010,0x0,0x4000010,0x4000010,0x0,0x3c03c015,0x4000010,0x80,0x0,0x4000010,0x3c03c015,0x0,0x3c03c015,0x4000010,0x0,0x4000010,0x0,0x3c03c015,0x0,0x3c03c015,0x20,0x20,0x0,0x0,0x0,0x3f00,0x3f00,0x3c000,0x3c000,0x3c000,0x3c0000,0x3c0000,0xc00000,0xc00000,0x4000010,0x40,0x38000000,0x4000015,0x10,0x10,0x10,0x4,0x10,0x4,0x3c03c015,0x80,0x80,0x4000000,0x80,0x3c03c015,0x80,0x3c03c015,0x80,0x80,0x3c03c035,0x0,0x4000,0x8000000,}; + } + final private JJCalls[] jj_2_rtns = new JJCalls[9]; + private boolean jj_rescan = false; + private int jj_gc = 0; + + /** Constructor with InputStream. */ + public ModelParser(java.io.InputStream stream) { + this(stream, null); + } + /** Constructor with InputStream and supplied encoding */ + public ModelParser(java.io.InputStream stream, String encoding) { + try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new ModelParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 135; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream stream) { + ReInit(stream, null); + } + /** Reinitialise. */ + public void ReInit(java.io.InputStream stream, String encoding) { + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 135; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Constructor. */ + public ModelParser(java.io.Reader stream) { + jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new ModelParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 135; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 135; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Constructor with generated Token Manager. */ + public ModelParser(ModelParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 135; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Reinitialise. */ + public void ReInit(ModelParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 135; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + if (++jj_gc > 100) { + jj_gc = 0; + for (int i = 0; i < jj_2_rtns.length; i++) { + JJCalls c = jj_2_rtns[i]; + while (c != null) { + if (c.gen < jj_gen) c.first = null; + c = c.next; + } + } + } + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + static private final class LookaheadSuccess extends java.lang.Error { } + final private LookaheadSuccess jj_ls = new LookaheadSuccess(); + private boolean jj_scan_token(int kind) { + if (jj_scanpos == jj_lastpos) { + jj_la--; + if (jj_scanpos.next == null) { + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); + } else { + jj_lastpos = jj_scanpos = jj_scanpos.next; + } + } else { + jj_scanpos = jj_scanpos.next; + } + if (jj_rescan) { + int i = 0; Token tok = token; + while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } + if (tok != null) jj_add_error_token(kind, i); + } + if (jj_scanpos.kind != kind) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; + return false; + } + + +/** Get the next Token. */ + final public Token getNextToken() { + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; + } + +/** Get the specific Token. */ + final public Token getToken(int index) { + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; + } + + private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + private java.util.List jj_expentries = new java.util.ArrayList(); + private int[] jj_expentry; + private int jj_kind = -1; + private int[] jj_lasttokens = new int[100]; + private int jj_endpos; + + private void jj_add_error_token(int kind, int pos) { + if (pos >= 100) return; + if (pos == jj_endpos + 1) { + jj_lasttokens[jj_endpos++] = kind; + } else if (jj_endpos != 0) { + jj_expentry = new int[jj_endpos]; + for (int i = 0; i < jj_endpos; i++) { + jj_expentry[i] = jj_lasttokens[i]; + } + jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { + int[] oldentry = (int[])(it.next()); + if (oldentry.length == jj_expentry.length) { + for (int i = 0; i < jj_expentry.length; i++) { + if (oldentry[i] != jj_expentry[i]) { + continue jj_entries_loop; + } + } + jj_expentries.add(jj_expentry); + break jj_entries_loop; + } + } + if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; + } + } + + /** Generate ParseException. */ + public ParseException generateParseException() { + jj_expentries.clear(); + boolean[] la1tokens = new boolean[96]; + if (jj_kind >= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 135; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1< jj_gen) { + jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; + switch (i) { + case 0: jj_3_1(); break; + case 1: jj_3_2(); break; + case 2: jj_3_3(); break; + case 3: jj_3_4(); break; + case 4: jj_3_5(); break; + case 5: jj_3_6(); break; + case 6: jj_3_7(); break; + case 7: jj_3_8(); break; + case 8: jj_3_9(); break; + } + } + p = p.next; + } while (p != null); + } catch(LookaheadSuccess ls) { } + } + jj_rescan = false; + } + + private void jj_save(int index, int xla) { + JJCalls p = jj_2_rtns[index]; + while (p.gen > jj_gen) { + if (p.next == null) { p = p.next = new JJCalls(); break; } + p = p.next; + } + p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; + } + + static final class JJCalls { + int gen; + Token first; + int arg; + JJCalls next; + } + +} diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParserConstants.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParserConstants.java new file mode 100644 index 00000000..b307d246 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParserConstants.java @@ -0,0 +1,131 @@ +/* Generated By:JavaCC: Do not edit this line. ModelParserConstants.java */ +package org.simantics.sysdyn.modelParser; + + +/** + * Token literal values and constants. + * Generated by org.javacc.parser.OtherFilesGen#start() + */ +public interface ModelParserConstants { + + /** End of File. */ + int EOF = 0; + /** RegularExpression Id. */ + int WHITESPACE = 1; + /** RegularExpression Id. */ + int COMMENT1 = 2; + /** RegularExpression Id. */ + int COMMENT2 = 3; + /** RegularExpression Id. */ + int IDENT = 90; + /** RegularExpression Id. */ + int STRING = 91; + /** RegularExpression Id. */ + int UNSIGNED_INTEGER = 92; + /** RegularExpression Id. */ + int UNSIGNED_NUMBER = 93; + + /** Lexical state. */ + int DEFAULT = 0; + + /** Literal token values. */ + String[] tokenImage = { + "", + "", + "", + "", + "\"algorithm\"", + "\"discrete\"", + "\"false\"", + "\"model\"", + "\"redeclare\"", + "\"and\"", + "\"each\"", + "\"final\"", + "\"not\"", + "\"replaceable\"", + "\"annotation\"", + "\"else\"", + "\"flow\"", + "\"operator\"", + "\"return\"", + "\"assert\"", + "\"elseif\"", + "\"for\"", + "\"or\"", + "\"stream\"", + "\"block\"", + "\"elsewhen\"", + "\"function\"", + "\"outer\"", + "\"then\"", + "\"break\"", + "\"encapsulated\"", + "\"if\"", + "\"output\"", + "\"true\"", + "\"class\"", + "\"end\"", + "\"import\"", + "\"package\"", + "\"type\"", + "\"connect\"", + "\"enumeration\"", + "\"in\"", + "\"parameter\"", + "\"when\"", + "\"connector\"", + "\"equation\"", + "\"initial\"", + "\"partial\"", + "\"while\"", + "\"constant\"", + "\"expandable\"", + "\"inner\"", + "\"protected\"", + "\"within\"", + "\"constrainedby\"", + "\"extends\"", + "\"input\"", + "\"public\"", + "\"der\"", + "\"external\"", + "\"loop\"", + "\"record\"", + "\"(\"", + "\")\"", + "\"{\"", + "\"}\"", + "\"[\"", + "\"]\"", + "\".\"", + "\":\"", + "\";\"", + "\",\"", + "\"<\"", + "\"<=\"", + "\">\"", + "\">=\"", + "\"==\"", + "\"<>\"", + "\"+\"", + "\"-\"", + "\".+\"", + "\".-\"", + "\"*\"", + "\"/\"", + "\".*\"", + "\"./\"", + "\"^\"", + "\".^\"", + "\"=\"", + "\":=\"", + "", + "", + "", + "", + "\"operator function\"", + "\"operator record\"", + }; + +} diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParserTokenManager.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParserTokenManager.java new file mode 100644 index 00000000..5fbdba7f --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParserTokenManager.java @@ -0,0 +1,1434 @@ +/* Generated By:JavaCC: Do not edit this line. ModelParserTokenManager.java */ +package org.simantics.sysdyn.modelParser; + +/** Token Manager. */ +public class ModelParserTokenManager implements ModelParserConstants +{ + + /** Debug output. */ + public java.io.PrintStream debugStream = System.out; + /** Set debug output. */ + public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } +private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) +{ + switch (pos) + { + case 0: + if ((active0 & 0x3ffffffffffffff0L) != 0L || (active1 & 0xc0000000L) != 0L) + { + jjmatchedKind = 90; + return 2; + } + if ((active1 & 0x80000L) != 0L) + return 13; + if ((active1 & 0xb30010L) != 0L) + return 9; + return -1; + case 1: + if ((active0 & 0x108420080400000L) != 0L) + return 2; + if ((active0 & 0x3ef7bdff7fbffff0L) != 0L || (active1 & 0xc0000000L) != 0L) + { + if (jjmatchedPos != 1) + { + jjmatchedKind = 90; + jjmatchedPos = 1; + } + return 2; + } + return -1; + case 2: + if ((active0 & 0x400000800201200L) != 0L) + return 2; + if ((active0 & 0x3bfffdf77f9fedf0L) != 0L || (active1 & 0xc0000000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 2; + return 2; + } + return -1; + case 3: + if ((active0 & 0x1000084212118400L) != 0L) + return 2; + if ((active0 & 0x2bfff5b56d8e69f0L) != 0L || (active1 & 0xc0000000L) != 0L) + { + if (jjmatchedPos != 3) + { + jjmatchedKind = 90; + jjmatchedPos = 3; + } + return 2; + } + return -1; + case 4: + if ((active0 & 0x1090004290008c0L) != 0L) + return 2; + if ((active0 & 0x2af6f5b1469e6130L) != 0L || (active1 & 0xc0000000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 4; + return 2; + } + return -1; + case 5: + if ((active0 & 0x22200011009c0000L) != 0L) + return 2; + if ((active0 & 0x8d6f5a046026130L) != 0L || (active1 & 0xc0000000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 5; + return 2; + } + return -1; + case 6: + if ((active0 & 0x80d0a000000000L) != 0L) + return 2; + if ((active0 & 0x856250046026130L) != 0L || (active1 & 0xc0000000L) != 0L) + { + if (jjmatchedPos != 6) + { + jjmatchedKind = 90; + jjmatchedPos = 6; + } + return 2; + } + return -1; + case 7: + if ((active0 & 0x54150040006110L) != 0L) + { + if (jjmatchedPos != 7) + { + jjmatchedKind = 90; + jjmatchedPos = 7; + } + return 2; + } + if ((active0 & 0x802200006020020L) != 0L || (active1 & 0xc0000000L) != 0L) + return 2; + return -1; + case 8: + if ((active0 & 0x10140000000110L) != 0L) + return 2; + if ((active0 & 0x44010040006000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 8; + return 2; + } + return -1; + case 9: + if ((active0 & 0x40010040002000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 9; + return 2; + } + if ((active0 & 0x4000000004000L) != 0L) + return 2; + return -1; + case 10: + if ((active0 & 0x10000002000L) != 0L) + return 2; + if ((active0 & 0x40000040000000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 10; + return 2; + } + return -1; + case 11: + if ((active0 & 0x40000000L) != 0L) + return 2; + if ((active0 & 0x40000000000000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 11; + return 2; + } + return -1; + case 12: + if ((active0 & 0x40000000000000L) != 0L) + return 2; + return -1; + default : + return -1; + } +} +private final int jjStartNfa_0(int pos, long active0, long active1) +{ + return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1); +} +private int jjStopAtPos(int pos, int kind) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; +} +private int jjMoveStringLiteralDfa0_0() +{ + switch(curChar) + { + case 40: + return jjStopAtPos(0, 62); + case 41: + return jjStopAtPos(0, 63); + case 42: + return jjStopAtPos(0, 82); + case 43: + return jjStopAtPos(0, 78); + case 44: + return jjStopAtPos(0, 71); + case 45: + return jjStopAtPos(0, 79); + case 46: + jjmatchedKind = 68; + return jjMoveStringLiteralDfa1_0(0x0L, 0xb30000L); + case 47: + return jjStartNfaWithStates_0(0, 83, 13); + case 58: + jjmatchedKind = 69; + return jjMoveStringLiteralDfa1_0(0x0L, 0x2000000L); + case 59: + return jjStopAtPos(0, 70); + case 60: + jjmatchedKind = 72; + return jjMoveStringLiteralDfa1_0(0x0L, 0x2200L); + case 61: + jjmatchedKind = 88; + return jjMoveStringLiteralDfa1_0(0x0L, 0x1000L); + case 62: + jjmatchedKind = 74; + return jjMoveStringLiteralDfa1_0(0x0L, 0x800L); + case 91: + return jjStopAtPos(0, 66); + case 93: + return jjStopAtPos(0, 67); + case 94: + return jjStopAtPos(0, 86); + case 97: + return jjMoveStringLiteralDfa1_0(0x84210L, 0x0L); + case 98: + return jjMoveStringLiteralDfa1_0(0x21000000L, 0x0L); + case 99: + return jjMoveStringLiteralDfa1_0(0x42108400000000L, 0x0L); + case 100: + return jjMoveStringLiteralDfa1_0(0x400000000000020L, 0x0L); + case 101: + return jjMoveStringLiteralDfa1_0(0x884210842108400L, 0x0L); + case 102: + return jjMoveStringLiteralDfa1_0(0x4210840L, 0x0L); + case 105: + return jjMoveStringLiteralDfa1_0(0x108421080000000L, 0x0L); + case 108: + return jjMoveStringLiteralDfa1_0(0x1000000000000000L, 0x0L); + case 109: + return jjMoveStringLiteralDfa1_0(0x80L, 0x0L); + case 110: + return jjMoveStringLiteralDfa1_0(0x1000L, 0x0L); + case 111: + return jjMoveStringLiteralDfa1_0(0x108420000L, 0xc0000000L); + case 112: + return jjMoveStringLiteralDfa1_0(0x210842000000000L, 0x0L); + case 114: + return jjMoveStringLiteralDfa1_0(0x2000000000042100L, 0x0L); + case 115: + return jjMoveStringLiteralDfa1_0(0x800000L, 0x0L); + case 116: + return jjMoveStringLiteralDfa1_0(0x4210000000L, 0x0L); + case 119: + return jjMoveStringLiteralDfa1_0(0x21080000000000L, 0x0L); + case 123: + return jjStopAtPos(0, 64); + case 125: + return jjStopAtPos(0, 65); + default : + return jjMoveNfa_0(0, 0); + } +} +private int jjMoveStringLiteralDfa1_0(long active0, long active1) +{ + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(0, active0, active1); + return 1; + } + switch(curChar) + { + case 42: + if ((active1 & 0x100000L) != 0L) + return jjStopAtPos(1, 84); + break; + case 43: + if ((active1 & 0x10000L) != 0L) + return jjStopAtPos(1, 80); + break; + case 45: + if ((active1 & 0x20000L) != 0L) + return jjStopAtPos(1, 81); + break; + case 47: + if ((active1 & 0x200000L) != 0L) + return jjStopAtPos(1, 85); + break; + case 61: + if ((active1 & 0x200L) != 0L) + return jjStopAtPos(1, 73); + else if ((active1 & 0x800L) != 0L) + return jjStopAtPos(1, 75); + else if ((active1 & 0x1000L) != 0L) + return jjStopAtPos(1, 76); + else if ((active1 & 0x2000000L) != 0L) + return jjStopAtPos(1, 89); + break; + case 62: + if ((active1 & 0x2000L) != 0L) + return jjStopAtPos(1, 77); + break; + case 94: + if ((active1 & 0x800000L) != 0L) + return jjStopAtPos(1, 87); + break; + case 97: + return jjMoveStringLiteralDfa2_0(active0, 0x842000000440L, active1, 0L); + case 101: + return jjMoveStringLiteralDfa2_0(active0, 0x2400000000042100L, active1, 0L); + case 102: + if ((active0 & 0x80000000L) != 0L) + return jjStartNfaWithStates_0(1, 31, 2); + break; + case 104: + return jjMoveStringLiteralDfa2_0(active0, 0x1080010000000L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa2_0(active0, 0x20000000000820L, active1, 0L); + case 108: + return jjMoveStringLiteralDfa2_0(active0, 0x403118010L, active1, 0L); + case 109: + return jjMoveStringLiteralDfa2_0(active0, 0x1000000000L, active1, 0L); + case 110: + if ((active0 & 0x20000000000L) != 0L) + { + jjmatchedKind = 41; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0x108410840004200L, active1, 0L); + case 111: + return jjMoveStringLiteralDfa2_0(active0, 0x1042108000201080L, active1, 0L); + case 112: + return jjMoveStringLiteralDfa2_0(active0, 0x20000L, active1, 0xc0000000L); + case 113: + return jjMoveStringLiteralDfa2_0(active0, 0x200000000000L, active1, 0L); + case 114: + if ((active0 & 0x400000L) != 0L) + return jjStartNfaWithStates_0(1, 22, 2); + return jjMoveStringLiteralDfa2_0(active0, 0x10000220000000L, active1, 0L); + case 115: + return jjMoveStringLiteralDfa2_0(active0, 0x80000L, active1, 0L); + case 116: + return jjMoveStringLiteralDfa2_0(active0, 0x800000L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa2_0(active0, 0x20000010c000000L, active1, 0L); + case 120: + return jjMoveStringLiteralDfa2_0(active0, 0x884000000000000L, active1, 0L); + case 121: + return jjMoveStringLiteralDfa2_0(active0, 0x4000000000L, active1, 0L); + default : + break; + } + return jjStartNfa_0(0, active0, active1); +} +private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(0, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(1, active0, active1); + return 2; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa3_0(active0, 0x400000000L, active1, 0L); + case 98: + return jjMoveStringLiteralDfa3_0(active0, 0x200000000000000L, active1, 0L); + case 99: + return jjMoveStringLiteralDfa3_0(active0, 0x2000002040000400L, active1, 0L); + case 100: + if ((active0 & 0x200L) != 0L) + return jjStartNfaWithStates_0(2, 9, 2); + else if ((active0 & 0x800000000L) != 0L) + return jjStartNfaWithStates_0(2, 35, 2); + return jjMoveStringLiteralDfa3_0(active0, 0x180L, active1, 0L); + case 101: + return jjMoveStringLiteralDfa3_0(active0, 0x80030020000L, active1, 0xc0000000L); + case 103: + return jjMoveStringLiteralDfa3_0(active0, 0x10L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa3_0(active0, 0x1400000000000L, active1, 0L); + case 108: + return jjMoveStringLiteralDfa3_0(active0, 0x40L, active1, 0L); + case 110: + return jjMoveStringLiteralDfa3_0(active0, 0x4a108004004800L, active1, 0L); + case 111: + return jjMoveStringLiteralDfa3_0(active0, 0x1010000001010000L, active1, 0L); + case 112: + return jjMoveStringLiteralDfa3_0(active0, 0x104005000002000L, active1, 0L); + case 114: + if ((active0 & 0x200000L) != 0L) + return jjStartNfaWithStates_0(2, 21, 2); + else if ((active0 & 0x400000000000000L) != 0L) + return jjStartNfaWithStates_0(2, 58, 2); + return jjMoveStringLiteralDfa3_0(active0, 0x840000800000L, active1, 0L); + case 115: + return jjMoveStringLiteralDfa3_0(active0, 0x2188020L, active1, 0L); + case 116: + if ((active0 & 0x1000L) != 0L) + return jjStartNfaWithStates_0(2, 12, 2); + return jjMoveStringLiteralDfa3_0(active0, 0x8a0000108040000L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa3_0(active0, 0x210200000000L, active1, 0L); + default : + break; + } + return jjStartNfa_0(1, active0, active1); +} +private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(1, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(2, active0, active1); + return 3; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa4_0(active0, 0x4240060000800L, active1, 0L); + case 99: + return jjMoveStringLiteralDfa4_0(active0, 0x5000020L, active1, 0L); + case 101: + if ((active0 & 0x8000L) != 0L) + { + jjmatchedKind = 15; + jjmatchedPos = 3; + } + else if ((active0 & 0x200000000L) != 0L) + return jjStartNfaWithStates_0(3, 33, 2); + else if ((active0 & 0x4000000000L) != 0L) + return jjStartNfaWithStates_0(3, 38, 2); + return jjMoveStringLiteralDfa4_0(active0, 0x88800000a980180L, active1, 0L); + case 104: + if ((active0 & 0x400L) != 0L) + return jjStartNfaWithStates_0(3, 10, 2); + return jjMoveStringLiteralDfa4_0(active0, 0x20000000000000L, active1, 0L); + case 107: + return jjMoveStringLiteralDfa4_0(active0, 0x2000000000L, active1, 0L); + case 108: + return jjMoveStringLiteralDfa4_0(active0, 0x201000000002000L, active1, 0L); + case 109: + return jjMoveStringLiteralDfa4_0(active0, 0x10000000000L, active1, 0L); + case 110: + if ((active0 & 0x10000000L) != 0L) + return jjStartNfaWithStates_0(3, 28, 2); + else if ((active0 & 0x80000000000L) != 0L) + return jjStartNfaWithStates_0(3, 43, 2); + return jjMoveStringLiteralDfa4_0(active0, 0x108000000000L, active1, 0L); + case 111: + return jjMoveStringLiteralDfa4_0(active0, 0x2000001000004010L, active1, 0L); + case 112: + if ((active0 & 0x1000000000000000L) != 0L) + return jjStartNfaWithStates_0(3, 60, 2); + return jjMoveStringLiteralDfa4_0(active0, 0x100000000L, active1, 0L); + case 114: + return jjMoveStringLiteralDfa4_0(active0, 0x20000L, active1, 0xc0000000L); + case 115: + return jjMoveStringLiteralDfa4_0(active0, 0x42000400000040L, active1, 0L); + case 116: + return jjMoveStringLiteralDfa4_0(active0, 0x10c00000000000L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa4_0(active0, 0x100000000040000L, active1, 0L); + case 119: + if ((active0 & 0x10000L) != 0L) + return jjStartNfaWithStates_0(3, 16, 2); + break; + default : + break; + } + return jjStartNfa_0(2, active0, active1); +} +private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(2, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(3, active0, active1); + return 4; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa5_0(active0, 0x2000822000L, active1, 0xc0000000L); + case 99: + return jjMoveStringLiteralDfa5_0(active0, 0x100L, active1, 0L); + case 101: + if ((active0 & 0x40L) != 0L) + return jjStartNfaWithStates_0(4, 6, 2); + else if ((active0 & 0x1000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 48, 2); + return jjMoveStringLiteralDfa5_0(active0, 0x10118000000000L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa5_0(active0, 0x220c00000100000L, active1, 0L); + case 107: + if ((active0 & 0x1000000L) != 0L) + return jjStartNfaWithStates_0(4, 24, 2); + else if ((active0 & 0x20000000L) != 0L) + return jjStartNfaWithStates_0(4, 29, 2); + break; + case 108: + if ((active0 & 0x80L) != 0L) + return jjStartNfaWithStates_0(4, 7, 2); + else if ((active0 & 0x800L) != 0L) + return jjStartNfaWithStates_0(4, 11, 2); + break; + case 109: + return jjMoveStringLiteralDfa5_0(active0, 0x40000000000L, active1, 0L); + case 110: + return jjMoveStringLiteralDfa5_0(active0, 0x84000000000000L, active1, 0L); + case 112: + return jjMoveStringLiteralDfa5_0(active0, 0x40000000L, active1, 0L); + case 114: + if ((active0 & 0x8000000L) != 0L) + return jjStartNfaWithStates_0(4, 27, 2); + else if ((active0 & 0x8000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 51, 2); + return jjMoveStringLiteralDfa5_0(active0, 0x28000010000c0030L, active1, 0L); + case 115: + if ((active0 & 0x400000000L) != 0L) + return jjStartNfaWithStates_0(4, 34, 2); + break; + case 116: + if ((active0 & 0x100000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 56, 2); + return jjMoveStringLiteralDfa5_0(active0, 0x42200004004000L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa5_0(active0, 0x100000000L, active1, 0L); + case 119: + return jjMoveStringLiteralDfa5_0(active0, 0x2000000L, active1, 0L); + default : + break; + } + return jjStartNfa_0(3, active0, active1); +} +private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(3, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(4, active0, active1); + return 5; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa6_0(active0, 0x2c00000004000L, active1, 0L); + case 99: + if ((active0 & 0x200000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 57, 2); + return jjMoveStringLiteralDfa6_0(active0, 0x10108000002000L, active1, 0L); + case 100: + if ((active0 & 0x2000000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 61, 2); + return jjMoveStringLiteralDfa6_0(active0, 0x84000000000000L, active1, 0L); + case 101: + return jjMoveStringLiteralDfa6_0(active0, 0x40000000020L, active1, 0L); + case 102: + if ((active0 & 0x100000L) != 0L) + return jjStartNfaWithStates_0(5, 20, 2); + break; + case 103: + return jjMoveStringLiteralDfa6_0(active0, 0x2000000000L, active1, 0L); + case 104: + return jjMoveStringLiteralDfa6_0(active0, 0x2000000L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa6_0(active0, 0x200004000010L, active1, 0L); + case 108: + return jjMoveStringLiteralDfa6_0(active0, 0x100L, active1, 0L); + case 109: + if ((active0 & 0x800000L) != 0L) + return jjStartNfaWithStates_0(5, 23, 2); + break; + case 110: + if ((active0 & 0x40000L) != 0L) + return jjStartNfaWithStates_0(5, 18, 2); + else if ((active0 & 0x20000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 53, 2); + return jjMoveStringLiteralDfa6_0(active0, 0x800000000000000L, active1, 0L); + case 114: + return jjMoveStringLiteralDfa6_0(active0, 0x40010000000000L, active1, 0L); + case 115: + return jjMoveStringLiteralDfa6_0(active0, 0x40000000L, active1, 0L); + case 116: + if ((active0 & 0x80000L) != 0L) + return jjStartNfaWithStates_0(5, 19, 2); + else if ((active0 & 0x100000000L) != 0L) + return jjStartNfaWithStates_0(5, 32, 2); + else if ((active0 & 0x1000000000L) != 0L) + return jjStartNfaWithStates_0(5, 36, 2); + return jjMoveStringLiteralDfa6_0(active0, 0x20000L, active1, 0xc0000000L); + default : + break; + } + return jjStartNfa_0(4, active0, active1); +} +private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(4, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(5, active0, active1); + return 6; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa7_0(active0, 0x844010000000100L, active1, 0L); + case 101: + if ((active0 & 0x2000000000L) != 0L) + return jjStartNfaWithStates_0(6, 37, 2); + return jjMoveStringLiteralDfa7_0(active0, 0x2002000L, active1, 0L); + case 108: + if ((active0 & 0x400000000000L) != 0L) + return jjStartNfaWithStates_0(6, 46, 2); + else if ((active0 & 0x800000000000L) != 0L) + return jjStartNfaWithStates_0(6, 47, 2); + break; + case 110: + return jjMoveStringLiteralDfa7_0(active0, 0x2000000000000L, active1, 0L); + case 111: + return jjMoveStringLiteralDfa7_0(active0, 0x200004020000L, active1, 0xc0000000L); + case 115: + if ((active0 & 0x80000000000000L) != 0L) + return jjStartNfaWithStates_0(6, 55, 2); + break; + case 116: + if ((active0 & 0x8000000000L) != 0L) + { + jjmatchedKind = 39; + jjmatchedPos = 6; + } + return jjMoveStringLiteralDfa7_0(active0, 0x10140000004030L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa7_0(active0, 0x40000000L, active1, 0L); + default : + break; + } + return jjStartNfa_0(5, active0, active1); +} +private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(5, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(6, active0, active1); + return 7; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa8_0(active0, 0x2000L, active1, 0L); + case 98: + return jjMoveStringLiteralDfa8_0(active0, 0x4000000000000L, active1, 0L); + case 101: + if ((active0 & 0x20L) != 0L) + return jjStartNfaWithStates_0(7, 5, 2); + return jjMoveStringLiteralDfa8_0(active0, 0x10040000000000L, active1, 0L); + case 104: + return jjMoveStringLiteralDfa8_0(active0, 0x10L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa8_0(active0, 0x40000000004000L, active1, 0L); + case 108: + if ((active0 & 0x800000000000000L) != 0L) + return jjStartNfaWithStates_0(7, 59, 2); + return jjMoveStringLiteralDfa8_0(active0, 0x40000000L, active1, 0L); + case 110: + if ((active0 & 0x2000000L) != 0L) + return jjStartNfaWithStates_0(7, 25, 2); + else if ((active0 & 0x4000000L) != 0L) + return jjStartNfaWithStates_0(7, 26, 2); + else if ((active0 & 0x200000000000L) != 0L) + return jjStartNfaWithStates_0(7, 45, 2); + break; + case 111: + return jjMoveStringLiteralDfa8_0(active0, 0x100000000000L, active1, 0L); + case 114: + if ((active0 & 0x20000L) != 0L) + { + jjmatchedKind = 17; + jjmatchedPos = 7; + } + return jjMoveStringLiteralDfa8_0(active0, 0x100L, active1, 0xc0000000L); + case 116: + if ((active0 & 0x2000000000000L) != 0L) + return jjStartNfaWithStates_0(7, 49, 2); + return jjMoveStringLiteralDfa8_0(active0, 0x10000000000L, active1, 0L); + default : + break; + } + return jjStartNfa_0(6, active0, active1); +} +private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(6, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(7, active0, active1); + return 8; + } + switch(curChar) + { + case 32: + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0xc0000000L); + case 97: + return jjMoveStringLiteralDfa9_0(active0, 0x40000000L, active1, 0L); + case 98: + return jjMoveStringLiteralDfa9_0(active0, 0x2000L, active1, 0L); + case 100: + if ((active0 & 0x10000000000000L) != 0L) + return jjStartNfaWithStates_0(8, 52, 2); + break; + case 101: + if ((active0 & 0x100L) != 0L) + return jjStartNfaWithStates_0(8, 8, 2); + break; + case 105: + return jjMoveStringLiteralDfa9_0(active0, 0x10000000000L, active1, 0L); + case 108: + return jjMoveStringLiteralDfa9_0(active0, 0x4000000000000L, active1, 0L); + case 109: + if ((active0 & 0x10L) != 0L) + return jjStartNfaWithStates_0(8, 4, 2); + break; + case 110: + return jjMoveStringLiteralDfa9_0(active0, 0x40000000000000L, active1, 0L); + case 111: + return jjMoveStringLiteralDfa9_0(active0, 0x4000L, active1, 0L); + case 114: + if ((active0 & 0x40000000000L) != 0L) + return jjStartNfaWithStates_0(8, 42, 2); + else if ((active0 & 0x100000000000L) != 0L) + return jjStartNfaWithStates_0(8, 44, 2); + break; + default : + break; + } + return jjStartNfa_0(7, active0, active1); +} +private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(7, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(8, active0, active1); + return 9; + } + switch(curChar) + { + case 101: + if ((active0 & 0x4000000000000L) != 0L) + return jjStartNfaWithStates_0(9, 50, 2); + return jjMoveStringLiteralDfa10_0(active0, 0x40000000000000L, active1, 0L); + case 102: + return jjMoveStringLiteralDfa10_0(active0, 0L, active1, 0x40000000L); + case 108: + return jjMoveStringLiteralDfa10_0(active0, 0x2000L, active1, 0L); + case 110: + if ((active0 & 0x4000L) != 0L) + return jjStartNfaWithStates_0(9, 14, 2); + break; + case 111: + return jjMoveStringLiteralDfa10_0(active0, 0x10000000000L, active1, 0L); + case 114: + return jjMoveStringLiteralDfa10_0(active0, 0L, active1, 0x80000000L); + case 116: + return jjMoveStringLiteralDfa10_0(active0, 0x40000000L, active1, 0L); + default : + break; + } + return jjStartNfa_0(8, active0, active1); +} +private int jjMoveStringLiteralDfa10_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(8, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(9, active0, active1); + return 10; + } + switch(curChar) + { + case 100: + return jjMoveStringLiteralDfa11_0(active0, 0x40000000000000L, active1, 0L); + case 101: + if ((active0 & 0x2000L) != 0L) + return jjStartNfaWithStates_0(10, 13, 2); + return jjMoveStringLiteralDfa11_0(active0, 0x40000000L, active1, 0x80000000L); + case 110: + if ((active0 & 0x10000000000L) != 0L) + return jjStartNfaWithStates_0(10, 40, 2); + break; + case 117: + return jjMoveStringLiteralDfa11_0(active0, 0L, active1, 0x40000000L); + default : + break; + } + return jjStartNfa_0(9, active0, active1); +} +private int jjMoveStringLiteralDfa11_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(9, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(10, active0, active1); + return 11; + } + switch(curChar) + { + case 98: + return jjMoveStringLiteralDfa12_0(active0, 0x40000000000000L, active1, 0L); + case 99: + return jjMoveStringLiteralDfa12_0(active0, 0L, active1, 0x80000000L); + case 100: + if ((active0 & 0x40000000L) != 0L) + return jjStartNfaWithStates_0(11, 30, 2); + break; + case 110: + return jjMoveStringLiteralDfa12_0(active0, 0L, active1, 0x40000000L); + default : + break; + } + return jjStartNfa_0(10, active0, active1); +} +private int jjMoveStringLiteralDfa12_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(10, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(11, active0, active1); + return 12; + } + switch(curChar) + { + case 99: + return jjMoveStringLiteralDfa13_0(active0, 0L, active1, 0x40000000L); + case 111: + return jjMoveStringLiteralDfa13_0(active0, 0L, active1, 0x80000000L); + case 121: + if ((active0 & 0x40000000000000L) != 0L) + return jjStartNfaWithStates_0(12, 54, 2); + break; + default : + break; + } + return jjStartNfa_0(11, active0, active1); +} +private int jjMoveStringLiteralDfa13_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(11, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(12, 0L, active1); + return 13; + } + switch(curChar) + { + case 114: + return jjMoveStringLiteralDfa14_0(active1, 0x80000000L); + case 116: + return jjMoveStringLiteralDfa14_0(active1, 0x40000000L); + default : + break; + } + return jjStartNfa_0(12, 0L, active1); +} +private int jjMoveStringLiteralDfa14_0(long old1, long active1) +{ + if (((active1 &= old1)) == 0L) + return jjStartNfa_0(12, 0L, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(13, 0L, active1); + return 14; + } + switch(curChar) + { + case 100: + if ((active1 & 0x80000000L) != 0L) + return jjStopAtPos(14, 95); + break; + case 105: + return jjMoveStringLiteralDfa15_0(active1, 0x40000000L); + default : + break; + } + return jjStartNfa_0(13, 0L, active1); +} +private int jjMoveStringLiteralDfa15_0(long old1, long active1) +{ + if (((active1 &= old1)) == 0L) + return jjStartNfa_0(13, 0L, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(14, 0L, active1); + return 15; + } + switch(curChar) + { + case 111: + return jjMoveStringLiteralDfa16_0(active1, 0x40000000L); + default : + break; + } + return jjStartNfa_0(14, 0L, active1); +} +private int jjMoveStringLiteralDfa16_0(long old1, long active1) +{ + if (((active1 &= old1)) == 0L) + return jjStartNfa_0(14, 0L, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(15, 0L, active1); + return 16; + } + switch(curChar) + { + case 110: + if ((active1 & 0x40000000L) != 0L) + return jjStopAtPos(16, 94); + break; + default : + break; + } + return jjStartNfa_0(15, 0L, active1); +} +private int jjStartNfaWithStates_0(int pos, int kind, int state) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { return pos + 1; } + return jjMoveNfa_0(state, pos + 1); +} +static final long[] jjbitVec0 = { + 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +private int jjMoveNfa_0(int startState, int curPos) +{ + int startsAt = 0; + jjnewStateCnt = 31; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + do + { + 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 > 92) + kind = 92; + jjCheckNAddStates(3, 7); + } + else if ((0x100002600L & l) != 0L) + { + if (kind > 1) + kind = 1; + } + else if (curChar == 47) + jjAddStates(8, 9); + else if (curChar == 46) + jjCheckNAdd(9); + else if (curChar == 34) + jjCheckNAddStates(10, 12); + break; + case 2: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 90) + kind = 90; + jjstateSet[jjnewStateCnt++] = 2; + break; + case 3: + if (curChar == 34) + jjCheckNAddStates(10, 12); + break; + case 4: + if ((0xfffffffbfffffbffL & l) != 0L) + jjCheckNAddStates(10, 12); + break; + case 6: + if ((0xfffffffffffffbffL & l) != 0L) + jjCheckNAddStates(10, 12); + break; + case 7: + if (curChar == 34 && kind > 91) + kind = 91; + break; + case 8: + if (curChar == 46) + jjCheckNAdd(9); + break; + case 9: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 93) + kind = 93; + jjCheckNAddTwoStates(9, 10); + break; + case 11: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 93) + kind = 93; + jjstateSet[jjnewStateCnt++] = 11; + break; + case 12: + if (curChar == 47) + jjAddStates(8, 9); + break; + case 14: + if ((0xfffffbffffffffffL & l) != 0L) + jjCheckNAddStates(0, 2); + break; + case 15: + if (curChar == 42) + jjstateSet[jjnewStateCnt++] = 16; + break; + case 16: + if ((0xffff7fffffffffffL & l) != 0L) + jjCheckNAddStates(0, 2); + break; + case 17: + if (curChar == 47 && kind > 2) + kind = 2; + break; + case 18: + if (curChar == 42) + jjstateSet[jjnewStateCnt++] = 17; + break; + case 19: + if (curChar != 47) + break; + if (kind > 3) + kind = 3; + jjCheckNAdd(20); + break; + case 20: + if ((0xfffffffffffffbffL & l) == 0L) + break; + if (kind > 3) + kind = 3; + jjCheckNAdd(20); + break; + case 21: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 92) + kind = 92; + jjCheckNAddStates(3, 7); + break; + case 22: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 92) + kind = 92; + jjCheckNAdd(22); + break; + case 23: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(23, 24); + break; + case 24: + if (curChar != 46) + break; + if (kind > 93) + kind = 93; + jjCheckNAddTwoStates(25, 26); + break; + case 25: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 93) + kind = 93; + jjCheckNAddTwoStates(25, 26); + break; + case 27: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 93) + kind = 93; + jjstateSet[jjnewStateCnt++] = 27; + break; + case 28: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(28, 29); + break; + case 30: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 93) + kind = 93; + jjstateSet[jjnewStateCnt++] = 30; + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + do + { + switch(jjstateSet[--i]) + { + case 0: + case 2: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 90) + kind = 90; + jjCheckNAdd(2); + break; + case 4: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(10, 12); + break; + case 5: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 6; + break; + case 6: + jjCheckNAddStates(10, 12); + break; + case 10: + if ((0x2000000020L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 11; + break; + case 14: + case 16: + jjCheckNAddStates(0, 2); + break; + case 20: + if (kind > 3) + kind = 3; + jjstateSet[jjnewStateCnt++] = 20; + break; + case 26: + if ((0x2000000020L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 27; + break; + case 29: + if ((0x2000000020L & l) != 0L) + jjstateSet[jjnewStateCnt++] = 30; + break; + default : break; + } + } while(i != startsAt); + } + else + { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do + { + switch(jjstateSet[--i]) + { + case 4: + case 6: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddStates(10, 12); + break; + case 14: + case 16: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddStates(0, 2); + break; + case 20: + if ((jjbitVec0[i2] & l2) == 0L) + break; + if (kind > 3) + kind = 3; + jjstateSet[jjnewStateCnt++] = 20; + break; + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 31 - (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, +}; + +/** Token literal values. */ +public static final String[] jjstrLiteralImages = { +"", null, null, null, "\141\154\147\157\162\151\164\150\155", +"\144\151\163\143\162\145\164\145", "\146\141\154\163\145", "\155\157\144\145\154", +"\162\145\144\145\143\154\141\162\145", "\141\156\144", "\145\141\143\150", "\146\151\156\141\154", "\156\157\164", +"\162\145\160\154\141\143\145\141\142\154\145", "\141\156\156\157\164\141\164\151\157\156", "\145\154\163\145", +"\146\154\157\167", "\157\160\145\162\141\164\157\162", "\162\145\164\165\162\156", +"\141\163\163\145\162\164", "\145\154\163\145\151\146", "\146\157\162", "\157\162", +"\163\164\162\145\141\155", "\142\154\157\143\153", "\145\154\163\145\167\150\145\156", +"\146\165\156\143\164\151\157\156", "\157\165\164\145\162", "\164\150\145\156", "\142\162\145\141\153", +"\145\156\143\141\160\163\165\154\141\164\145\144", "\151\146", "\157\165\164\160\165\164", "\164\162\165\145", +"\143\154\141\163\163", "\145\156\144", "\151\155\160\157\162\164", "\160\141\143\153\141\147\145", +"\164\171\160\145", "\143\157\156\156\145\143\164", +"\145\156\165\155\145\162\141\164\151\157\156", "\151\156", "\160\141\162\141\155\145\164\145\162", "\167\150\145\156", +"\143\157\156\156\145\143\164\157\162", "\145\161\165\141\164\151\157\156", "\151\156\151\164\151\141\154", +"\160\141\162\164\151\141\154", "\167\150\151\154\145", "\143\157\156\163\164\141\156\164", +"\145\170\160\141\156\144\141\142\154\145", "\151\156\156\145\162", "\160\162\157\164\145\143\164\145\144", +"\167\151\164\150\151\156", "\143\157\156\163\164\162\141\151\156\145\144\142\171", +"\145\170\164\145\156\144\163", "\151\156\160\165\164", "\160\165\142\154\151\143", "\144\145\162", +"\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, +"\157\160\145\162\141\164\157\162\40\146\165\156\143\164\151\157\156", "\157\160\145\162\141\164\157\162\40\162\145\143\157\162\144", }; + +/** Lexer state names. */ +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0xfffffffffffffff1L, 0xffffffffL, +}; +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 StringBuilder jjimage = new StringBuilder(); +private StringBuilder image = jjimage; +private int jjimageLen; +private int lengthOfMatch; +protected char curChar; +/** Constructor. */ +public ModelParserTokenManager(SimpleCharStream stream){ + if (SimpleCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} + +/** Constructor. */ +public ModelParserTokenManager(SimpleCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} + +/** Reinitialise parser. */ +public void ReInit(SimpleCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 31; i-- > 0;) + jjrounds[i] = 0x80000000; +} + +/** Reinitialise parser. */ +public void ReInit(SimpleCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} + +/** Switch to specified lex state. */ +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind, curTokenImage); + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; +} + +int curLexState = 0; +int defaultLexState = 0; +int jjnewStateCnt; +int jjround; +int jjmatchedPos; +int jjmatchedKind; + +/** Get the next Token. */ +public Token getNextToken() +{ + Token matchedToken; + int curPos = 0; + + EOFLoop : + for (;;) + { + try + { + curChar = input_stream.BeginToken(); + } + catch(java.io.IOException e) + { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + return matchedToken; + } + image = jjimage; + image.setLength(0); + jjimageLen = 0; + + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + if (jjmatchedKind != 0x7fffffff) + { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + matchedToken = jjFillToken(); + TokenLexicalActions(matchedToken); + return matchedToken; + } + else + { + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { input_stream.readChar(); input_stream.backup(1); } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } + else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } +} + +void TokenLexicalActions(Token matchedToken) +{ + switch(jjmatchedKind) + { + case 91 : + image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))); + matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); + break; + default : + break; + } +} +private void jjCheckNAdd(int state) +{ + if (jjrounds[state] != jjround) + { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } +} +private void jjAddStates(int start, int end) +{ + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); +} +private void jjCheckNAddTwoStates(int state1, int state2) +{ + jjCheckNAdd(state1); + jjCheckNAdd(state2); +} + +private void jjCheckNAddStates(int start, int end) +{ + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); +} + +} diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelicaParser.jj b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelicaParser.jj new file mode 100644 index 00000000..cc155d08 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelicaParser.jj @@ -0,0 +1,634 @@ +options { + JDK_VERSION = "1.6"; + STATIC = false; +} + +PARSER_BEGIN(ModelParser) +package org.simantics.sysdyn.modelParser; + +public class ModelParser { + +} + +PARSER_END(ModelParser) + +/*** Lexer *********************************************************/ + +SKIP: +{ +| +| +} + +TOKEN: +{ +"algorithm" | "discrete" | "false" | "model" | "redeclare" +| "and" | "each" | "final" | "not" | "replaceable" +| "annotation" | "else" | "flow" | "operator" | "return" +|"assert" | "elseif" | "for" | "or" | "stream" +| "block" | "elsewhen" | "function" | "outer" | "then" +| "break" | "encapsulated" | "if" | "output" | "true" +| "class" | "end" | "import" | "package" | "type" +| "connect" | "enumeration" | "in" | "parameter" | "when" +| "connector" | "equation" | "initial" | "partial" | "while" +| "constant" | "expandable" | "inner" | "protected" | "within" +| "constrainedby" | "extends" | "input" | "public" +| "der" | "external" | "loop" | "record" +| "(" | ")" | "{" | "}" | "[" | "]" | "." | ":" | ";" | "," +| "<" | "<=" | ">" | ">=" | "==" | "<>" +| "+" | "-" | ".+" | ".-" +| "*" | "/" | ".*" | "./" +| "^" | ".^" +| "=" | ":=" +| +| + { matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); } +| +| "." ()? (["e","E"] )? + | "." (["e","E"] )? + | ["e","E"] + ) > +} + +/*** Parser ********************************************************/ + +// https://javacc.dev.java.net/doc/javaccgrm.html +// add_op -> add_op() +// [ add_op ] -> ( add_op() )? +// { add_op term } -> ( add_op() term() )* + +void parse() : { } { stored_definition() +} + +/*** Stored Definition - Within ************************************/ + +void stored_definition() : { +} { +// stored_definition: +// [ within [ name ] ";" ] +// { [ final ] class_definition ";" } + ( "within" ( name() )? ";" )? + ( ( "final" )? class_definition() ";" )* } +/*** Class Definition **********************************************/ + +void class_definition() : { +} { +// class_definition : +// [ encapsulated ] +// [ partial +// ] ( class modelrecordblock expandableconnectortype +// | | | | [ ] | | package | function | operator | operator function | operator record ) +// class_specifier + ( "encapsulated" )? + ( "partial" )? + ( "class" | "model" | "record" | "block" | ( "expandable" )? "connector" | "type" | + "package" | "function" | "operator" | "operator function" | "operator record" ) + class_specifier() } + + +void class_specifier() : { +} { +// class_specifier : +// IDENT string_comment composition end IDENT +// | IDENT "=" base_prefix name [ array_subscripts ] +// [ class_modification ] comment +// | IDENT "=" enumeration "(" ( [enum_list] | ":" ) ")" comment +// | IDENT "=" der "(" name "," IDENT { "," IDENT } ")" comment +// | extends IDENT [ class_modification ] string_comment composition +// end IDENT + LOOKAHEAD(2) string_comment() composition() "end" + | LOOKAHEAD(2) "=" base_prefix() name() ( array_subscripts() )? ( class_modification() )? comment() + | LOOKAHEAD(3) "=" "enumeration" "(" ( ( enum_list() )? | ":" ) ")" comment() + |LOOKAHEAD(3) "=" "der" "(" name() "," ( "," )* ")" comment() + | "extends" ( class_modification() )? string_comment() composition() "end" +} + +void base_prefix() : { +} { + type_prefix() +} + +void enum_list() : { +} { +// enumeration_literal { "," enumeration_literal} + enumeration_literal() ( "," enumeration_literal() )* +} + +void enumeration_literal() : { +} { + comment() +} + +void parse_composition() : { +} { + composition() +} + +void composition() : { +} { +// element_list +// { public element_list | +// protected element_list | +// equation_section | +// algorithm_section +// } +// [ external [ language_specification ] +// [ external_function_call ] [ annotation ] ";" ] +// [ annotation ";" ] + element_list() + ( LOOKAHEAD(2) "public" element_list() | "protected" element_list() | equation_section() | algorithm_section() )* + ( "external" ( language_specification() )? ( external_function_call() )? ( annotation() )? ";" )? + ( annotation() ";" )? } + +void language_specification() : { +} { + +} + +void external_function_call() : { +} { +// [ component_reference "=" ] +// IDENT "(" [ expression_list ] ")" + ( component_reference() "=" )? + "(" ( expression_list() )? ")" } + +void element_list() : { +} { + ( element() ";" )* } + +void element() : { +} { +// import_clause | +// extends_clause | +// [ redeclare ] +// [ final ] +// [ inner ] [ outer ] +// ( ( class_definition | component_clause) | +// replaceable ( class_definition | component_clause) +// [constraining_clause comment]) + import_clause() | + extends_clause() | + ( "redeclare" )? + ( "final" )? + ( "inner" )? ( "outer" )? + ( (class_definition() | component_clause()) | + "replaceable" (class_definition() | component_clause()) + (constraining_clause() comment())?) } + +void import_clause() : { +} { +// import ( IDENT "=" name | name ["." "*"] ) comment + "import" (LOOKAHEAD(2) "=" name() | name() ("." "*")? ) comment() +} + +/*** Extends *******************************************************/ +void extends_clause() : { +} { +// extends name [ class_modification ] [annotation] + "extends" name() ( class_modification() )? ( annotation() )? +} + +void constraining_clause() : { +} { +// constrainedby name [ class_modification ] + "constrainedby" name() ( class_modification() )? +} + +/*** Component Clause **********************************************/ +void component_clause() : { +} { +// type_prefix type_specifier [ array_subscripts ] component_list + type_prefix() type_specifier() ( array_subscripts() )? component_list() +} + +void type_prefix() : { +} { +// [ flow | stream ] +// [ discrete | parameter | constant ] [ input | output ] + ( "flow" | "stream" )? + ( "discrete" | "parameter" | "constant" )? ( "input" | "output" )? } + +void type_specifier() : { +} { + name() +} + +void component_list() : { +} { +// component_declaration { "," component_declaration } + component_declaration() ( "," component_declaration() )* +} + +void component_declaration() : { +} { +// declaration [ conditional_attribute ] comment + declaration() ( conditional_attribute() )? comment() +} + +void conditional_attribute() : { +} { + "if" expression() +} + +void declaration() : { +} { +// IDENT [ array_subscripts ] [ modification ] + ( array_subscripts() )? ( modification() )? +} + +/*** Modification **********************************************/ +void modification() : { +} { +// class_modification [ "=" expression ] +// | "=" expression +// | ":=" expression + class_modification() ( "=" expression() )? + | "=" expression() + | ":=" expression() +} + +void class_modification() : { +} { +// "(" [ argument_list ] ")" + "(" ( argument_list() )? ")" +} + +void argument_list() : { +} { +// argument { "," argument } + argument() ( "," argument() )* +} + +void argument() : { +} { +// element_modification_or_replaceable +// | element_redeclaration + element_modification_or_replaceable() | + element_redeclaration() +} + +void element_modification_or_replaceable() : { +} { +// [ each ] [ final ] ( element_modification | element_replaceable) + ( "each" )? ( "final" )? ( element_modification() | element_replaceable() ) } + +void element_modification() : { +} { +// name [ modification ] string_comment + name() ( modification() )? string_comment() +} + +void element_redeclaration() : { +} { +// redeclare [ each ] [ final ] +// ( ( class_definition | component_clause1) | element_replaceable ) + "redeclare" ( "each" )? ( "final" )? + ( ( class_definition() | component_clause1() ) | element_replaceable() ) } + +void element_replaceable() : { +} { +// replaceable ( class_definition | component_clause1) +// [constraining_clause] + "replaceable" ( class_definition() | component_clause1() ) ( constraining_clause() )? +} + +void component_clause1() : { +} { +// type_prefix type_specifier component_declaration1 + type_prefix() type_specifier() component_declaration1() +} + +void component_declaration1() : { +} { + declaration() comment() +} + + +/*** Equations *************************************************/ +void equation_section() : { +} { +// [ initial ] equation { equation ";" } + ( "initial" )? "equation" ( equation() ";" )* +} + +void algorithm_section() : { +} { +// [ initial ] algorithm { statement ";" } + ( "initial" )? "algorithm" ( statement() ";" )* } + +void equation() : { +} { +// ( simple_expression "=" expression +// | if_equation +// | for_equation +// | connect_clause +// | when_equation +// | IDENT function_call_args ) +// comment + ( LOOKAHEAD(3) simple_expression() "=" expression() + | if_equation() + | for_equation() + | connect_clause() + | when_equation() + | function_call_args() ) + comment() } + +void statement() : { +} { +// ( component_reference ( ":=" expression | function_call_args ) +// | "(" output_expression_list ")" ":=" component_reference function_call_args +// | break +// | return +// | if_statement +// | for_statement +// | while_statement +// | when_statement ) +// comment + ( component_reference() ( ":=" expression() | function_call_args() ) + | "(" output_expression_list() ")" ":=" component_reference() function_call_args() + | "break" + | "return" + | if_statement() + | for_statement() + | while_statement() + | when_statement() ) + comment() +} + +void if_equation() : { +} { +// if expression then +// { equation ";" } +// { elseif expression then +// { equation ";" } +// } +// [ else +// { equation ";" } +// ] +// end if + "if" expression() "then" + ( equation() ";" )* + ( "elseif" expression() "then" + ( equation() ";" )* + )* + ( "else" + ( equation() ";" )* + )? + "end" "if" } + +void if_statement() : { +} { +// if expression then +// { statement ";" } +// { elseif expression then +// { statement ";" } +// } +// [ else +// { statement ";" } +// ] +// end if + "if" expression() "then" + ( statement() ";" )* + ( "elseif" expression() "then" + ( statement() ";" )* + )* + ( "else" + ( statement() ";" )* + )? + "end" "if" } + +void for_equation() : { +} { +// for for_indices loop +// { equation ";" } +// end for + "for" for_indices() "loop" + ( equation() ";" )* + "end" "for" } + +void for_statement() : { +} { +// for for_indices loop +// { equation ";" } +// end for + "for" for_indices() "loop" + ( statement() ";" )* + "end" "for" } + +void for_indices() : { +} { + //for_index {"," for_index} + for_index() ("," for_index())* +} + +void for_index() : { +} { + //IDENT [ in expression ] + ( "in" expression() )? +} + +void while_statement() : { +} { +// while expression loop +// { statement ";" } +// end while + "while" expression() "loop" + ( statement() ";" )* + "end" "while" } + +void when_equation() : { +} { +// when expression then +// { equation ";" } +// { elsewhen expression then +// { equation ";" } } +// end when + "when" expression() "then" + ( equation() ";" )* + ( "elsewhen" expression() "then" + ( equation() ";" )* + )* + "end" "when" } + +void when_statement() : { +} { +// when expression then +// { statement ";" } +// { elsewhen expression then +// { statement ";" } } +// end when + "when" expression() "then" + ( statement() ";" )* + ( "elsewhen" expression() "then" + ( statement() ";" )* + )* + "end" "when" } + +void connect_clause() : { +} { +// connect "(" component_reference "," component_reference ")" + "connect" "(" component_reference() "," component_reference() ")" +} + +/*** Expressions ***************************************************/ +void expr() : { +} { + simple_expression() + | + "if" expression() "then" expression() ( "elseif" expression() "then" expression() )* + "else" expression() +} + +void expression() : { +} { + simple_expression() + | "if" expression() "then" expression() ( "elseif" expression() "then" expression() )* + "else" expression() +} + +void simple_expression() : { +} { + logical_expression() ( ":" logical_expression() ( ":" logical_expression() )? )? +} + +void logical_expression() : { +} { + logical_term() ( "or" logical_term() )* +} + +void logical_term() : { +} { + logical_factor() ( "and" logical_factor() )* +} + +void logical_factor() : { +} { + ( "not" )? relation() +} + +void relation() : { +} { + arithmetic_expression() ( rel_op() arithmetic_expression() )? +} + +void rel_op() : { +} { + "<" | "<=" | ">" | ">=" | "==" | "<>" +} + +void arithmetic_expression() : { +} { + (add_op())? term() (add_op() term())* +} + +void add_op() : { +} { + "+" | "-" | ".+" | ".-" +} + +void term() : { +} { + factor() ( mul_op() factor() )* +} + +void mul_op() : { +} { + "*" | "/" | ".*" | "./" +} + +void factor() : { +} { + primary() ( "^" | ".^" primary() )? +} + +void primary() : { +} { + + | + | + | "false" + | "true" + | LOOKAHEAD( (name()|"der"|"initial") "(" ) (name()|"der"|"initial") function_call_args() + | component_reference() + | "(" output_expression_list() ")" + | "[" expression_list() ( ";" expression_list() )* "]" + | "{" function_arguments() "}" + | "end" +} + +void name() : { +} { +// [ "." ] IDENT { "." IDENT } + ( "." )? ( "." )* +} + +void component_reference() : { +} { +// [ "." ] IDENT [ array_subscripts ] { "." IDENT [ array_subscripts ] } + ( "." )? ( array_subscripts() )? ( "." ( array_subscripts() )? )* +} + +void function_call_args() : { +} { +// "(" [ function_arguments ] ")" + "(" ( function_arguments() )? ")" +} + +void function_arguments() : { +} { + //expression [ "," function_arguments | for for_indices ] + //| named_arguments + LOOKAHEAD(2) expression() ( "," function_arguments() | "for" for_indices() )? + | named_arguments() +} + +void named_arguments() : { +} { +// named_argument [ "," named_arguments ] + named_argument() ( "," named_arguments() )? +} + +void named_argument() : { +} { + "=" expression() +} + +void output_expression_list() : { +} { +// [ expression ] { "," [ expression ] } + ( expression() )? ( "," ( expression() )? )* +} + +void expression_list() : { +} { +// expression { "," expression } + expression() ( "," expression() )* +} + +void array_subscripts() : { +} { +// "[" subscript { "," subscript } "]" + "[" subscript() ( "," subscript() )* "]" +} + +void subscript() : { +} { +// ":" | expression ":" | expression() +} + +void comment() : { } { // string_comment [ annotation ] + string_comment() ( annotation() )? +} + +void string_comment() : { +} { +// [ STRING { "+" STRING } ] + ( ( "+" )* )? } + +void annotation() : { +} { +// annotation class_modification + "annotation" class_modification() +} + diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ParseException.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ParseException.java new file mode 100644 index 00000000..86734a78 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ParseException.java @@ -0,0 +1,187 @@ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ +/* JavaCCOptions:KEEP_LINE_COL=null */ +package org.simantics.sysdyn.modelParser; + +/** + * This exception is thrown when parse errors are encountered. + * You can explicitly create objects of this exception type by + * calling the method generateParseException in the generated + * parser. + * + * You can modify this class to customize your error reporting + * mechanisms so long as you retain the public fields. + */ +public class ParseException extends Exception { + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * This constructor is used by the method "generateParseException" + * in the generated parser. Calling this constructor generates + * a new object of this type with the fields "currentToken", + * "expectedTokenSequences", and "tokenImage" set. + */ + public ParseException(Token currentTokenVal, + int[][] expectedTokenSequencesVal, + String[] tokenImageVal + ) + { + super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); + currentToken = currentTokenVal; + expectedTokenSequences = expectedTokenSequencesVal; + tokenImage = tokenImageVal; + } + + /** + * The following constructors are for use by you for whatever + * purpose you can think of. Constructing the exception in this + * manner makes the exception behave in the normal way - i.e., as + * documented in the class "Throwable". The fields "errorToken", + * "expectedTokenSequences", and "tokenImage" do not contain + * relevant information. The JavaCC generated code does not use + * these constructors. + */ + + public ParseException() { + super(); + } + + /** Constructor with message. */ + public ParseException(String message) { + super(message); + } + + + /** + * This is the last token that has been consumed successfully. If + * this object has been created due to a parse error, the token + * followng this token will (therefore) be the first error token. + */ + public Token currentToken; + + /** + * Each entry in this array is an array of integers. Each array + * of integers represents a sequence of tokens (by their ordinal + * values) that is expected at this point of the parse. + */ + public int[][] expectedTokenSequences; + + /** + * This is a reference to the "tokenImage" array of the generated + * parser within which the parse error occurred. This array is + * defined in the generated ...Constants interface. + */ + public String[] tokenImage; + + /** + * It uses "currentToken" and "expectedTokenSequences" to generate a parse + * error message and returns it. If this object has been created + * due to a parse error, and you do not catch it (it gets thrown + * from the parser) the correct error message + * gets displayed. + */ + private static String initialise(Token currentToken, + int[][] expectedTokenSequences, + String[] tokenImage) { + String eol = System.getProperty("line.separator", "\n"); + StringBuffer expected = new StringBuffer(); + int maxSize = 0; + for (int i = 0; i < expectedTokenSequences.length; i++) { + if (maxSize < expectedTokenSequences[i].length) { + maxSize = expectedTokenSequences[i].length; + } + for (int j = 0; j < expectedTokenSequences[i].length; j++) { + expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); + } + if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { + expected.append("..."); + } + expected.append(eol).append(" "); + } + String retval = "Encountered \""; + Token tok = currentToken.next; + for (int i = 0; i < maxSize; i++) { + if (i != 0) retval += " "; + if (tok.kind == 0) { + retval += tokenImage[0]; + break; + } + retval += " " + tokenImage[tok.kind]; + retval += " \""; + retval += add_escapes(tok.image); + retval += " \""; + tok = tok.next; + } + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; + } else { + retval += "Was expecting one of:" + eol + " "; + } + retval += expected.toString(); + return retval; + } + + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); + + /** + * Used to convert raw characters to their escaped version + * when these raw version cannot be used as part of an ASCII + * string literal. + */ + static String add_escapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + +} +/* JavaCC - OriginalChecksum=e46c56bfa832359193465f81e8a2147e (do not edit this line) */ diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/SimpleCharStream.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/SimpleCharStream.java new file mode 100644 index 00000000..102b285e --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/SimpleCharStream.java @@ -0,0 +1,471 @@ +/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ +/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package org.simantics.sysdyn.modelParser; + +/** + * An implementation of interface CharStream, where the stream is assumed to + * contain only ASCII characters (without unicode processing). + */ + +public class SimpleCharStream +{ +/** Whether parser is static. */ + public static final boolean staticFlag = false; + int bufsize; + int available; + int tokenBegin; +/** Position in buffer. */ + public int bufpos = -1; + protected int bufline[]; + protected int bufcolumn[]; + + protected int column = 0; + protected int line = 1; + + protected boolean prevCharIsCR = false; + protected boolean prevCharIsLF = false; + + protected java.io.Reader inputStream; + + protected char[] buffer; + protected int maxNextCharInd = 0; + protected int inBuf = 0; + protected int tabSize = 8; + + protected void setTabSize(int i) { tabSize = i; } + protected int getTabSize(int i) { return tabSize; } + + + protected void ExpandBuff(boolean wrapAround) + { + char[] newbuffer = new char[bufsize + 2048]; + int newbufline[] = new int[bufsize + 2048]; + int newbufcolumn[] = new int[bufsize + 2048]; + + try + { + if (wrapAround) + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos += (bufsize - tokenBegin)); + } + else + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos -= tokenBegin); + } + } + catch (Throwable t) + { + throw new Error(t.getMessage()); + } + + + bufsize += 2048; + available = bufsize; + tokenBegin = 0; + } + + protected void FillBuff() throws java.io.IOException + { + if (maxNextCharInd == available) + { + if (available == bufsize) + { + if (tokenBegin > 2048) + { + bufpos = maxNextCharInd = 0; + available = tokenBegin; + } + else if (tokenBegin < 0) + bufpos = maxNextCharInd = 0; + else + ExpandBuff(false); + } + else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + + int i; + try { + if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) + { + inputStream.close(); + throw new java.io.IOException(); + } + else + maxNextCharInd += i; + return; + } + catch(java.io.IOException e) { + --bufpos; + backup(0); + if (tokenBegin == -1) + tokenBegin = bufpos; + throw e; + } + } + +/** Start. */ + public char BeginToken() throws java.io.IOException + { + tokenBegin = -1; + char c = readChar(); + tokenBegin = bufpos; + + return c; + } + + protected void UpdateLineColumn(char c) + { + column++; + + if (prevCharIsLF) + { + prevCharIsLF = false; + line += (column = 1); + } + else if (prevCharIsCR) + { + prevCharIsCR = false; + if (c == '\n') + { + prevCharIsLF = true; + } + else + line += (column = 1); + } + + switch (c) + { + case '\r' : + prevCharIsCR = true; + break; + case '\n' : + prevCharIsLF = true; + break; + case '\t' : + column--; + column += (tabSize - (column % tabSize)); + break; + default : + break; + } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + +/** Read a character. */ + public char readChar() throws java.io.IOException + { + if (inBuf > 0) + { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + return buffer[bufpos]; + } + + if (++bufpos >= maxNextCharInd) + FillBuff(); + + char c = buffer[bufpos]; + + UpdateLineColumn(c); + return c; + } + + @Deprecated + /** + * @deprecated + * @see #getEndColumn + */ + + public int getColumn() { + return bufcolumn[bufpos]; + } + + @Deprecated + /** + * @deprecated + * @see #getEndLine + */ + + public int getLine() { + return bufline[bufpos]; + } + + /** Get token end column number. */ + public int getEndColumn() { + return bufcolumn[bufpos]; + } + + /** Get token end line number. */ + public int getEndLine() { + return bufline[bufpos]; + } + + /** Get token beginning column number. */ + public int getBeginColumn() { + return bufcolumn[tokenBegin]; + } + + /** Get token beginning line number. */ + public int getBeginLine() { + return bufline[tokenBegin]; + } + +/** Backup a number of characters. */ + public void backup(int amount) { + + inBuf += amount; + if ((bufpos -= amount) < 0) + bufpos += bufsize; + } + + /** Constructor. */ + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + + /** Constructor. */ + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + + /** Constructor. */ + public SimpleCharStream(java.io.Reader dstream) + { + this(dstream, 1, 1, 4096); + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + if (buffer == null || buffersize != buffer.length) + { + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + bufpos = -1; + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader dstream) + { + ReInit(dstream, 1, 1, 4096); + } + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, startline, startcolumn, 4096); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, 1, 1, 4096); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream) + { + this(dstream, 1, 1, 4096); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, 1, 1, 4096); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream) + { + ReInit(dstream, 1, 1, 4096); + } + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, startline, startcolumn, 4096); + } + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } + /** Get token literal value. */ + public String GetImage() + { + if (bufpos >= tokenBegin) + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); + else + return new String(buffer, tokenBegin, bufsize - tokenBegin) + + new String(buffer, 0, bufpos + 1); + } + + /** Get the suffix. */ + public char[] GetSuffix(int len) + { + char[] ret = new char[len]; + + if ((bufpos + 1) >= len) + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); + else + { + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, + len - bufpos - 1); + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); + } + + return ret; + } + + /** Reset buffer when finished. */ + public void Done() + { + buffer = null; + bufline = null; + bufcolumn = null; + } + + /** + * Method to adjust line and column numbers for the start of a token. + */ + public void adjustBeginLineColumn(int newLine, int newCol) + { + int start = tokenBegin; + int len; + + if (bufpos >= tokenBegin) + { + len = bufpos - tokenBegin + inBuf + 1; + } + else + { + len = bufsize - tokenBegin + bufpos + 1 + inBuf; + } + + int i = 0, j = 0, k = 0; + int nextColDiff = 0, columnDiff = 0; + + while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) + { + bufline[j] = newLine; + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; + bufcolumn[j] = newCol + columnDiff; + columnDiff = nextColDiff; + i++; + } + + if (i < len) + { + bufline[j] = newLine++; + bufcolumn[j] = newCol + columnDiff; + + while (i++ < len) + { + if (bufline[j = start % bufsize] != bufline[++start % bufsize]) + bufline[j] = newLine++; + else + bufline[j] = newLine; + } + } + + line = bufline[j]; + column = bufcolumn[j]; + } + +} +/* JavaCC - OriginalChecksum=7ab7faca15b64bda32c7a4effb209066 (do not edit this line) */ diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/Token.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/Token.java new file mode 100644 index 00000000..25d36184 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/Token.java @@ -0,0 +1,131 @@ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package org.simantics.sysdyn.modelParser; + +/** + * Describes the input token stream. + */ + +public class Token implements java.io.Serializable { + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * An integer that describes the kind of this token. This numbering + * system is determined by JavaCCParser, and a table of these numbers is + * stored in the file ...Constants.java. + */ + public int kind; + + /** The line number of the first character of this Token. */ + public int beginLine; + /** The column number of the first character of this Token. */ + public int beginColumn; + /** The line number of the last character of this Token. */ + public int endLine; + /** The column number of the last character of this Token. */ + public int endColumn; + + /** + * The string image of the token. + */ + public String image; + + /** + * A reference to the next regular (non-special) token from the input + * stream. If this is the last token from the input stream, or if the + * token manager has not read tokens beyond this one, this field is + * set to null. This is true only if this token is also a regular + * token. Otherwise, see below for a description of the contents of + * this field. + */ + public Token next; + + /** + * This field is used to access special tokens that occur prior to this + * token, but after the immediately preceding regular (non-special) token. + * If there are no such special tokens, this field is set to null. + * When there are more than one such special token, this field refers + * to the last of these special tokens, which in turn refers to the next + * previous special token through its specialToken field, and so on + * until the first special token (whose specialToken field is null). + * The next fields of special tokens refer to other special tokens that + * immediately follow it (without an intervening regular token). If there + * is no such token, this field is null. + */ + public Token specialToken; + + /** + * An optional attribute value of the Token. + * Tokens which are not used as syntactic sugar will often contain + * meaningful values that will be used later on by the compiler or + * interpreter. This attribute value is often different from the image. + * Any subclass of Token that actually wants to return a non-null value can + * override this method as appropriate. + */ + public Object getValue() { + return null; + } + + /** + * No-argument constructor + */ + public Token() {} + + /** + * Constructs a new token for the specified Image. + */ + public Token(int kind) + { + this(kind, null); + } + + /** + * Constructs a new token for the specified Image and Kind. + */ + public Token(int kind, String image) + { + this.kind = kind; + this.image = image; + } + + /** + * Returns the image. + */ + public String toString() + { + return image; + } + + /** + * Returns a new Token object, by default. However, if you want, you + * can create and return subclass objects based on the value of ofKind. + * Simply add the cases to the switch for all those special cases. + * For example, if you have a subclass of Token called IDToken that + * you want to create if ofKind is ID, simply add something like : + * + * case MyParserConstants.ID : return new IDToken(ofKind, image); + * + * to the following switch statement. Then you can cast matchedToken + * variable to the appropriate type and use sit in your lexical actions. + */ + public static Token newToken(int ofKind, String image) + { + switch(ofKind) + { + default : return new Token(ofKind, image); + } + } + + public static Token newToken(int ofKind) + { + return newToken(ofKind, null); + } + +} +/* JavaCC - OriginalChecksum=8584b8a0988c627589640a007dbfe0bb (do not edit this line) */ diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/TokenMgrError.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/TokenMgrError.java new file mode 100644 index 00000000..60c67454 --- /dev/null +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/TokenMgrError.java @@ -0,0 +1,147 @@ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ +/* JavaCCOptions: */ +package org.simantics.sysdyn.modelParser; + +/** Token Manager Error. */ +public class TokenMgrError extends Error +{ + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ + + /** + * Lexical error occurred. + */ + static final int LEXICAL_ERROR = 0; + + /** + * An attempt was made to create a second instance of a static token manager. + */ + static final int STATIC_LEXER_ERROR = 1; + + /** + * Tried to change to an invalid lexical state. + */ + static final int INVALID_LEXICAL_STATE = 2; + + /** + * Detected (and bailed out of) an infinite loop in the token manager. + */ + static final int LOOP_DETECTED = 3; + + /** + * Indicates the reason why the exception is thrown. It will have + * one of the above 4 values. + */ + int errorCode; + + /** + * Replaces unprintable characters by their escaped (or unicode escaped) + * equivalents in the given string + */ + protected static final String addEscapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + + /** + * Returns a detailed message for the Error when it is thrown by the + * token manager to indicate a lexical error. + * Parameters : + * EOFSeen : indicates if EOF caused the lexical error + * curLexState : lexical state in which this error occurred + * errorLine : line number when the error occurred + * errorColumn : column number when the error occurred + * errorAfter : prefix that was seen before this error occurred + * curchar : the offending character + * Note: You can customize the lexical error message by modifying this method. + */ + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); + } + + /** + * You can also modify the body of this method to customize your error messages. + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not + * of end-users concern, so you can return something like : + * + * "Internal Error : Please file a bug report .... " + * + * from this method for such cases in the release version of your parser. + */ + public String getMessage() { + return super.getMessage(); + } + + /* + * Constructors of various flavors follow. + */ + + /** No arg constructor. */ + public TokenMgrError() { + } + + /** Constructor with message and reason. */ + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } + + /** Full Constructor. */ + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } +} +/* JavaCC - OriginalChecksum=d047fc9c0c00c40e4d34a354929bb60c (do not edit this line) */ -- 2.47.1