-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\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.basicexpression;\r
-\r
-import java.io.PushbackReader;\r
-import java.io.StringReader;\r
-\r
-import org.simantics.basicexpression.analysis.DepthFirstAdapter;\r
-import org.simantics.basicexpression.lexer.Lexer;\r
-import org.simantics.basicexpression.node.Start;\r
-import org.simantics.basicexpression.parser.Parser;\r
-\r
-public class Expressions {\r
-\r
- private static final boolean DEBUG = false;\r
- \r
- public static void evaluate(String expression, DepthFirstAdapter evaluator) {\r
- \r
- try\r
- {\r
- // Create a Parser instance.\r
- Parser p =\r
- new Parser(\r
- new Lexer(\r
- new PushbackReader(new StringReader(expression))));\r
-\r
- // Parse the input.\r
- Start tree = p.parse();\r
- \r
- if(DEBUG)\r
- tree.apply(new PrettyPrintExpressionVisitor());\r
- \r
-// System.out.println("tree=" + tree.getClass().getName());\r
- \r
- // Apply the translation.\r
- tree.apply(evaluator);\r
-\r
- }\r
- catch(Exception e)\r
- {\r
- e.printStackTrace();\r
- evaluator.except(e);\r
- } \r
- \r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * 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.basicexpression;
+
+import java.io.PushbackReader;
+import java.io.StringReader;
+
+import org.simantics.basicexpression.analysis.DepthFirstAdapter;
+import org.simantics.basicexpression.lexer.Lexer;
+import org.simantics.basicexpression.node.Start;
+import org.simantics.basicexpression.parser.Parser;
+
+public class Expressions {
+
+ private static final boolean DEBUG = false;
+
+ public static void evaluate(String expression, DepthFirstAdapter evaluator) {
+
+ try
+ {
+ // Create a Parser instance.
+ Parser p =
+ new Parser(
+ new Lexer(
+ new PushbackReader(new StringReader(expression))));
+
+ // Parse the input.
+ Start tree = p.parse();
+
+ if(DEBUG)
+ tree.apply(new PrettyPrintExpressionVisitor());
+
+// System.out.println("tree=" + tree.getClass().getName());
+
+ // Apply the translation.
+ tree.apply(evaluator);
+
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ evaluator.except(e);
+ }
+
+ }
+
+}