From: lempinen Date: Tue, 16 Feb 2010 13:23:58 +0000 (+0000) Subject: Configuration name parsing, equation view tweak and ( ) in modelica expression synta... X-Git-Tag: simantics-1.0~71 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=6c85cc1e3a69ed8fbcaa9a2a9c49c93fdf5bfc28;p=simantics%2Fsysdyn.git Configuration name parsing, equation view tweak and ( ) in modelica expression syntax check git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@14152 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/EquationView.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/EquationView.java index b924cb35..1e835328 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/EquationView.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/equation/EquationView.java @@ -70,7 +70,6 @@ public class EquationView extends ViewPart implements ISelectionListener { // Dummies //Composite range; - Composite emptyComposite; @Override public void createPartControl(Composite parent) { @@ -108,7 +107,7 @@ public class EquationView extends ViewPart implements ISelectionListener { }; getViewSite().getPage().addPartListener(focusLostListener); - GridLayoutFactory.fillDefaults().numColumns(5).margins(3, 3).applyTo(parent); + GridLayoutFactory.fillDefaults().numColumns(4).margins(3, 3).applyTo(parent); @@ -133,11 +132,6 @@ public class EquationView extends ViewPart implements ISelectionListener { GridDataFactory.fillDefaults().span(1, 4).applyTo(shortcutTabs); addVariableTableListeners(); - // Right side of the view: Details, comments - emptyComposite = new Composite(parent, SWT.NONE); - GridDataFactory.fillDefaults().span(1,4).grab(true, true).applyTo(emptyComposite); - GridLayoutFactory.fillDefaults().applyTo(emptyComposite); - // Below variable name: Equation expressionComposite = new ExpressionComposite(parent, SWT.NONE); GridDataFactory.fillDefaults().span(3, 1).grab(true, true).applyTo(expressionComposite); 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 426ce0c5..14c4e66e 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.jj +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/expressionParser/ExpressionParser.jj @@ -139,7 +139,7 @@ void primary() : { | "true" | LOOKAHEAD( name() "(" ) name() function_call_args() | component_reference() - // | "(" output_expression_list() ")" + | "(" output_expression_list() ")" | "[" expression_list() ( ";" expression_list() )* "]" //| "{" function_arguments() "}" | "end" @@ -189,6 +189,12 @@ void named_argument() : { "=" expression() } +void output_expression_list() : { +} { + ( expression() )? ( "," ( expression() )? )* +} + + void expression_list() : { } { expression() ( "," expression() )* diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java index 280c59b6..a1bf5782 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/modelica/ModelicaWriter.java @@ -16,7 +16,7 @@ public class ModelicaWriter { public void write(Configuration conf) { conf.update(); - b.append("model ").append(conf.name).append('\n'); + b.append("model ").append(conf.name.replace(" ", "")).append('\n'); for(IElement element : conf.elements) if(element instanceof Variable) { IExpression expr = ((Variable)element).expression; @@ -50,7 +50,7 @@ public class ModelicaWriter { if (app != null) b.append(app); } } - b.append("end ").append(conf.name).append(";\n"); + b.append("end ").append(conf.name.replace(" ", "")).append(";\n"); if(insertInterpolate) b.append(