From: lehtonen Date: Thu, 18 Mar 2010 11:06:30 +0000 (+0000) Subject: Moved /interoperability/branches/dev/* to /interoperability/trunk X-Git-Tag: v1.31.0~142 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=2f25d8293b887536bc1c07699f97e60f2705ff7e;p=simantics%2Finterop.git Moved /interoperability/branches/dev/* to /interoperability/trunk git-svn-id: https://www.simantics.org/svn/simantics/interoperability/trunk@15072 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.express/.classpath b/org.simantics.express/.classpath new file mode 100644 index 0000000..8a8f166 --- /dev/null +++ b/org.simantics.express/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.simantics.express/.project b/org.simantics.express/.project new file mode 100644 index 0000000..4353145 --- /dev/null +++ b/org.simantics.express/.project @@ -0,0 +1,11 @@ + + + org.simantics.express + + + + + + + + diff --git a/org.simantics.express/META-INF/MANIFEST.MF b/org.simantics.express/META-INF/MANIFEST.MF new file mode 100644 index 0000000..7c315a4 --- /dev/null +++ b/org.simantics.express/META-INF/MANIFEST.MF @@ -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 index 0000000..41eb6ad --- /dev/null +++ b/org.simantics.express/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . 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 index 0000000..4345f92 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/TestExpress.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; + +import org.simantics.express.parser.ExpressParser; + +public class TestExpress { + + public static void parse(File file) { + try { + System.out.println("Parse " + file); + + InputStream stream = new FileInputStream(file); + ExpressParser parser = new ExpressParser(stream); + parser.document(); + } catch(Exception e) { + e.printStackTrace(); + } + } + + public static void browse(File dir) { + for(File f : dir.listFiles()) + if(f.isDirectory()) + browse(f); + else if(f.getName().endsWith(".exp")) + parse(f); + } + + public static void main(String[] args) { + try { + browse(new File("c:\\Documents and Settings\\Hannu\\My Documents\\express")); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} 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 index 0000000..3a7c6cd --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpBinaryExpression.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.expressions; + +public class ExpBinaryExpression implements ExpExpression { + ExpExpression left; + ExpExpression right; + String operator; + + public ExpBinaryExpression(ExpExpression left, String operator, ExpExpression right) { + this.left = left; + this.operator = operator; + this.right = right; + } +} 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 index 0000000..32cdefb --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpBooleanLiteral.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.expressions; + +public class ExpBooleanLiteral implements ExpExpression { + + public static final ExpBooleanLiteral TRUE = new ExpBooleanLiteral(true); + public static final ExpBooleanLiteral FALSE = new ExpBooleanLiteral(false); + + boolean value; + + private ExpBooleanLiteral(boolean value) { + this.value = value; + } +} 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 index 0000000..894205b --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpExpression.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.expressions; + +public interface ExpExpression { + +} 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 index 0000000..b17c34e --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpFloatLiteral.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.expressions; + +public class ExpFloatLiteral implements ExpExpression { + String value; + + public ExpFloatLiteral(String value) { + this.value = value; + } +} 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 index 0000000..8d22c94 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpIntegerLiteral.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.expressions; + +public class ExpIntegerLiteral implements ExpExpression { + String value; + + public ExpIntegerLiteral(String value) { + this.value = value; + } +} 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 index 0000000..cb2219f --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpQuestionMark.java @@ -0,0 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.expressions; + +public class ExpQuestionMark implements ExpExpression { + + public static final ExpQuestionMark INSTANCE = new ExpQuestionMark(); + +} 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 index 0000000..15aeb84 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpSelf.java @@ -0,0 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.expressions; + +public class ExpSelf implements ExpExpression { + + public static final ExpSelf INSTANCE = new ExpSelf(); + +} 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 index 0000000..a149d81 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpStringLiteral.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.expressions; + +public class ExpStringLiteral implements ExpExpression { + String value; + + public ExpStringLiteral(String value) { + this.value = value; + } +} 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 index 0000000..af651de --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/expressions/ExpUnaryExpression.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.expressions; + +public class ExpUnaryExpression implements ExpExpression { + ExpExpression exp; + String operator; + + public ExpUnaryExpression(ExpExpression exp, String operator) { + this.exp = exp; + this.operator = operator; + } +} 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 index 0000000..9627266 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpAggregate.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpAggregate extends ExpParametrizedType { + + public ExpAggregate(ExpType parameter) { + super(parameter); + } + +} 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 index 0000000..275ad00 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpArray.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpArray extends ExpParametrizedType { + + public ExpArray(ExpType parameter) { + super(parameter); + } + +} 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 index 0000000..c4e679f --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpBag.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpBag extends ExpParametrizedType { + + public ExpBag(ExpType parameter) { + super(parameter); + } + +} 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 index 0000000..f1bd098 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpBinary.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpBinary implements ExpType { + public static final ExpBinary INSTANCE = new ExpBinary(); +} 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 index 0000000..33053aa --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpBoolean.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpBoolean implements ExpType { + public static final ExpBoolean INSTANCE = new ExpBoolean(); +} 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 index 0000000..eb3f368 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpEnumeration.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpEnumeration implements ExpType { + +} 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 index 0000000..292b2ad --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpGeneric.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpGeneric implements ExpType { + public static final ExpGeneric INSTANCE = new ExpGeneric(); +} 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 index 0000000..6135ecf --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpGenericEntity.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpGenericEntity implements ExpType { + public static final ExpGenericEntity INSTANCE = new ExpGenericEntity(); +} 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 index 0000000..00999c1 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpInteger.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpInteger implements ExpType { + public static final ExpInteger INSTANCE = new ExpInteger(); +} 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 index 0000000..0f70c40 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpList.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpList extends ExpParametrizedType { + + public ExpList(ExpType parameter) { + super(parameter); + } + +} 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 index 0000000..6ea8dc9 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpLogical.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpLogical implements ExpType { + public static final ExpLogical INSTANCE = new ExpLogical(); +} 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 index 0000000..7d844d8 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpNumber.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpNumber implements ExpType { + public static final ExpNumber INSTANCE = new ExpNumber(); +} 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 index 0000000..157f17d --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpParametrizedType.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public abstract class ExpParametrizedType implements ExpType { + ExpType parameter; + + public ExpParametrizedType(ExpType parameter) { + this.parameter = parameter; + } +} 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 index 0000000..a9c8eb6 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpReal.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpReal implements ExpType { + public static final ExpReal INSTANCE = new ExpReal(); +} 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 index 0000000..6e2b884 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpSelect.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpSelect implements ExpType { + +} 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 index 0000000..06d952c --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpSet.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpSet extends ExpParametrizedType { + + public ExpSet(ExpType parameter) { + super(parameter); + } + +} 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 index 0000000..694edc8 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpString.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpString implements ExpType { + public static final ExpString INSTANCE = new ExpString(); +} 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 index 0000000..599de50 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpType.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public interface ExpType { + +} 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 index 0000000..f2698b9 --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/ast/types/ExpTypeName.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2007- VTT Technical Research Centre of Finland. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.express.ast.types; + +public class ExpTypeName implements ExpType { + String name; + + public ExpTypeName(String name) { + this.name = name; + } +} 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 index 0000000..628341b --- /dev/null +++ b/org.simantics.express/src/org/simantics/express/parser/ExpressParser.jj @@ -0,0 +1,438 @@ +options { + JDK_VERSION = "1.6"; + STATIC = false; + IGNORE_CASE = true; +} + +PARSER_BEGIN(ExpressParser) +package org.simantics.express.parser; +import org.simantics.express.ast.types.*; +import org.simantics.express.ast.expressions.*; +import java.util.List; +import java.util.ArrayList; + +public class ExpressParser { +} +PARSER_END(ExpressParser) + +/* Lexer */ + +SKIP: +{ +| +| +} + +TOKEN: +{ ";" | "(" | ")" | "\\" | "?" | "[" | "]" +| "{" | "}" | "|" | "&" | ":" | ":=" | ":=:" +| ":<>:" | "," | "." | "=" | "<" | ">" +| "<=" | ">=" | "/" | "+" | "-" | "*" | "@" +| "<*" | "<>" | "**" | "||" +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| + +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| + +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| + +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| +| + +| +| +| +| "." ()? (("e"|"E") ("+"|"-")? )? > +} + +/* Parser */ + +void document() : {} +{ (schema())* +} + +void schema() : {} +{ ";" + (interface_())* + (constDecl())? + (decl())* + ";" +} + +void interface_() : {} +{ ( "(" references() ")" )? ";" +| ( "(" references() ")" )? ";" +} + +void references() : {} +{ reference() ("," reference())* +} + +void reference() : {} +{ ( )? +} + +void constDecl() : {} +{ ( ":" typeB() ":=" exp() ";")+ ";" +} + +void decl() : {} +{ ruleDecl() +| decl0() +} + +void ruleDecl() : {} +{ "(" idents() ")" ";" + localDecls() + (statement())* + where() + ";" +} + +void decl0() : {} +{ entityDecl() +| functionDecl() +| procedureDecl() +| typeDecl() +| subtypeConstraintDecl() +} + +void entityDecl() : {} +{ (supertype())? (subtype())? ";" + (attributes() ":" ()? typeB() ";")* + ( (attribute() ":" typeB() ":=" exp() ";")+ )? + ( (attribute() ":" typeI() attribute() ";")+ )? + ( ( ( LOOKAHEAD(2) ":")? attributes() ";")+ )? + (where())? + ";" +} + +void localDecls() : {} +{ (decl0())* + (constDecl())? + ( ( idents() ":" typeP() (":=" exp())* ";")+ ";")? +} + +void functionDecl() : {} +{ ("(" parameter() (";" parameter())* ")")? ":" typeP() ";" + localDecls() + (statement())+ + ";" +} + +void procedureDecl() : {} +{ ("(" parameterP() (";" parameterP())* ")")? ";" + localDecls() + (statement())+ + ";" +} + +void typeDecl() : {} +{ "=" typeU() ";" (where())? ";" +} + +void subtypeConstraintDecl() : {} +{ ";" + ( ";")? + (supertypeExpression() ";")? + ";" +} + +void where() : {} +{ ( ( LOOKAHEAD(2) ":")? exp() ";")+ +} + +void parameter() : {} +{ idents() ":" typeP() +} + +void parameterP() : {} +{ parameter() +| parameterP() +} + +void supertype() : {} +{ "(" supertypeExpression() ")" +| ( "(" supertypeExpression() ")")? +} + +void supertypeExpression() : {} +{ supertypeExpression2() ( supertypeExpression2())* +} + +void supertypeExpression2() : {} +{ supertypeExpression3() ( supertypeExpression3())* +} + +void subtype() : {} +{ "(" idents() ")" +} + +void supertypeExpression3() : {} +{ +| "(" supertypeExpression() ("," supertypeExpression())* ")" +| "(" supertypeExpression() ")" +} + +void attribute() : {} +{ +| "\\" "." ( )? +} + +void attributes() : {} +{ attribute() ("," attribute())* +} + +ExpType typeBI() : {} +{ { return ExpBoolean.INSTANCE; } +| /* */ { return ExpReal.INSTANCE; } +| { return ExpNumber.INSTANCE; } +| ( "(" exp1() ")")? ( )? { return ExpBinary.INSTANCE; } +| { return ExpLogical.INSTANCE; } +| ( "(" exp1() ")")? ( )? { return ExpString.INSTANCE; } +| { return ExpInteger.INSTANCE; } +} + +ExpType typeB() : { ExpType type; } +{ type=typeN() { return type; } +| type=typeBI() { return type; } +| type=typeA() { return type; } +} + +ExpType typeA() : { ExpType type; } +{ bound() type=typeB() { return new ExpBag(type); } +| bound() ()? ()? type=typeB() { return new ExpArray(type); } +| bound() ()? type=typeB() { return new ExpList(type); } +| bound() type=typeB() { return new ExpSet(type); } +} + +ExpType typeI() : { ExpType type; } +{ type=typeN() { return type; } +| bound() type=typeN() { return new ExpBag(type); } +| bound() type=typeN() { return new ExpSet(type); } +} + +ExpType typeN() : { Token tt; } +{ tt= { return new ExpTypeName(tt.image); } +} + +ExpType typeP() : { ExpType type; } +{ type=typeBI() { return type; } +| type=typeN(){ return type; } +| bound() type=typeP() { return new ExpBag(type); } +| bound() ()? ()? type=typeP() { return new ExpArray(type); } +| bound() ()? type=typeP() { return new ExpList(type); } +| bound() type=typeP() { return new ExpSet(type); } +| (":" )? { return ExpGeneric.INSTANCE; } +| { return ExpGenericEntity.INSTANCE; } +| (":" )? type=typeP() { return new ExpAggregate(type); } +} + +ExpType typeU() : {} +{ { ExpType type; } type=typeB() { return type; } +| LOOKAHEAD(3) ()? ()?