]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
refs #5019
authorvillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 25 Jun 2014 08:42:20 +0000 (08:42 +0000)
committervillberg <villberg@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Wed, 25 Jun 2014 08:42:20 +0000 (08:42 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@29733 ac1ea38d-2e2b-0410-8846-a27921b304fc

fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NodeClass.java
fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Parser.java

index 532c053ab5836bd801472f23e21afdf001f7ba5d..8d2e49a0eb87f21b763fcc3bf92fe617b6db2fc1 100644 (file)
@@ -33,6 +33,7 @@ public enum NodeClass {
        subscript_2,\r
        component_clause,\r
        component_declaration,\r
+       component_list,\r
        array_subscripts,\r
        declaration,\r
        class_definition,\r
index 5bc59bcef96c0c7ee3fe2da44f34900d8d545eea..e2c722d75702dbc561d1da36c69f9842f7a6b062 100644 (file)
@@ -257,9 +257,20 @@ public class Parser {
                        IExpression[] subscripts = (third instanceof IExpression[])? (IExpression[])third : null;\r
                        int declarationStart = (third instanceof IExpression[]) ? 3 : 2;\r
                        ArrayList<Object> clauses = new ArrayList<Object>();\r
-                       for(int i=declarationStart;i<n.jjtGetNumChildren();i++) {\r
+                       \r
+                       ArrayList<Declaration> declarations2 = new ArrayList<Declaration>();\r
+                       if(third instanceof ArrayList) {\r
+                               ArrayList<Declaration> decls = (ArrayList<Declaration>)third;\r
+                               declarations2.addAll(decls);\r
+                       } else {\r
+                               for(int i=declarationStart;i<n.jjtGetNumChildren();i++) {\r
+                                       Declaration decl = (Declaration)walk((SimpleNode)n.jjtGetChild(i), indent+2, frame);\r
+                                       declarations2.add(decl);\r
+                               }\r
+                       }\r
+                       \r
+                       for(Declaration decl : declarations2) {\r
                                \r
-                               Declaration decl = (Declaration)walk((SimpleNode)n.jjtGetChild(i), indent+2, frame);\r
                                if(subscripts != null)\r
                                        decl.variable.subscripts = subscripts;\r
                                \r
@@ -299,6 +310,16 @@ public class Parser {
                                }\r
                        }\r
                        return clauses;\r
+               case component_list:\r
+                       if(n.jjtGetNumChildren() == 1)\r
+                               return walk((SimpleNode)n.jjtGetChild(0), indent+2, frame);\r
+                       else {\r
+                               ArrayList<Declaration> result = new ArrayList<Declaration>();\r
+                               for(int i=0;i<n.jjtGetNumChildren();i++) {\r
+                                       result.add((Declaration)walk((SimpleNode)n.jjtGetChild(i),indent+2, frame));\r
+                               }\r
+                               return result;\r
+                       }\r
                case component_declaration:\r
                        return (Declaration)walk((SimpleNode)n.jjtGetChild(0), indent+2, frame);\r
                case array_subscripts:\r