]> gerrit.simantics Code Review - simantics/interop.git/commitdiff
Moved /interoperability/branches/dev/* to /interoperability/trunk
authorlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 18 Mar 2010 11:06:30 +0000 (11:06 +0000)
committerlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Thu, 18 Mar 2010 11:06:30 +0000 (11:06 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/interoperability/trunk@15072 ac1ea38d-2e2b-0410-8846-a27921b304fc

34 files changed:
org.simantics.express/.classpath [new file with mode: 0644]
org.simantics.express/.project [new file with mode: 0644]
org.simantics.express/META-INF/MANIFEST.MF [new file with mode: 0644]
org.simantics.express/build.properties [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/TestExpress.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/expressions/ExpBinaryExpression.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/expressions/ExpBooleanLiteral.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/expressions/ExpExpression.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/expressions/ExpFloatLiteral.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/expressions/ExpIntegerLiteral.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/expressions/ExpQuestionMark.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/expressions/ExpSelf.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/expressions/ExpStringLiteral.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/expressions/ExpUnaryExpression.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpAggregate.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpArray.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpBag.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpBinary.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpBoolean.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpEnumeration.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpGeneric.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpGenericEntity.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpInteger.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpList.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpLogical.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpNumber.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpParametrizedType.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpReal.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpSelect.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpSet.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpString.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpType.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/ast/types/ExpTypeName.java [new file with mode: 0644]
org.simantics.express/src/org/simantics/express/parser/ExpressParser.jj [new file with mode: 0644]

diff --git a/org.simantics.express/.classpath b/org.simantics.express/.classpath
new file mode 100644 (file)
index 0000000..8a8f166
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+       <classpathentry kind="src" path="src"/>\r
+       <classpathentry kind="output" path="bin"/>\r
+</classpath>\r
diff --git a/org.simantics.express/.project b/org.simantics.express/.project
new file mode 100644 (file)
index 0000000..4353145
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>org.simantics.express</name>\r
+       <comment></comment>\r
+       <projects>\r
+       </projects>\r
+       <buildSpec>\r
+       </buildSpec>\r
+       <natures>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/org.simantics.express/META-INF/MANIFEST.MF b/org.simantics.express/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..7c315a4
--- /dev/null
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Express Plug-in
+Bundle-SymbolicName: org.simantics.express
+Bundle-Version: 1.0.0
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/org.simantics.express/build.properties b/org.simantics.express/build.properties
new file mode 100644 (file)
index 0000000..41eb6ad
--- /dev/null
@@ -0,0 +1,4 @@
+source.. = src/\r
+output.. = bin/\r
+bin.includes = META-INF/,\\r
+               .\r
diff --git a/org.simantics.express/src/org/simantics/express/TestExpress.java b/org.simantics.express/src/org/simantics/express/TestExpress.java
new file mode 100644 (file)
index 0000000..4345f92
--- /dev/null
@@ -0,0 +1,49 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express;\r
+\r
+import java.io.File;\r
+import java.io.FileInputStream;\r
+import java.io.InputStream;\r
+\r
+import org.simantics.express.parser.ExpressParser;\r
+\r
+public class TestExpress {\r
+       \r
+       public static void parse(File file) {\r
+               try {\r
+                       System.out.println("Parse " + file);\r
+       \r
+                       InputStream stream = new FileInputStream(file);\r
+                       ExpressParser parser = new ExpressParser(stream);\r
+                       parser.document();      \r
+               } catch(Exception e) {\r
+                       e.printStackTrace();\r
+               }\r
+       }\r
+       \r
+       public static void browse(File dir) {\r
+               for(File f : dir.listFiles())\r
+                       if(f.isDirectory())\r
+                               browse(f);\r
+                       else if(f.getName().endsWith(".exp"))\r
+                               parse(f);\r
+       }\r
+       \r
+       public static void main(String[] args) {\r
+               try {\r
+                       browse(new File("c:\\Documents and Settings\\Hannu\\My Documents\\express"));\r
+               } catch (Exception e) {\r
+                       // TODO Auto-generated catch block\r
+                       e.printStackTrace();\r
+               }               \r
+       }\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/expressions/ExpBinaryExpression.java b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpBinaryExpression.java
new file mode 100644 (file)
index 0000000..3a7c6cd
--- /dev/null
@@ -0,0 +1,23 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.expressions;\r
+\r
+public class ExpBinaryExpression implements ExpExpression {\r
+       ExpExpression left;\r
+       ExpExpression right;\r
+       String operator;\r
+       \r
+       public ExpBinaryExpression(ExpExpression left, String operator, ExpExpression right) {\r
+               this.left = left;\r
+               this.operator = operator;\r
+               this.right = right;\r
+       }       \r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/expressions/ExpBooleanLiteral.java b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpBooleanLiteral.java
new file mode 100644 (file)
index 0000000..32cdefb
--- /dev/null
@@ -0,0 +1,23 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.expressions;\r
+\r
+public class ExpBooleanLiteral implements ExpExpression {\r
+       \r
+       public static final ExpBooleanLiteral TRUE = new ExpBooleanLiteral(true);\r
+       public static final ExpBooleanLiteral FALSE = new ExpBooleanLiteral(false);\r
+       \r
+       boolean value;\r
+\r
+       private ExpBooleanLiteral(boolean value) {\r
+               this.value = value;\r
+       }       \r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/expressions/ExpExpression.java b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpExpression.java
new file mode 100644 (file)
index 0000000..894205b
--- /dev/null
@@ -0,0 +1,15 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.expressions;\r
+\r
+public interface ExpExpression {\r
+\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/expressions/ExpFloatLiteral.java b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpFloatLiteral.java
new file mode 100644 (file)
index 0000000..b17c34e
--- /dev/null
@@ -0,0 +1,19 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.expressions;\r
+\r
+public class ExpFloatLiteral implements ExpExpression {\r
+       String value;\r
+\r
+       public ExpFloatLiteral(String value) {\r
+               this.value = value;\r
+       }       \r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/expressions/ExpIntegerLiteral.java b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpIntegerLiteral.java
new file mode 100644 (file)
index 0000000..8d22c94
--- /dev/null
@@ -0,0 +1,19 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.expressions;\r
+\r
+public class ExpIntegerLiteral implements ExpExpression {\r
+       String value;\r
+\r
+       public ExpIntegerLiteral(String value) {\r
+               this.value = value;\r
+       }       \r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/expressions/ExpQuestionMark.java b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpQuestionMark.java
new file mode 100644 (file)
index 0000000..cb2219f
--- /dev/null
@@ -0,0 +1,17 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.expressions;\r
+\r
+public class ExpQuestionMark implements ExpExpression {\r
+       \r
+       public static final ExpQuestionMark INSTANCE = new ExpQuestionMark(); \r
+\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/expressions/ExpSelf.java b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpSelf.java
new file mode 100644 (file)
index 0000000..15aeb84
--- /dev/null
@@ -0,0 +1,17 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.expressions;\r
+\r
+public class ExpSelf implements ExpExpression {\r
+       \r
+       public static final ExpSelf INSTANCE = new ExpSelf(); \r
+\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/expressions/ExpStringLiteral.java b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpStringLiteral.java
new file mode 100644 (file)
index 0000000..a149d81
--- /dev/null
@@ -0,0 +1,19 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.expressions;\r
+\r
+public class ExpStringLiteral implements ExpExpression {\r
+       String value;\r
+\r
+       public ExpStringLiteral(String value) {\r
+               this.value = value;\r
+       }       \r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/expressions/ExpUnaryExpression.java b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpUnaryExpression.java
new file mode 100644 (file)
index 0000000..af651de
--- /dev/null
@@ -0,0 +1,21 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.expressions;\r
+\r
+public class ExpUnaryExpression implements ExpExpression {\r
+       ExpExpression exp;\r
+       String operator;\r
+       \r
+       public ExpUnaryExpression(ExpExpression exp, String operator) {\r
+               this.exp = exp;\r
+               this.operator = operator;\r
+       }\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpAggregate.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpAggregate.java
new file mode 100644 (file)
index 0000000..9627266
--- /dev/null
@@ -0,0 +1,19 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpAggregate extends ExpParametrizedType {\r
+\r
+       public ExpAggregate(ExpType parameter) {\r
+               super(parameter);\r
+       }\r
+\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpArray.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpArray.java
new file mode 100644 (file)
index 0000000..275ad00
--- /dev/null
@@ -0,0 +1,19 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpArray extends ExpParametrizedType {\r
+\r
+       public ExpArray(ExpType parameter) {\r
+               super(parameter);\r
+       }\r
+       \r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpBag.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpBag.java
new file mode 100644 (file)
index 0000000..c4e679f
--- /dev/null
@@ -0,0 +1,19 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpBag extends ExpParametrizedType {\r
+\r
+       public ExpBag(ExpType parameter) {\r
+               super(parameter);\r
+       }\r
+\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpBinary.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpBinary.java
new file mode 100644 (file)
index 0000000..f1bd098
--- /dev/null
@@ -0,0 +1,15 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpBinary implements ExpType {\r
+       public static final ExpBinary INSTANCE = new ExpBinary();\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpBoolean.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpBoolean.java
new file mode 100644 (file)
index 0000000..33053aa
--- /dev/null
@@ -0,0 +1,15 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpBoolean implements ExpType {\r
+       public static final ExpBoolean INSTANCE = new ExpBoolean();\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpEnumeration.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpEnumeration.java
new file mode 100644 (file)
index 0000000..eb3f368
--- /dev/null
@@ -0,0 +1,15 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpEnumeration implements ExpType {\r
+\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpGeneric.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpGeneric.java
new file mode 100644 (file)
index 0000000..292b2ad
--- /dev/null
@@ -0,0 +1,15 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpGeneric implements ExpType {\r
+       public static final ExpGeneric INSTANCE = new ExpGeneric();\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpGenericEntity.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpGenericEntity.java
new file mode 100644 (file)
index 0000000..6135ecf
--- /dev/null
@@ -0,0 +1,15 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpGenericEntity implements ExpType {\r
+       public static final ExpGenericEntity INSTANCE = new ExpGenericEntity();\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpInteger.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpInteger.java
new file mode 100644 (file)
index 0000000..00999c1
--- /dev/null
@@ -0,0 +1,15 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpInteger implements ExpType {\r
+       public static final ExpInteger INSTANCE = new ExpInteger();\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpList.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpList.java
new file mode 100644 (file)
index 0000000..0f70c40
--- /dev/null
@@ -0,0 +1,19 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpList extends ExpParametrizedType {\r
+\r
+       public ExpList(ExpType parameter) {\r
+               super(parameter);\r
+       }\r
+\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpLogical.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpLogical.java
new file mode 100644 (file)
index 0000000..6ea8dc9
--- /dev/null
@@ -0,0 +1,15 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpLogical implements ExpType {\r
+       public static final ExpLogical INSTANCE = new ExpLogical();\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpNumber.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpNumber.java
new file mode 100644 (file)
index 0000000..7d844d8
--- /dev/null
@@ -0,0 +1,15 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpNumber implements ExpType {\r
+       public static final ExpNumber INSTANCE = new ExpNumber();\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpParametrizedType.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpParametrizedType.java
new file mode 100644 (file)
index 0000000..157f17d
--- /dev/null
@@ -0,0 +1,19 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public abstract class ExpParametrizedType implements ExpType {\r
+       ExpType parameter;\r
+\r
+       public ExpParametrizedType(ExpType parameter) {\r
+               this.parameter = parameter;\r
+       }       \r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpReal.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpReal.java
new file mode 100644 (file)
index 0000000..a9c8eb6
--- /dev/null
@@ -0,0 +1,15 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpReal implements ExpType {\r
+       public static final ExpReal INSTANCE = new ExpReal();\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpSelect.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpSelect.java
new file mode 100644 (file)
index 0000000..6e2b884
--- /dev/null
@@ -0,0 +1,15 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpSelect implements ExpType {\r
+\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpSet.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpSet.java
new file mode 100644 (file)
index 0000000..06d952c
--- /dev/null
@@ -0,0 +1,19 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpSet extends ExpParametrizedType {\r
+\r
+       public ExpSet(ExpType parameter) {\r
+               super(parameter);\r
+       }\r
+\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpString.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpString.java
new file mode 100644 (file)
index 0000000..694edc8
--- /dev/null
@@ -0,0 +1,15 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpString implements ExpType {\r
+       public static final ExpString INSTANCE = new ExpString();\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpType.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpType.java
new file mode 100644 (file)
index 0000000..599de50
--- /dev/null
@@ -0,0 +1,15 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public interface ExpType {\r
+\r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/ast/types/ExpTypeName.java b/org.simantics.express/src/org/simantics/express/ast/types/ExpTypeName.java
new file mode 100644 (file)
index 0000000..f2698b9
--- /dev/null
@@ -0,0 +1,19 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.express.ast.types;\r
+\r
+public class ExpTypeName implements ExpType {\r
+       String name;\r
+\r
+       public ExpTypeName(String name) {\r
+               this.name = name;\r
+       }       \r
+}\r
diff --git a/org.simantics.express/src/org/simantics/express/parser/ExpressParser.jj b/org.simantics.express/src/org/simantics/express/parser/ExpressParser.jj
new file mode 100644 (file)
index 0000000..628341b
--- /dev/null
@@ -0,0 +1,438 @@
+options {\r
+  JDK_VERSION = "1.6";\r
+  STATIC = false;\r
+  IGNORE_CASE = true;\r
+}\r
+\r
+PARSER_BEGIN(ExpressParser)\r
+package org.simantics.express.parser; \r
+import org.simantics.express.ast.types.*;\r
+import org.simantics.express.ast.expressions.*;\r
+import java.util.List;\r
+import java.util.ArrayList;\r
+\r
+public class ExpressParser {\r
+}\r
+PARSER_END(ExpressParser)\r
+\r
+/* Lexer */\r
+\r
+SKIP:\r
+{ <WHITESPACE: " " | "\n" | "\r" | "\t" > \r
+| <COMMENT1: "(*" (~["*"] | "*" ~[")"])* "*)" >  \r
+| <COMMENT2: "--" (~["\n"])* >\r
+}\r
+\r
+TOKEN:\r
+{ ";" | "(" | ")" | "\\" | "?" | "[" | "]"\r
+| "{" | "}" | "|" | "&" | ":" | ":=" | ":=:"\r
+| ":<>:" | "," | "." | "=" | "<" | ">"\r
+| "<=" | ">=" | "/" | "+" | "-" | "*" | "@"\r
+| "<*" | "<>" | "**" | "||" \r
+| <ENTITY:"ENTITY"> \r
+| <END_ENTITY:"END_ENTITY">\r
+| <SCHEMA:"SCHEMA"> \r
+| <END_SCHEMA:"END_SCHEMA">\r
+| <CONSTANT:"CONSTANT"> \r
+| <END_CONSTANT:"END_CONSTANT">\r
+| <FUNCTION:"FUNCTION"> \r
+| <END_FUNCTION:"END_FUNCTION">\r
+| <PROCEDURE:"PROCEDURE"> \r
+| <END_PROCEDURE:"END_PROCEDURE">\r
+| <RULE:"RULE"> \r
+| <END_RULE:"END_RULE">\r
+| <TYPE:"TYPE"> \r
+| <END_TYPE:"END_TYPE">\r
+| <SUBTYPE_CONSTRAINT:"SUBTYPE_CONSTRAINT"> \r
+| <END_SUBTYPE_CONSTRAINT:"END_SUBTYPE_CONSTRAINT">\r
+| <LOCAL:"LOCAL"> \r
+| <END_LOCAL:"END_LOCAL">\r
+\r
+| <ABSTRACT:"ABSTRACT"> \r
+| <EXTENSIBLE:"EXTENSIBLE">\r
+| <GENERIC_ENTITY:"GENERIC_ENTITY">\r
+| <BASED_ON:"BASED_ON">\r
+| <WITH:"WITH">\r
+| <SUBTYPE:"SUBTYPE"> \r
+| <SUPERTYPE:"SUPERTYPE"> \r
+| <OF:"OF">\r
+| <ONEOF:"ONEOF">\r
+| <ANDOR:"ANDOR"> \r
+| <AND:"AND"> \r
+| <SELF:"SELF">\r
+| <USE:"USE">\r
+| <REFERENCE:"REFERENCE">\r
+| <FROM:"FROM">\r
+| <FOR:"FOR">\r
+| <DERIVE:"DERIVE">\r
+| <INVERSE:"INVERSE">\r
+| <OPTIONAL:"OPTIONAL">\r
+| <FIXED:"FIXED">\r
+| <UNIQUE:"UNIQUE">\r
+| <WHERE:"WHERE">\r
+| <LIKE:"LIKE">\r
+| <IN:"IN">\r
+| <OR:"OR">\r
+| <XOR:"XOR">\r
+| <MOD:"MOD">\r
+| <DIV:"DIV">\r
+| <QUERY:"QUERY">\r
+| <NOT:"NOT">\r
+| <AS:"AS">\r
+| <TRUE:"TRUE">\r
+| <FALSE:"FALSE">\r
+| <RENAMED:"RENAMED">\r
+\r
+| <STRING_:"STRING">\r
+| <INTEGER:"INTEGER">\r
+| <REAL:"REAL">\r
+| <NUMBER:"NUMBER">\r
+| <BOOLEAN:"BOOLEAN">\r
+| <LOGICAL:"LOGICAL">\r
+| <BINARY:"BINARY">\r
+| <BAG:"BAG">\r
+| <ARRAY:"ARRAY">\r
+| <LIST:"LIST">\r
+| <SET:"SET">\r
+| <SELECT:"SELECT">\r
+| <ENUMERATION:"ENUMERATION">\r
+| <GENERIC:"GENERIC">\r
+| <AGGREGATE:"AGGREGATE">\r
+\r
+| <ALIAS: "ALIAS">\r
+| <RETURN: "RETURN">\r
+| <IF: "IF">\r
+| <END_IF: "END_IF">\r
+| <THEN: "THEN">\r
+| <ELSE: "ELSE">\r
+| <REPEAT: "REPEAT">\r
+| <END_REPEAT: "END_REPEAT">\r
+| <TO: "TO">\r
+| <BY: "BY">\r
+| <WHILE: "WHILE">\r
+| <UNTIL: "UNTIL">\r
+| <CASE: "CASE">\r
+| <END_CASE: "END_CASE">\r
+| <BEGIN: "BEGIN">\r
+| <END: "END">\r
+| <ESCAPE: "ESCAPE">\r
+| <SKIP_: "SKIP">\r
+| <VAR: "VAR">\r
+\r
+| <STRING: "'" (~["'"])* "'">\r
+| <IDENT: ["a"-"z","A"-"Z"] (["a"-"z","A"-"Z","_","0"-"9"])* >\r
+| <INT: (["0"-"9"])+ >\r
+| <FLOAT: <INT> "." (<INT>)? (("e"|"E") ("+"|"-")?  <INT>)? >\r
+}\r
+\r
+/* Parser */\r
+\r
+void document() : {}\r
+{ (schema())* <EOF>\r
+}\r
+\r
+void schema() : {}\r
+{ <SCHEMA> <IDENT> ";" \r
+       (interface_())*\r
+       (constDecl())?\r
+       (decl())*\r
+  <END_SCHEMA> ";"\r
+}\r
+\r
+void interface_() : {}\r
+{ <USE> <FROM> <IDENT> ( "(" references() ")" )? ";"\r
+| <REFERENCE> <FROM> <IDENT> ( "(" references() ")" )? ";"\r
+}\r
+\r
+void references() : {}\r
+{ reference() ("," reference())* \r
+}\r
+\r
+void reference() : {}\r
+{ <IDENT> (<AS> <IDENT>)? \r
+}\r
+\r
+void constDecl() : {}\r
+{ <CONSTANT> (<IDENT> ":" typeB() ":=" exp() ";")+ <END_CONSTANT> ";"\r
+}\r
+\r
+void decl() : {}\r
+{ ruleDecl()\r
+| decl0()\r
+}\r
+\r
+void ruleDecl() : {}\r
+{ <RULE> <IDENT> <FOR> "(" idents() ")" ";" \r
+       localDecls()\r
+       (statement())*\r
+       where()\r
+  <END_RULE> ";"\r
+}\r
+\r
+void decl0() : {}\r
+{ entityDecl()\r
+| functionDecl()\r
+| procedureDecl()\r
+| typeDecl()\r
+| subtypeConstraintDecl()\r
+}\r
+\r
+void entityDecl() : {}\r
+{ <ENTITY> <IDENT> (supertype())? (subtype())? ";"\r
+        (attributes() ":" (<OPTIONAL>)? typeB() ";")*\r
+        (<DERIVE> (attribute() ":" typeB() ":=" exp() ";")+ )?\r
+        (<INVERSE> (attribute() ":" typeI() <FOR> attribute() ";")+ )?\r
+        (<UNIQUE> ( ( LOOKAHEAD(2) <IDENT> ":")? attributes() ";")+ )?\r
+        (where())?\r
+  <END_ENTITY> ";"\r
+}\r
+\r
+void localDecls() : {}\r
+{ (decl0())*\r
+  (constDecl())?\r
+  (<LOCAL> ( idents() ":" typeP() (":=" exp())* ";")+ <END_LOCAL> ";")?\r
+}\r
+\r
+void functionDecl() : {}\r
+{ <FUNCTION> <IDENT> ("(" parameter() (";" parameter())* ")")? ":" typeP() ";" \r
+       localDecls()\r
+       (statement())+\r
+  <END_FUNCTION> ";"\r
+}\r
+\r
+void procedureDecl() : {}\r
+{ <PROCEDURE> <IDENT> ("(" parameterP() (";" parameterP())* ")")? ";" \r
+    localDecls()\r
+    (statement())+\r
+  <END_PROCEDURE> ";"\r
+}\r
+\r
+void typeDecl() : {}\r
+{ <TYPE> <IDENT> "=" typeU() ";" (where())? <END_TYPE> ";"\r
+}\r
+\r
+void subtypeConstraintDecl() : {}\r
+{ <SUBTYPE_CONSTRAINT> <IDENT> <FOR> <IDENT> ";"\r
+       (<ABSTRACT> <SUPERTYPE> ";")?\r
+       (supertypeExpression() ";")?\r
+  <END_SUBTYPE_CONSTRAINT> ";"\r
+}\r
+\r
+void where() : {}\r
+{ <WHERE> ( ( LOOKAHEAD(2) <IDENT> ":")? exp() ";")+\r
+}\r
+\r
+void parameter() : {}\r
+{ idents() ":" typeP()\r
+}\r
+\r
+void parameterP() : {}\r
+{ parameter()\r
+| <VAR> parameterP()\r
+}\r
+\r
+void supertype() : {}\r
+{ <SUPERTYPE> <OF> "(" supertypeExpression() ")"\r
+| <ABSTRACT> <SUPERTYPE> (<OF> "(" supertypeExpression() ")")?\r
+}\r
+\r
+void supertypeExpression() : {}\r
+{ supertypeExpression2() (<ANDOR> supertypeExpression2())*\r
+}\r
+\r
+void supertypeExpression2() : {}\r
+{ supertypeExpression3() (<AND> supertypeExpression3())*\r
+}\r
+\r
+void subtype() : {}\r
+{ <SUBTYPE> <OF> "(" idents() ")"\r
+}\r
+\r
+void supertypeExpression3() : {}\r
+{ <IDENT>\r
+| <ONEOF> "(" supertypeExpression() ("," supertypeExpression())* ")"\r
+| "(" supertypeExpression() ")"\r
+}\r
+\r
+void attribute() : {}\r
+{ <IDENT>\r
+| <SELF> "\\" <IDENT> "." <IDENT> (<RENAMED> <IDENT>)?\r
+}\r
+\r
+void attributes() : {}\r
+{ attribute() ("," attribute())*\r
+}\r
+\r
+ExpType typeBI() : {}\r
+{ <BOOLEAN> { return ExpBoolean.INSTANCE; }\r
+| <REAL> /* */ { return ExpReal.INSTANCE; }\r
+| <NUMBER> { return ExpNumber.INSTANCE; }\r
+| <BINARY> ( "(" exp1() ")")? ( <FIXED> )? { return ExpBinary.INSTANCE; }\r
+| <LOGICAL> { return ExpLogical.INSTANCE; }\r
+| <STRING_> ( "(" exp1() ")")? ( <FIXED> )? { return ExpString.INSTANCE; }\r
+| <INTEGER> { return ExpInteger.INSTANCE; }\r
+}\r
+\r
+ExpType typeB() : { ExpType type; }\r
+{ type=typeN() { return type; }\r
+| type=typeBI() { return type; }\r
+| type=typeA() { return type; }\r
+}\r
+\r
+ExpType typeA() : { ExpType type; }\r
+{ <BAG> bound() <OF> type=typeB() { return new ExpBag(type); }\r
+| <ARRAY> bound() <OF> (<OPTIONAL>)? (<UNIQUE>)? type=typeB() { return new ExpArray(type); }\r
+| <LIST> bound() <OF> (<UNIQUE>)? type=typeB() { return new ExpList(type); }\r
+| <SET> bound() <OF> type=typeB() { return new ExpSet(type); }\r
+}\r
+\r
+ExpType typeI() : { ExpType type; }\r
+{ type=typeN() { return type; }\r
+| <BAG> bound() <OF> type=typeN() { return new ExpBag(type); }\r
+| <SET> bound() <OF> type=typeN() { return new ExpSet(type); }\r
+}\r
+\r
+ExpType typeN() : { Token tt; }\r
+{ tt=<IDENT> { return new ExpTypeName(tt.image); }\r
+}\r
+\r
+ExpType typeP() : { ExpType type; }\r
+{ type=typeBI() { return type; } \r
+| type=typeN(){ return type; }\r
+| <BAG> bound() <OF> type=typeP() { return new ExpBag(type); }\r
+| <ARRAY> bound() <OF> (<OPTIONAL>)? (<UNIQUE>)? type=typeP() { return new ExpArray(type); }\r
+| <LIST> bound() <OF> (<UNIQUE>)? type=typeP() { return new ExpList(type); }\r
+| <SET> bound() <OF> type=typeP() { return new ExpSet(type); }\r
+| <GENERIC> (":" <IDENT>)?  { return ExpGeneric.INSTANCE; }\r
+| <GENERIC_ENTITY> { return ExpGenericEntity.INSTANCE; }\r
+| <AGGREGATE> (":" <IDENT>)? <OF> type=typeP() { return new ExpAggregate(type); }\r
+}\r
+\r
+ExpType typeU() : {}\r
+{ { ExpType type; } type=typeB() { return type; }\r
+| LOOKAHEAD(3) (<EXTENSIBLE>)? (<GENERIC_ENTITY>)? <SELECT> \r
+    (<BASED_ON> <IDENT> (<WITH> "(" idents() ")")?\r
+    | "(" idents() ")"\r
+    )? { return new ExpSelect(); }\r
+| LOOKAHEAD(3) (<EXTENSIBLE>)? (<GENERIC_ENTITY>)? <ENUMERATION> \r
+    (<BASED_ON> <IDENT> (<WITH> "(" idents() ")")?\r
+    | <OF> "(" idents() ")"\r
+    )? { return new ExpEnumeration(); }\r
+}\r
+\r
+void bound() : {}\r
+{ ("[" exp1() ":" exp1() "]")?\r
+}\r
+\r
+ExpExpression exp() : { ExpExpression exp; }\r
+{ exp=exp1() \r
+       ( {ExpExpression exp2; String op;} op=op0() exp2=exp1() \r
+           { exp = new ExpBinaryExpression(exp, op, exp2); } )? \r
+       { return exp; }\r
+}\r
+\r
+String op0() : {}\r
+{ ">" { return ">"; }\r
+| "<" { return "<"; } \r
+| ">=" { return ">="; }\r
+| "<=" { return "<="; }\r
+| ":=:" { return ":=:"; } \r
+| ":<>:" { return ":<>:"; }\r
+| "=" { return "="; }\r
+| "<>" { return "<>"; }\r
+| <LIKE> { return "like"; } \r
+| <IN> { return "in"; }\r
+}\r
+\r
+ExpExpression exp1() : { ExpExpression exp; }\r
+{ exp=exp2() \r
+       ( {ExpExpression exp2; String op;} op=op1() exp2=exp2()\r
+          { exp = new ExpBinaryExpression(exp, op, exp2); }\r
+       )* \r
+       { return exp; }\r
+}\r
+\r
+String op1() : {}\r
+{ <OR> { return "or"; }\r
+| <XOR> { return "xor"; }\r
+| "+" { return "+"; }\r
+| "-" { return "-"; }\r
+}\r
+\r
+ExpExpression exp2() : { ExpExpression exp; }\r
+{ exp=exp3() \r
+    ( {ExpExpression exp2; String op;} op=op2() exp2=exp3()\r
+       { exp = new ExpBinaryExpression(exp, op, exp2); }\r
+    )* \r
+    { return exp; }\r
+}\r
+\r
+String op2() : {}\r
+{ <AND> { return "and"; }\r
+| <MOD> { return "mod"; }\r
+| <DIV> { return "div"; }\r
+| "*" { return "*"; }\r
+| "/" { return "/"; }\r
+| "||" { return "||"; }\r
+}\r
+\r
+ExpExpression exp3() : { ExpExpression exp; }\r
+{ exp=exp4() \r
+    ( {ExpExpression exp2;} "**" exp2=exp4()\r
+       { exp = new ExpBinaryExpression(exp, "**", exp2); }\r
+    )* \r
+    { return exp; }\r
+}\r
+\r
+ExpExpression exp4() : { ExpExpression exp; }\r
+{ "[" (exp() (":" exp())? ("," exp() (":" exp())?)* )? "]"   { return null; }\r
+| <QUERY> "(" <IDENT> "<*" exp1() "|" exp() ")" { return null; }\r
+| "{" exp1() ("<" | "<=") exp1() ("<" | "<=") exp1() "}" { return null; }\r
+| "+" exp=exp5() { return new ExpUnaryExpression(exp, "+"); }\r
+| "-" exp=exp5() { return new ExpUnaryExpression(exp, "-"); }\r
+| <NOT> exp=exp5() { return new ExpUnaryExpression(exp, "not"); }\r
+| exp=exp5() { return exp; }\r
+}\r
+\r
+ExpExpression exp5() : { Token tt; ExpExpression exp; }\r
+{ tt=<INT> { return new ExpIntegerLiteral(tt.image); }  \r
+| "(" exp=exp() ")" { return exp; }\r
+| "?" { return ExpQuestionMark.INSTANCE; }\r
+| <SELF> exp=quals(ExpQuestionMark.INSTANCE) { return exp; }\r
+| <IDENT> ("(" (exp() ("," exp())*)? ")")? quals(null) { return null; }\r
+| tt=<STRING> { return new ExpStringLiteral(tt.image.substring(1, tt.image.length()-1)); }  \r
+| tt=<FLOAT> { return new ExpFloatLiteral(tt.image); }  \r
+| <TRUE> { return ExpBooleanLiteral.TRUE; }  \r
+| <FALSE> { return ExpBooleanLiteral.FALSE; } \r
+/* ... */\r
+}\r
+\r
+ExpExpression quals(ExpExpression base) : {}\r
+{ ( "." <IDENT>\r
+  | "\\" <IDENT>\r
+  | "[" exp() (":" exp1())? "]" \r
+  )* { return base; }\r
+}\r
+\r
+void statement() : {}\r
+{ <RETURN> (exp1())? ";"\r
+| <IF> exp() <THEN> (statement())+ (<ELSE> (statement())+)? <END_IF> ";"\r
+| LOOKAHEAD(2) <IDENT> quals(null) ":=" exp() ";"\r
+| <REPEAT> \r
+   (<IDENT> ":=" exp1() <TO> exp1() (<BY> exp2())?)?\r
+   (<WHILE> exp())?\r
+   (<UNTIL> exp())? ";" \r
+   (statement())+ <END_REPEAT> ";"\r
+| <CASE> exp() <OF> ( exp() ("," exp())* ":" statement() )* <END_CASE> ";"\r
+| <BEGIN> (statement())+ <END> ";"\r
+| <ESCAPE> ";"\r
+| <SKIP_> ";"\r
+| LOOKAHEAD(2) <IDENT> "(" (exp() ("," exp())*)? ")" ";"\r
+| ";"\r
+/* | ... */\r
+}\r
+\r
+String[] idents() : { List<String> idents = new ArrayList<String>(2); Token tt; } \r
+{ tt=<IDENT> { idents.add(tt.image); } ("," tt=<IDENT> { idents.add(tt.image); })* \r
+       { return idents.toArray(new String[idents.size()]); }\r
+}
\ No newline at end of file