From: lempinen Date: Thu, 28 Feb 2013 09:31:45 +0000 (+0000) Subject: Replaced "(" output_expression_list() ")" with "(" expression() ")". This allows... X-Git-Tag: simantics-1.10.1~17 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=18496d72fc9d66ee9968812e52f51f6f7ddf8579;p=simantics%2Fsysdyn.git Replaced "(" output_expression_list() ")" with "(" expression() ")". This allows equations like (1+2)^(1+1) but does not allow tuples (1,2,3)^(,,,). (fixes #3942) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26939 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java index f833fdbd..5f51ebba 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.java @@ -436,7 +436,7 @@ public class ExpressionParser implements ExpressionParserConstants { break; case 60: jj_consume_token(60); - output_expression_list(); + expression(); jj_consume_token(61); break; case 64: @@ -880,12 +880,6 @@ void named_arguments() : { finally { jj_save(2, xla); } } - private boolean jj_3R_14() { - if (jj_scan_token(66)) return true; - if (jj_3R_12()) return true; - return false; - } - private boolean jj_3R_13() { if (jj_scan_token(IDENT)) return true; if (jj_scan_token(86)) return true; @@ -917,6 +911,12 @@ void named_arguments() : { return false; } + private boolean jj_3R_14() { + if (jj_scan_token(66)) return true; + if (jj_3R_12()) return true; + return false; + } + /** Generated Token Manager. */ public ExpressionParserTokenManager token_source; SimpleCharStream jj_input_stream; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.jj b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.jj index d8cdfc46..722c0911 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.jj +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.jj @@ -205,7 +205,8 @@ void primary() : { name() function_call_args() { functionCall = null; } | component_reference(null) - | "(" output_expression_list() ")" + /*| "(" output_expression_list() ")"*/ // Not needed, replaced with following: + | "(" expression() ")" | "[" expression_list() ( ";" expression_list() )* "]" | "{" function_arguments() "}" | "end" diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParser.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParser.java index ee3f2c7c..3933d5e3 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParser.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelParser.java @@ -2251,7 +2251,7 @@ public class ModelParser implements ModelParserConstants { break; case 62: jj_consume_token(62); - output_expression_list(); + expression(); jj_consume_token(63); break; case 66: @@ -2705,13 +2705,6 @@ public class ModelParser implements ModelParserConstants { 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_50() { if (jj_scan_token(59)) return true; return false; @@ -2758,29 +2751,21 @@ public class ModelParser implements ModelParserConstants { return false; } - private boolean jj_3R_130() { - if (jj_3R_45()) return true; - return false; - } - - private boolean jj_3R_122() { - if (jj_scan_token(71)) return true; - Token xsp; - xsp = jj_scanpos; - if (jj_3R_126()) jj_scanpos = xsp; - return false; - } - - private boolean jj_3R_128() { + private boolean jj_3R_124() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(69)) { jj_scanpos = xsp; - if (jj_3R_130()) return true; + if (jj_3R_126()) return true; } return false; } + private boolean jj_3R_120() { + if (jj_scan_token(71)) return true; + return false; + } + private boolean jj_3R_91() { Token xsp; xsp = jj_scanpos; @@ -2789,18 +2774,13 @@ public class ModelParser implements ModelParserConstants { return false; } - private boolean jj_3R_123() { - if (jj_scan_token(71)) return true; - return false; - } - - private boolean jj_3R_125() { + private boolean jj_3R_122() { if (jj_scan_token(66)) return true; - if (jj_3R_128()) return true; + if (jj_3R_124()) return true; return false; } - private boolean jj_3R_120() { + private boolean jj_3R_119() { if (jj_scan_token(68)) return true; if (jj_scan_token(IDENT)) return true; return false; @@ -2821,29 +2801,19 @@ public class ModelParser implements ModelParserConstants { return false; } - private boolean jj_3R_121() { - if (jj_3R_45()) return true; - return false; - } - - private boolean jj_3R_115() { + private boolean jj_3R_114() { if (jj_3R_45()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_123()) { jj_scanpos = xsp; break; } + if (jj_3R_120()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_114() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_121()) jj_scanpos = xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_122()) { jj_scanpos = xsp; break; } - } + private boolean jj_3R_125() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; return false; } @@ -2861,12 +2831,6 @@ public class ModelParser implements ModelParserConstants { return false; } - private boolean jj_3R_129() { - if (jj_scan_token(IDENT)) return true; - if (jj_scan_token(88)) return true; - return false; - } - private boolean jj_3_2() { if (jj_scan_token(IDENT)) return true; if (jj_scan_token(88)) return true; @@ -2881,18 +2845,18 @@ public class ModelParser implements ModelParserConstants { return false; } - private boolean jj_3R_127() { - if (jj_3R_129()) return true; + private boolean jj_3R_123() { + if (jj_3R_125()) return true; return false; } - private boolean jj_3R_119() { - if (jj_3R_125()) return true; + private boolean jj_3R_118() { + if (jj_3R_122()) return true; return false; } - private boolean jj_3R_124() { - if (jj_3R_127()) return true; + private boolean jj_3R_121() { + if (jj_3R_123()) return true; return false; } @@ -2901,12 +2865,12 @@ public class ModelParser implements ModelParserConstants { return false; } - private boolean jj_3R_117() { + private boolean jj_3R_116() { Token xsp; xsp = jj_scanpos; if (jj_3_9()) { jj_scanpos = xsp; - if (jj_3R_124()) return true; + if (jj_3R_121()) return true; } return false; } @@ -2919,8 +2883,8 @@ public class ModelParser implements ModelParserConstants { return false; } - private boolean jj_3R_118() { - if (jj_3R_117()) return true; + private boolean jj_3R_117() { + if (jj_3R_116()) return true; return false; } @@ -2928,7 +2892,7 @@ public class ModelParser implements ModelParserConstants { if (jj_scan_token(62)) return true; Token xsp; xsp = jj_scanpos; - if (jj_3R_118()) jj_scanpos = xsp; + if (jj_3R_117()) jj_scanpos = xsp; if (jj_scan_token(63)) return true; return false; } @@ -2980,15 +2944,15 @@ public class ModelParser implements ModelParserConstants { if (jj_scan_token(68)) jj_scanpos = xsp; if (jj_scan_token(IDENT)) return true; xsp = jj_scanpos; - if (jj_3R_119()) jj_scanpos = xsp; + if (jj_3R_118()) jj_scanpos = xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_120()) { jj_scanpos = xsp; break; } + if (jj_3R_119()) { jj_scanpos = xsp; break; } } return false; } - private boolean jj_3R_116() { + private boolean jj_3R_115() { if (jj_scan_token(70)) return true; return false; } @@ -3058,31 +3022,31 @@ public class ModelParser implements ModelParserConstants { private boolean jj_3R_109() { if (jj_scan_token(64)) return true; - if (jj_3R_117()) return true; + if (jj_3R_116()) return true; if (jj_scan_token(65)) return true; return false; } - private boolean jj_3R_104() { - if (jj_scan_token(56)) return true; - return false; - } - private boolean jj_3R_108() { if (jj_scan_token(66)) return true; - if (jj_3R_115()) return true; + if (jj_3R_114()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_116()) { jj_scanpos = xsp; break; } + if (jj_3R_115()) { jj_scanpos = xsp; break; } } if (jj_scan_token(67)) return true; return false; } + private boolean jj_3R_104() { + if (jj_scan_token(56)) return true; + return false; + } + private boolean jj_3R_107() { if (jj_scan_token(62)) return true; - if (jj_3R_114()) return true; + if (jj_3R_45()) return true; if (jj_scan_token(63)) return true; return false; } @@ -3537,6 +3501,13 @@ public class ModelParser implements ModelParserConstants { return false; } + private boolean jj_3R_41() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_48()) jj_scanpos = xsp; + return false; + } + /** Generated Token Manager. */ public ModelParserTokenManager token_source; SimpleCharStream jj_input_stream; diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelicaParser.jj b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelicaParser.jj index dfd52941..8cf3a5b7 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelicaParser.jj +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelParser/ModelicaParser.jj @@ -638,7 +638,8 @@ void primary() : { | "true" | LOOKAHEAD( (name()|"der"|"initial") "(" ) (name()|"der"|"initial") function_call_args() | component_reference() - | "(" output_expression_list() ")" + /* | "(" output_expression_list() ")" */ // Not needed, replaced with following: + | "(" expression() ")" | "[" expression_list() ( ";" expression_list() )* "]" | "{" function_arguments() "}" | "end"