From 747863f90d67e473c7909db79c6da9e41ac004ac Mon Sep 17 00:00:00 2001 From: jkauttio Date: Thu, 24 Oct 2013 07:23:19 +0000 Subject: [PATCH] refs #4488 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@28112 ac1ea38d-2e2b-0410-8846-a27921b304fc --- fi.semantum.sysdyn.solver/.classpath | 7 + fi.semantum.sysdyn.solver/.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 13 + fi.semantum.sysdyn.solver/build.properties | 4 + .../fi/semantum/sysdyn/solver/Activator.java | 30 + .../fi/semantum/sysdyn/solver/Addition.java | 25 + .../src/fi/semantum/sysdyn/solver/And.java | 30 + .../semantum/sysdyn/solver/Application.java | 23 + .../fi/semantum/sysdyn/solver/Argument.java | 23 + .../semantum/sysdyn/solver/ArgumentList.java | 30 + .../src/fi/semantum/sysdyn/solver/Array.java | 67 + .../sysdyn/solver/ArraySliceExpression.java | 28 + .../fi/semantum/sysdyn/solver/Assignment.java | 19 + .../fi/semantum/sysdyn/solver/Constant.java | 25 + .../semantum/sysdyn/solver/Declaration.java | 29 + .../fi/semantum/sysdyn/solver/Derivate.java | 26 + .../fi/semantum/sysdyn/solver/Derivative.java | 16 + .../fi/semantum/sysdyn/solver/Division.java | 32 + .../semantum/sysdyn/solver/Environment.java | 290 + .../src/fi/semantum/sysdyn/solver/Equals.java | 24 + .../fi/semantum/sysdyn/solver/ForIndex.java | 13 + .../semantum/sysdyn/solver/ForStatement.java | 39 + .../src/fi/semantum/sysdyn/solver/Frame.java | 34 + .../fi/semantum/sysdyn/solver/Function.java | 99 + .../sysdyn/solver/GreaterOrEqualThan.java | 24 + .../semantum/sysdyn/solver/GreaterThan.java | 24 + .../semantum/sysdyn/solver/IEnvironment.java | 15 + .../semantum/sysdyn/solver/IExpression.java | 7 + .../src/fi/semantum/sysdyn/solver/IFrame.java | 5 + .../fi/semantum/sysdyn/solver/IStatement.java | 7 + .../fi/semantum/sysdyn/solver/ISystem.java | 13 + .../semantum/sysdyn/solver/IfStatement.java | 29 + .../fi/semantum/sysdyn/solver/IfThenElse.java | 29 + .../sysdyn/solver/LessOrEqualThan.java | 26 + .../fi/semantum/sysdyn/solver/LessThan.java | 25 + .../fi/semantum/sysdyn/solver/LineReader.java | 177 + .../src/fi/semantum/sysdyn/solver/Model.java | 122 + .../sysdyn/solver/Multiplication.java | 31 + .../fi/semantum/sysdyn/solver/Negation.java | 21 + .../fi/semantum/sysdyn/solver/NodeCache.java | 20 + .../fi/semantum/sysdyn/solver/NodeClass.java | 51 + .../fi/semantum/sysdyn/solver/NotEquals.java | 24 + .../src/fi/semantum/sysdyn/solver/Or.java | 30 + .../sysdyn/solver/ParameterDeclaration.java | 25 + .../src/fi/semantum/sysdyn/solver/Parser.java | 388 ++ .../src/fi/semantum/sysdyn/solver/Solver.java | 159 + .../fi/semantum/sysdyn/solver/Statement.java | 24 + .../semantum/sysdyn/solver/StatementList.java | 23 + .../semantum/sysdyn/solver/Subtraction.java | 23 + .../solver/UnassignedVariableException.java | 16 + .../src/fi/semantum/sysdyn/solver/Utils.java | 19 + .../fi/semantum/sysdyn/solver/Variable.java | 151 + .../semantum/sysdyn/solver/VariableBase.java | 41 + .../sysdyn/solver/VariableDeclaration.java | 29 + .../src/fi/semantum/sysdyn/solver/While.java | 24 + .../solver/parser/JJTModelParserState.java | 123 + .../sysdyn/solver/parser/ModelParser.java | 5980 +++++++++++++++++ .../solver/parser/ModelParserConstants.java | 131 + .../parser/ModelParserTokenManager.java | 1484 ++++ .../parser/ModelParserTreeConstants.java | 173 + .../sysdyn/solver/parser/ModelicaParser.jj | 2922 ++++++++ .../sysdyn/solver/parser/ModelicaParser.jjt | 782 +++ .../semantum/sysdyn/solver/parser/Node.java | 36 + .../sysdyn/solver/parser/ParseException.java | 187 + .../solver/parser/SimpleCharStream.java | 471 ++ .../sysdyn/solver/parser/SimpleNode.java | 81 + .../semantum/sysdyn/solver/parser/Token.java | 131 + .../sysdyn/solver/parser/TokenMgrError.java | 147 + 69 files changed, 15211 insertions(+) create mode 100644 fi.semantum.sysdyn.solver/.classpath create mode 100644 fi.semantum.sysdyn.solver/.project create mode 100644 fi.semantum.sysdyn.solver/.settings/org.eclipse.jdt.core.prefs create mode 100644 fi.semantum.sysdyn.solver/META-INF/MANIFEST.MF create mode 100644 fi.semantum.sysdyn.solver/build.properties create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Activator.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Addition.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/And.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Application.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Argument.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ArgumentList.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Array.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ArraySliceExpression.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Assignment.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Constant.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Declaration.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Derivate.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Derivative.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Division.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Environment.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Equals.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ForIndex.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ForStatement.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Frame.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Function.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/GreaterOrEqualThan.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/GreaterThan.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IEnvironment.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IExpression.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IFrame.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IStatement.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ISystem.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IfStatement.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IfThenElse.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LessOrEqualThan.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LessThan.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LineReader.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Model.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Multiplication.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Negation.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NodeCache.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NodeClass.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NotEquals.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Or.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ParameterDeclaration.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Parser.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Solver.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Statement.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/StatementList.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Subtraction.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/UnassignedVariableException.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Utils.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Variable.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/VariableBase.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/VariableDeclaration.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/While.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/JJTModelParserState.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParser.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserConstants.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserTokenManager.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserTreeConstants.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jj create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jjt create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/Node.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ParseException.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/SimpleCharStream.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/SimpleNode.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/Token.java create mode 100644 fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/TokenMgrError.java diff --git a/fi.semantum.sysdyn.solver/.classpath b/fi.semantum.sysdyn.solver/.classpath new file mode 100644 index 00000000..8a8f1668 --- /dev/null +++ b/fi.semantum.sysdyn.solver/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/fi.semantum.sysdyn.solver/.project b/fi.semantum.sysdyn.solver/.project new file mode 100644 index 00000000..f2296ceb --- /dev/null +++ b/fi.semantum.sysdyn.solver/.project @@ -0,0 +1,28 @@ + + + fi.semantum.sysdyn.solver + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/fi.semantum.sysdyn.solver/.settings/org.eclipse.jdt.core.prefs b/fi.semantum.sysdyn.solver/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..f287d53c --- /dev/null +++ b/fi.semantum.sysdyn.solver/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/fi.semantum.sysdyn.solver/META-INF/MANIFEST.MF b/fi.semantum.sysdyn.solver/META-INF/MANIFEST.MF new file mode 100644 index 00000000..7f8fe97d --- /dev/null +++ b/fi.semantum.sysdyn.solver/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Solver +Bundle-SymbolicName: fi.semantum.sysdyn.solver +Bundle-Version: 0.1.0.qualifier +Bundle-Activator: fi.semantum.sysdyn.solver.Activator +Bundle-Vendor: Semantum Oy +Require-Bundle: org.eclipse.core.runtime, + org.simantics.utils;bundle-version="1.1.0", + org.simantics.databoard;bundle-version="0.6.5" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Export-Package: fi.semantum.sysdyn.solver diff --git a/fi.semantum.sysdyn.solver/build.properties b/fi.semantum.sysdyn.solver/build.properties new file mode 100644 index 00000000..41eb6ade --- /dev/null +++ b/fi.semantum.sysdyn.solver/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Activator.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Activator.java new file mode 100644 index 00000000..54229a0c --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Activator.java @@ -0,0 +1,30 @@ +package fi.semantum.sysdyn.solver; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator implements BundleActivator { + + private static BundleContext context; + + static BundleContext getContext() { + return context; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + Activator.context = null; + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Addition.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Addition.java new file mode 100644 index 00000000..da23d525 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Addition.java @@ -0,0 +1,25 @@ +package fi.semantum.sysdyn.solver; + +public class Addition implements IExpression { + + public IExpression exp1; + public IExpression exp2; + + public Addition(IExpression exp1, IExpression exp2) { + this.exp1 = exp1; + this.exp2 = exp2; + } + + @Override + public String toString() { + return exp1 + " + " + exp2; + } + + @Override + public Object evaluate(IEnvironment environment) { + Double d1 = (Double)exp1.evaluate(environment); + Double d2 = (Double)exp2.evaluate(environment); + return d1 + d2; + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/And.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/And.java new file mode 100644 index 00000000..d73ae7a7 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/And.java @@ -0,0 +1,30 @@ +package fi.semantum.sysdyn.solver; + +import java.util.ArrayList; + +public class And implements IExpression { + + public ArrayList exps; + + public And(ArrayList exps) { + this.exps = exps; + } + + @Override + public String toString() { + StringBuilder b = new StringBuilder(); + b.append(exps.get(0)); + for(int i=1;i elements = new ArrayList(); + + public Array() { + + } + + public void addElement(Object element) { + if(element instanceof Constant) addElement(((Constant)element).value); + else elements.add(element); + } + + public void setElement(int index, Object element) { + elements.set(index, element); + } + + @Override + public Object evaluate(IEnvironment environment) { + return evaluated(environment); + } + + public Array evaluated(IEnvironment environment) { + Array result = new Array(); + for(Object o : elements) { + if(o instanceof Array) { + result.addElement(((Array)o).evaluated(environment)); + } else { + if(o instanceof IExpression) { + IExpression exp = (IExpression)o; + result.addElement(exp.evaluate(environment)); + } else { + result.addElement(o); + } + } + } + return result; + } + + @Override + public String toString() { + return elements.toString(); + } + + public int size(int col) { + return elements.size(); + } + + public Object element(int index) { + return elements.get(index); + } + + public Collection elements() { + return elements; + } + + public void ensureIndex(int index, boolean subArray) { + int needed = (index+1-elements.size()); + for(int i=0;i> history = new HashMap>(); + + public Environment(Model model, double step) { + + this.model = model; + this.step = step; + + model.functions.put("size", new Fn1() { + + @Override + public Object evaluate(IEnvironment environment, int argc) { + Array array = (Array)environment.getValue(0); + Double col = (Double)environment.getValue(1); + return Double.valueOf(array.size(col.intValue())); + } + + }); + model.functions.put("zidz", new Fn1() { + + @Override + public Object evaluate(IEnvironment environment, int argc) { + Double p1 = (Double)environment.getValue(0); + Double p2 = (Double)environment.getValue(1); + if(Math.abs(p2) < 1e-12) return 0.0; + else return p1 / p2; + } + + }); + model.functions.put("xidz", new Fn1() { + + @Override + public Object evaluate(IEnvironment environment, int argc) { + Double p1 = (Double)environment.getValue(0); + Double p2 = (Double)environment.getValue(1); + Double x = (Double)environment.getValue(2); + if(Math.abs(p2) < 1e-12) return x; + else return p1 / p2; + } + + }); + model.functions.put("availabilityExternal", new Fn1() { + + @Override + public Object evaluate(IEnvironment environment, int argc) { + Double numberOfDays = (Double)environment.getValue(0); + Double numberOfDesigners = (Double)environment.getValue(1); + Double rseed = (Double)environment.getValue(2); + Array availability = (Array)environment.getValue(3); + Array result = new Array(); + for(int i=0;i result) result = d; + } + return result; + } + + }); + model.functions.put("integer", new Fn1() { + + @Override + public Object evaluate(IEnvironment environment, int argc) { + Object value = environment.getValue(0); + Double result = (Double)value; + double res = result.intValue(); + return res; + } + + }); + model.functions.put("delay", new Fn1() { + + @Override + public Object evaluate(IEnvironment _environment, int argc) { + + String ident = (String)_environment.getValue(0); + Double value = (Double)_environment.getValue(1); + Double p1 = (Double)_environment.getValue(2); + Double p2 = (Double)_environment.getValue(3); + + ISystem system = _environment.getSystem(); + + TreeMap history = system.getHistory(ident); + double time = system.time(); + + history.put(time, value); + + Double key = history.ceilingKey(time-p1); + + return history.get(key); + + } + + }); + } + + public TreeMap getHistory(String ident) { + TreeMap result = history.get(ident); + if(result == null) { + result = new TreeMap(); + history.put(ident, result); + } + return result; + } + + @Override + public Object getValue(int key) { + return valueTable[key]; + } + + @Override + public void put(int key, Object value) { + valueTable[key] = value; + } + + @Override + public int offset() { + return model.names.size(); + } + + @Override + public ISystem getSystem() { + return this; + } + + @Override + public boolean initial() { + return initial; + } + + public Object evaluateFunction(IEnvironment environment, String name, ArgumentList args) { + return model.evaluateFunction(environment, name, args); + } + + @Override + public double time() { + return time; + } + + // TODO: this is probably not smart at all, figure out a better way to obtain results + public HashMap getValueMap() { + HashMap values = new HashMap(); + for (int i = 0; i < model.assignmentArray.length; i++) { + Variable v = model.assignmentArray[i].target; + values.put(v.base.name, (Double)getValue(v.index(this))); + } + for (int i = 0; i < model.derivativeArray.length; i++) { + Variable v = model.derivativeArray[i].target; + values.put(v.base.name, (Double)getValue(v.index(this))); + } + return values; + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Equals.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Equals.java new file mode 100644 index 00000000..b0dd75f0 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Equals.java @@ -0,0 +1,24 @@ +package fi.semantum.sysdyn.solver; + +public class Equals implements IExpression { + + public IExpression exp1; + public IExpression exp2; + + public Equals(IExpression exp1, IExpression exp2) { + this.exp1 = exp1; + this.exp2 = exp2; + } + + @Override + public String toString() { + return exp1 + " == " + exp2; + } + + @Override + public Object evaluate(IEnvironment environment) { + return ((Double)exp1.evaluate(environment)) == ((Double)exp2.evaluate(environment)); + } + + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ForIndex.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ForIndex.java new file mode 100644 index 00000000..e8d23dce --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ForIndex.java @@ -0,0 +1,13 @@ +package fi.semantum.sysdyn.solver; + +public class ForIndex { + + public VariableBase base; + public IExpression expression; + + public ForIndex(Function function, String name, IExpression expression) { + this.expression = expression; + this.base = function.addIndex(name, this); + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ForStatement.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ForStatement.java new file mode 100644 index 00000000..408fc2c4 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ForStatement.java @@ -0,0 +1,39 @@ +package fi.semantum.sysdyn.solver; + +import java.util.ArrayList; + +public class ForStatement implements IStatement { + + public ArrayList indices; + public IStatement statement; + + public ForStatement(ArrayList indices, IStatement statement) { + this.indices = indices; + this.statement = statement; + } + + @Override + public String toString() { + return "for " + indices + " loop "+ statement + " end for"; + } + + private void loop(IEnvironment environment, int i) { + if(i == indices.size()) { + statement.evaluate(environment); + return; + } else { + ForIndex index = indices.get(i); + Array array = (Array)index.expression.evaluate(environment); + for(Object element : array.elements()) { + environment.put(index.base.index, element); + loop(environment, i+1); + } + } + } + + @Override + public void evaluate(IEnvironment environment) { + loop(environment, 0); + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Frame.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Frame.java new file mode 100644 index 00000000..588f64d6 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Frame.java @@ -0,0 +1,34 @@ +package fi.semantum.sysdyn.solver; + +public class Frame implements IEnvironment { + + final public IEnvironment parent; + final private int offset; + + public Frame(IEnvironment parent, int offset) { + this.parent = parent; + this.offset = offset; + } + + @Override + public int offset() { + return offset; + } + + @Override + public void put(int index, Object value) { + parent.put(parent.offset() + index, value); + } + + @Override + public Object getValue(int index) { + return parent.getValue(parent.offset() + index); + } + + @Override + public ISystem getSystem() { + return parent.getSystem(); + } + +} + \ No newline at end of file diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Function.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Function.java new file mode 100644 index 00000000..49ad78ae --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Function.java @@ -0,0 +1,99 @@ +package fi.semantum.sysdyn.solver; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +public class Function implements Fn, IFrame { + + public static final boolean PRINT = false; + + final public String name; + final public IStatement statement; + + public ArrayList inputs = new ArrayList(); + public ArrayList outputs = new ArrayList(); + public ArrayList internals = new ArrayList(); + + public Variable[] parameters; + + public ArrayList indices = new ArrayList(); + + public Function(String name, IStatement statement) { + this.name = name; + this.statement = statement; + } + + public Object evaluate(IEnvironment environment, int argc) { + statement.evaluate(environment); + VariableDeclaration out = outputs.get(0); + return environment.getValue(out.variable.base.index); + } + + @Override + public void setLocals(IEnvironment environment) { + for(int i=0;i names = new HashMap(); + + public VariableBase getBase(String name) { + VariableBase base = names.get(name); + if(base == null) { + base = new VariableBase(name); + names.put(name, base); + } + return base; + } + + public void prepare() { + int nextIndex = 0; + if(PRINT) + System.err.println("Preparing function '" + name + "':"); + for(Map.Entry entry : names.entrySet()) { + VariableBase base = entry.getValue(); + base.index = nextIndex; + if(PRINT) + System.err.println("Variable: " + entry.getKey() + ", index=" + base.index + ", size=" + base.dimension()); + nextIndex += base.dimension(); + } + parameters = new Variable[inputs.size()]; + for(int i=0;i= " + exp2; + } + + @Override + public Object evaluate(IEnvironment environment) { + return ((Double)exp1.evaluate(environment)) >= ((Double)exp2.evaluate(environment)); + } + + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/GreaterThan.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/GreaterThan.java new file mode 100644 index 00000000..51899ef5 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/GreaterThan.java @@ -0,0 +1,24 @@ +package fi.semantum.sysdyn.solver; + +public class GreaterThan implements IExpression { + + public IExpression exp1; + public IExpression exp2; + + public GreaterThan(IExpression exp1, IExpression exp2) { + this.exp1 = exp1; + this.exp2 = exp2; + } + + @Override + public String toString() { + return exp1 + " > " + exp2; + } + + @Override + public Object evaluate(IEnvironment environment) { + return ((Double)exp1.evaluate(environment)) > ((Double)exp2.evaluate(environment)); + } + + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IEnvironment.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IEnvironment.java new file mode 100644 index 00000000..29164186 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IEnvironment.java @@ -0,0 +1,15 @@ +package fi.semantum.sysdyn.solver; + +public interface IEnvironment { + +// Object getValue(String key); + Object getValue(int index); +// void put(String key, Object value); + void put(int index, Object value); +// Object evaluateFunction(IEnvironment parent, String name, ArgumentList args); + + int offset(); + + ISystem getSystem(); + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IExpression.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IExpression.java new file mode 100644 index 00000000..d8f95927 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IExpression.java @@ -0,0 +1,7 @@ +package fi.semantum.sysdyn.solver; + +public interface IExpression { + + public Object evaluate(IEnvironment environment); + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IFrame.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IFrame.java new file mode 100644 index 00000000..3b3d55ea --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IFrame.java @@ -0,0 +1,5 @@ +package fi.semantum.sysdyn.solver; + +public interface IFrame { + public VariableBase getBase(String name); +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IStatement.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IStatement.java new file mode 100644 index 00000000..f27bed6b --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IStatement.java @@ -0,0 +1,7 @@ +package fi.semantum.sysdyn.solver; + +public interface IStatement { + + public void evaluate(IEnvironment environment); + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ISystem.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ISystem.java new file mode 100644 index 00000000..98196da0 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/ISystem.java @@ -0,0 +1,13 @@ +package fi.semantum.sysdyn.solver; + +import java.util.TreeMap; + +public interface ISystem { + + boolean initial(); + public Object evaluateFunction(IEnvironment environment, String name, ArgumentList args); + + TreeMap getHistory(String ident); + double time(); + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IfStatement.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IfStatement.java new file mode 100644 index 00000000..af177316 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IfStatement.java @@ -0,0 +1,29 @@ +package fi.semantum.sysdyn.solver; + +public class IfStatement implements IStatement { + + public IExpression exp; + public IStatement t; + public IStatement e; + + public IfStatement(IExpression exp, IStatement t, IStatement e) { + this.exp = exp; + this.t = t; + this.e = e; + } + + @Override + public String toString() { + return "if " + exp + " then " + t + " else "+ e; + } + + @Override + public void evaluate(IEnvironment environment) { + if((Boolean)exp.evaluate(environment)) { + t.evaluate(environment); + } else { + e.evaluate(environment); + } + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IfThenElse.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IfThenElse.java new file mode 100644 index 00000000..e9f0466e --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/IfThenElse.java @@ -0,0 +1,29 @@ +package fi.semantum.sysdyn.solver; + +public class IfThenElse implements IExpression { + + public IExpression exp; + public IExpression t; + public IExpression e; + + public IfThenElse(IExpression exp, IExpression t, IExpression e) { + this.exp = exp; + this.t = t; + this.e = e; + } + + @Override + public String toString() { + return "if " + exp + " then " + t + " else "+ e; + } + + @Override + public Object evaluate(IEnvironment environment) { + if((Boolean)exp.evaluate(environment)) { + return t.evaluate(environment); + } else { + return e.evaluate(environment); + } + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LessOrEqualThan.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LessOrEqualThan.java new file mode 100644 index 00000000..683c32ee --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LessOrEqualThan.java @@ -0,0 +1,26 @@ +package fi.semantum.sysdyn.solver; + +public class LessOrEqualThan implements IExpression { + + public IExpression exp1; + public IExpression exp2; + + public LessOrEqualThan(IExpression exp1, IExpression exp2) { + this.exp1 = exp1; + this.exp2 = exp2; + } + + @Override + public String toString() { + return exp1 + " <= " + exp2; + } + + @Override + public Object evaluate(IEnvironment environment) { + Double d1 = (Double)exp1.evaluate(environment); + Double d2 = (Double)exp2.evaluate(environment); + return d1 <= d2; + } + + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LessThan.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LessThan.java new file mode 100644 index 00000000..24980dbf --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LessThan.java @@ -0,0 +1,25 @@ +package fi.semantum.sysdyn.solver; + +public class LessThan implements IExpression { + + public IExpression exp1; + public IExpression exp2; + + public LessThan(IExpression exp1, IExpression exp2) { + this.exp1 = exp1; + this.exp2 = exp2; + } + + @Override + public String toString() { + return exp1 + " < " + exp2; + } + + @Override + public Object evaluate(IEnvironment environment) { + Object left = exp1.evaluate(environment); + Object right = exp2.evaluate(environment); + return ((Double)left) < ((Double)right); + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LineReader.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LineReader.java new file mode 100644 index 00000000..f5354b99 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/LineReader.java @@ -0,0 +1,177 @@ +package fi.semantum.sysdyn.solver; + +import java.io.StringReader; + +import fi.semantum.sysdyn.solver.parser.ModelParser; +import fi.semantum.sysdyn.solver.parser.Node; +import fi.semantum.sysdyn.solver.parser.SimpleNode; + +public class LineReader { + + public static final boolean PRINT = false; + + enum State { + FUNCTIONS,PARAMETERS,INITIALS,EQUATIONS,STOP + } + + private State state = State.FUNCTIONS; + + StringBuilder functions = new StringBuilder(); + + int startPos = 0; + int pos = 0; + final char[] chars; + final NodeCache cache; + final Model model; + final Parser parser; + + public LineReader(String input, NodeCache cache) { + chars = input.toCharArray(); + this.cache = cache; + model = new Model(); + parser = new Parser(); + } + + public void parseFunctions(String line) throws Exception { + + if(line.startsWith("class")) { + + String text = functions.toString(); + + Node node = cache.getNode(text); + if(node == null) { + StringReader reader = new StringReader(functions.toString()); + ModelParser modelParser = new ModelParser(reader); + node = modelParser.parse(); + cache.store(text, (SimpleNode)node); + } + + parser.walk((SimpleNode)node, 0, model); + + state = State.PARAMETERS; + return; + } + + functions.append(line); + functions.append("\n"); + + } + + public void parseParameters(String line) throws Exception { + + if("initial equation".equals(line)) { + state = State.INITIALS; + return; + } + + if("equation".equals(line)) { + state = State.EQUATIONS; + return; + } + + if(PRINT) System.err.println("parameter: '" + line + "'"); + + Node node = cache.getNode(line); + if(node == null) { + StringReader reader = new StringReader(line); + ModelParser modelParser = new ModelParser(reader); + node = modelParser.element(); + cache.store(line, (SimpleNode)node); + } + + parser.currentFrame = model; + parser.walk((SimpleNode)node, 0, model); + + } + + public void parseInitials(String line) throws Exception { + + if(line.startsWith("equation")) { + state = State.EQUATIONS; + return; + } + + if(line.startsWith("end")) { + state = State.STOP; + return; + } + + model.initial = true; + + if(PRINT) System.err.println("initial: '" + line + "'"); + + Node node = cache.getNode(line); + if(node == null) { + StringReader reader = new StringReader(line); + ModelParser modelParser = new ModelParser(reader); + node = modelParser.equation(); + cache.store(line, (SimpleNode)node); + } + + parser.currentFrame = model; + parser.walk((SimpleNode)node, 0, model); + + } + + public void parseEquations(String line) throws Exception { + + if(line.startsWith("end")) { + state = State.STOP; + return; + } + + if(PRINT) System.err.println("equation: '" + line + "'"); + + model.initial = false; + + Node node = cache.getNode(line); + if(node == null) { + StringReader reader = new StringReader(line); + ModelParser modelParser = new ModelParser(reader); + node = modelParser.equation(); + cache.store(line, (SimpleNode)node); + } + + parser.currentFrame = model; + parser.walk((SimpleNode)node, 0, model); + + } + + public void parseLine(String line) throws Exception { + //System.err.println("PARSE "+line); + switch(state) { + case FUNCTIONS: + parseFunctions(line); + break; + case PARAMETERS: + parseParameters(line); + break; + case INITIALS: + parseInitials(line); + break; + case EQUATIONS: + parseEquations(line); + break; + case STOP: + break; + } + } + + public void parse() throws Exception { + + long start = System.nanoTime(); + + for(;pos initials = new ArrayList(); + public ArrayList assignments = new ArrayList(); + public ArrayList derivatives = new ArrayList(); + public ArrayList parameters = new ArrayList(); + public ArrayList variables = new ArrayList(); + public Map functions = new HashMap(); + + public Assignment[] assignmentArray; + public Assignment[] derivativeArray; + + public Fn getFunction(String name) { + return functions.get(name); + } + + public HashMap names = new HashMap(); + + public VariableBase getBase(String name) { + VariableBase base = names.get(name); + if(base == null) { + base = new VariableBase(name); + names.put(name, base); + } + return base; + } + + public Object evaluateFunction(IEnvironment environment, String name, ArgumentList args) { + Fn fn = getFunction(name); + if(fn == null) { + fn = functions.get(name); + if(fn == null) throw new RuntimeException("Undefined function '" + name + "'"); + } + // knife! + if("delay".equals(name)) { + + Frame frame = new Frame(environment, fn.offset()); + + ArrayList argh = new ArrayList(); + argh.add(args.args.get(0).modification.toString()); + for(int i=0;i argh = new ArrayList(); + for(int i=0;i entry : names.entrySet()) { + VariableBase base = entry.getValue(); + base.index = nextIndex; + if(PRINT) + System.err.println("Variable: " + entry.getKey() + " " + base.index + " " + Arrays.toString(base.dimensions)); + nextIndex += base.dimension(); + } + + if(PRINT) + System.err.println("=================="); + + return nextIndex; + + } + +} \ No newline at end of file diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Multiplication.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Multiplication.java new file mode 100644 index 00000000..52fd5bae --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Multiplication.java @@ -0,0 +1,31 @@ +package fi.semantum.sysdyn.solver; + +public class Multiplication implements IExpression { + + public IExpression exp1; + public IExpression exp2; + + public Multiplication(IExpression exp1, IExpression exp2) { + this.exp1 = exp1; + this.exp2 = exp2; + } + + @Override + public String toString() { + return exp1 + " * " + exp2; + } + + private Array arrayMul(Array a, Double d) { + return a; + } + + @Override + public Object evaluate(IEnvironment environment) { + Object left = exp1.evaluate(environment); + Object right = exp2.evaluate(environment); + if(left instanceof Double && right instanceof Double) return ((Double)left)*((Double)right); + else if (left instanceof Array && right instanceof Double) return arrayMul((Array)left, (Double)right); + else if (left instanceof Double && right instanceof Array) return arrayMul((Array)right, (Double)left); + else throw new UnsupportedOperationException(); + } +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Negation.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Negation.java new file mode 100644 index 00000000..2048b42d --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Negation.java @@ -0,0 +1,21 @@ +package fi.semantum.sysdyn.solver; + +public class Negation implements IExpression { + + public IExpression exp; + + public Negation(IExpression exp) { + this.exp = exp; + } + + @Override + public String toString() { + return "-" + exp; + } + + @Override + public Object evaluate(IEnvironment environment) { + return -((Double)exp.evaluate(environment)); + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NodeCache.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NodeCache.java new file mode 100644 index 00000000..2d4e0a12 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NodeCache.java @@ -0,0 +1,20 @@ +package fi.semantum.sysdyn.solver; + +import java.util.HashMap; +import java.util.Map; + +import fi.semantum.sysdyn.solver.parser.SimpleNode; + +public class NodeCache { + + Map cache = new HashMap(); + + public SimpleNode getNode(String line) { + return cache.get(line); + } + + public void store(String line, SimpleNode node) { + cache.put(line, node); + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NodeClass.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NodeClass.java new file mode 100644 index 00000000..26f011e0 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NodeClass.java @@ -0,0 +1,51 @@ +package fi.semantum.sysdyn.solver; + +public enum NodeClass { + + assignment, + equation_section, + composition, + for_index, + for_indices, + for_statement, + if_statement, + while_statement, + statement, + name, + element_list, + element_modification, + function_arguments, + argument_list, + type_prefix, + algorithm_section, + subscript, + subscript_2, + component_clause, + component_declaration, + array_subscripts, + declaration, + class_definition, + array, + primary, + component_reference, + relation, + simple_expression, + logical_expression, + logical_term, + arithmetic_expression, + term, + if_expression, + add_op, + mul_op, + rel_op, + der_initial; + + private NodeClass() { + Parser.nodeNameMap.put(toString(), this); + } + + public static NodeClass of(String name) { + return Parser.nodeNameMap.get(name); + } + +} \ No newline at end of file diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NotEquals.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NotEquals.java new file mode 100644 index 00000000..7d1266fa --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/NotEquals.java @@ -0,0 +1,24 @@ +package fi.semantum.sysdyn.solver; + +public class NotEquals implements IExpression { + + public IExpression exp1; + public IExpression exp2; + + public NotEquals(IExpression exp1, IExpression exp2) { + this.exp1 = exp1; + this.exp2 = exp2; + } + + @Override + public String toString() { + return exp1 + " <> " + exp2; + } + + @Override + public Object evaluate(IEnvironment environment) { + return ((Double)exp1.evaluate(environment)) != ((Double)exp2.evaluate(environment)); + } + + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Or.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Or.java new file mode 100644 index 00000000..db328d26 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/Or.java @@ -0,0 +1,30 @@ +package fi.semantum.sysdyn.solver; + +import java.util.ArrayList; + +public class Or implements IExpression { + + public ArrayList exps; + + public Or(ArrayList exps) { + this.exps = exps; + } + + @Override + public String toString() { + StringBuilder b = new StringBuilder(); + b.append(exps.get(0)); + for(int i=1;i nodeNameMap = new HashMap(); + + public Object walk_(SimpleNode n, int indent, Model model) { + + // TODO: most of this should probably be implemented in the parser + + NodeClass nc = NodeClass.of(n.toString()); + + if (nc == null) { + if(n.jjtGetNumChildren() == 1) return walk((SimpleNode)n.jjtGetChild(0), indent+2, model); + // not sure if this is ever called + for(int i=0;i comps = new ArrayList(); + for(int i=0;i indices = new ArrayList(); + for(int i=0;i indices2 = (ArrayList)walk((SimpleNode)n.jjtGetChild(0), indent+2, model); + ArrayList stms = new ArrayList(); + for(int i=1;i thens = new ArrayList(); + ArrayList elses = new ArrayList(); + for(int i=1;i whiles = new ArrayList(); + for(int i=1;i elements = new ArrayList(); + for(int i=0;i args = new ArrayList(); + for(int i=0;i statements = new ArrayList(); + for(int i=0;i clauses = new ArrayList(); + for(int i=declarationStart;i())); + if(currentFrame == model) model.variables.add(vd); + clauses.add(vd); + } + } + } + return clauses; + case component_declaration: + return (Declaration)walk((SimpleNode)n.jjtGetChild(0), indent+2, model); + case array_subscripts: + IExpression[] subs = new IExpression[n.jjtGetNumChildren()]; + for(int i=0;i stms2 = new ArrayList(); + Function function = new Function(functionName, new StatementList(stms2)); + currentFrame = function; + ArrayList composition = (ArrayList)walk(child, indent+2, model); + for(int i=1;i declarations = (ArrayList)composition.get(i); + for(Object os_ : declarations) { + ArrayList os = (ArrayList)os_; + for(Object o : os) { + VariableDeclaration decl = (VariableDeclaration)o; + function.internals.add(decl); + } + } + } + } + ArrayList declarations = (ArrayList)composition.get(0); + for(Object os_ : declarations) { + ArrayList os = (ArrayList)os_; + for(Object o : os) { + VariableDeclaration decl = (VariableDeclaration)o; + if("input".equals(decl.direction)) function.inputs.add(decl); + else if ("output".equals(decl.direction)) function.outputs.add(decl); + else throw new IllegalStateException(); + } + } + model.functions.put(functionName, function); + currentFrame = model; + return function; + } + break; + case array: + Array array = new Array(); + if(n.jjtGetNumChildren() == 1) { + ArgumentList al = (ArgumentList)walk((SimpleNode)n.jjtGetChild(0), indent+2, model); + for(Argument arg : al.args) array.addElement(arg.modification); + } + return array; + case primary: + if(n.op != null) { + return Utils.parsePrimitive(n.op); + } else { + return walk((SimpleNode)n.jjtGetChild(0), indent+2, model); + } + case component_reference: + if(n.jjtGetNumChildren() == 1) { + return new Variable(currentFrame, n.op, (IExpression[])walk((SimpleNode)n.jjtGetChild(0), indent+2, model)); + } else { + return new Variable(currentFrame, n.op, null); + } + case relation: + if(n.jjtGetNumChildren() == 3) { + IExpression exp1 = (IExpression)walk((SimpleNode)n.jjtGetChild(0), indent+2, model); + String op = (String)walk((SimpleNode)n.jjtGetChild(1), indent+2, model); + IExpression exp2 = (IExpression)walk((SimpleNode)n.jjtGetChild(2), indent+2, model); + String trimmed = op != null ? op.trim() : null; + if("<".equals(trimmed)) { + return new LessThan(exp1, exp2); + } else if(">".equals(trimmed)) { + return new GreaterThan(exp1, exp2); + } else if(">=".equals(trimmed)) { + return new GreaterOrEqualThan(exp1, exp2); + } else if("<=".equals(trimmed)) { + return new LessOrEqualThan(exp1, exp2); + } else if("==".equals(trimmed)) { + return new Equals(exp1, exp2); + } else if("<>".equals(trimmed)) { + return new NotEquals(exp1, exp2); + } + else return null; + } else { + return walk((SimpleNode)n.jjtGetChild(0), indent+2, model); + } + case simple_expression: + if(n.jjtGetNumChildren() == 1) return walk((SimpleNode)n.jjtGetChild(0), indent+2, model); + else if(n.jjtGetNumChildren() == 2) { + IExpression start = (IExpression)walk((SimpleNode)n.jjtGetChild(0), indent+2, model); + IExpression end = (IExpression)walk((SimpleNode)n.jjtGetChild(1), indent+2, model); + return new ArraySliceExpression(start, end); + } else { + throw new UnsupportedOperationException(); + } + case logical_expression: + if(n.jjtGetNumChildren() > 1) { + ArrayList logs = new ArrayList(); + for(int i=0;i 1) { + ArrayList terms = new ArrayList(); + for(int i=0;i 1) { + IExpression left = (IExpression)walk((SimpleNode)n.jjtGetChild(0), indent+2, model); + for(int i=1;i 1) { + IExpression term = (IExpression)walk((SimpleNode)n.jjtGetChild(0), indent+2, model); + for(int i=1;i 0) { + + koss = 0; + + for(ParameterDeclaration pd : model.parameters) { + try { + if(!pd.assigned) { + pd.variable.assign(env, pd.modification.evaluate(env)); + pd.assigned = true; + } + } catch (Exception e) { + koss++; + if(PRINT_EXCEPTIONS) { + e.printStackTrace(); + System.err.println("failed to assign " + pd.variable.toString()); + } + } + } + + ArrayList assignments = new ArrayList(); + assignments.addAll(model.assignments); + assignments.addAll(model.initials); + + for(VariableDeclaration vd : model.variables) { + try { + if(!vd.assigned) { + for(Argument arg : vd.modification.args) { + if("start".equals(arg.name)) { + Object value = arg.modification.evaluate(env); + vd.variable.assign(env, value); + // make sure the variable is not initialized + // twice, this is probably not the most + // efficient way + for (Assignment a : assignments) { + if (vd.variable.base.equals(a.target.base)) { + a.assigned = true; + } + } + } + } + vd.assigned = true; + } + } catch (Exception e) { + koss++; + if(PRINT_EXCEPTIONS) { + e.printStackTrace(); + System.err.println("failed to assign " + vd.variable.toString()); + } + } + } + + for(Assignment ass : assignments) { + try { + if(!ass.assigned) { + Object value = ass.expression.evaluate(env); + ass.target.assign(env, value); + ass.assigned = true; + } + } catch (Exception e) { + koss++; + if(PRINT_EXCEPTIONS) { + e.printStackTrace(); + System.err.println("failed to assign " + ass.target.toString()); + } + } + } + } + + env.initial = false; + + ready = true; + } + + public HashMap values() { + return env.getValueMap(); + } + + public void step() { + // TODO: do something more sensible if the solver is not ready + if (!ready) return; + + Assignment[] assignments = model.assignmentArray; + Assignment[] derivatives = model.derivativeArray; + + // Solve algebraic equations + for(int i=0;i dimensions[i]) dimensions[i] = index; + } + } + } + public int dimension() { + if(dimensions == null) return 1; + int result = 1; + for(int d : dimensions) result *= d; + return result; + } + public boolean isStoredAsArray() { + if(dimensions == null) return false; + for(int d : dimensions) if(d == -1) return true; + return false; + } +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/VariableDeclaration.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/VariableDeclaration.java new file mode 100644 index 00000000..442c376f --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/VariableDeclaration.java @@ -0,0 +1,29 @@ +package fi.semantum.sysdyn.solver; + + +public class VariableDeclaration implements IExpression { + + public Variable variable; + public String direction; + public String type; + public ArgumentList modification; + public boolean assigned = false; + + public VariableDeclaration(Variable variable, String direction, String type, ArgumentList modification) { + this.variable = variable; + this.direction = direction; + this.type = type; + this.modification = modification; + } + + @Override + public String toString() { + return direction + " " + type + " " + variable + " " + modification; + } + + @Override + public Object evaluate(IEnvironment environment) { + throw new UnsupportedOperationException(); + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/While.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/While.java new file mode 100644 index 00000000..9d16ac05 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/While.java @@ -0,0 +1,24 @@ +package fi.semantum.sysdyn.solver; + +public class While implements IStatement { + + public IExpression expression; + public IStatement statement; + + public While(IExpression expression, IStatement statement) { + this.expression = expression; + this.statement = statement; + } + + @Override + public String toString() { + return "while " + expression + " then "+ statement + " end"; + } + + @Override + public void evaluate(IEnvironment environment) { + while ((Boolean)expression.evaluate(environment)) + statement.evaluate(environment); + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/JJTModelParserState.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/JJTModelParserState.java new file mode 100644 index 00000000..6d43b87a --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/JJTModelParserState.java @@ -0,0 +1,123 @@ +/* Generated By:JavaCC: Do not edit this line. JJTModelParserState.java Version 5.0 */ +package fi.semantum.sysdyn.solver.parser; + +public class JJTModelParserState { + private java.util.List nodes; + private java.util.List marks; + + private int sp; // number of nodes on stack + private int mk; // current mark + private boolean node_created; + + public JJTModelParserState() { + nodes = new java.util.ArrayList(); + marks = new java.util.ArrayList(); + sp = 0; + mk = 0; + } + + /* Determines whether the current node was actually closed and + pushed. This should only be called in the final user action of a + node scope. */ + public boolean nodeCreated() { + return node_created; + } + + /* Call this to reinitialize the node stack. It is called + automatically by the parser's ReInit() method. */ + public void reset() { + nodes.clear(); + marks.clear(); + sp = 0; + mk = 0; + } + + /* Returns the root node of the AST. It only makes sense to call + this after a successful parse. */ + public Node rootNode() { + return nodes.get(0); + } + + /* Pushes a node on to the stack. */ + public void pushNode(Node n) { + nodes.add(n); + ++sp; + } + + /* Returns the node on the top of the stack, and remove it from the + stack. */ + public Node popNode() { + if (--sp < mk) { + mk = marks.remove(marks.size()-1); + } + return nodes.remove(nodes.size()-1); + } + + /* Returns the node currently on the top of the stack. */ + public Node peekNode() { + return nodes.get(nodes.size()-1); + } + + /* Returns the number of children on the stack in the current node + scope. */ + public int nodeArity() { + return sp - mk; + } + + + public void clearNodeScope(Node n) { + while (sp > mk) { + popNode(); + } + mk = marks.remove(marks.size()-1); + } + + + public void openNodeScope(Node n) { + marks.add(mk); + mk = sp; + n.jjtOpen(); + } + + + /* A definite node is constructed from a specified number of + children. That number of nodes are popped from the stack and + made the children of the definite node. Then the definite node + is pushed on to the stack. */ + public void closeNodeScope(Node n, int num) { + mk = marks.remove(marks.size()-1); + while (num-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, num); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } + + + /* A conditional node is constructed if its condition is true. All + the nodes that have been pushed since the node was opened are + made children of the conditional node, which is then pushed + on to the stack. If the condition is false the node is not + constructed and they are left on the stack. */ + public void closeNodeScope(Node n, boolean condition) { + if (condition) { + int a = nodeArity(); + mk = marks.remove(marks.size()-1); + while (a-- > 0) { + Node c = popNode(); + c.jjtSetParent(n); + n.jjtAddChild(c, a); + } + n.jjtClose(); + pushNode(n); + node_created = true; + } else { + mk = marks.remove(marks.size()-1); + node_created = false; + } + } +} +/* JavaCC - OriginalChecksum=6281595a71622ddc7d1a230278358c63 (do not edit this line) */ diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParser.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParser.java new file mode 100644 index 00000000..828459b9 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParser.java @@ -0,0 +1,5980 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. ModelParser.java */ +package fi.semantum.sysdyn.solver.parser; + +import java.util.ArrayList; + +public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants, ModelParserConstants {/*@bgen(jjtree)*/ + protected JJTModelParserState jjtree = new JJTModelParserState(); + private ArrayList inputs = new ArrayList(); + private ArrayList outputs = new ArrayList(); + + private enum InterfaceVariableType + { + INPUT, OUTPUT, OTHER + } + + public class Parameter + { + public String name; + public boolean optional; + public String description; + public String type; + + public Parameter() + { + name = new String(""); + optional = false; + description = null; + type = null; + } + } + + public ArrayList getInputs() + { + return inputs; + } + + public ArrayList getOutputs() + { + return outputs; + } + +/*** Parser ********************************************************/ + +// https://javacc.dev.java.net/doc/javaccgrm.html +// add_op -> add_op() +// [ add_op ] -> ( add_op() )? +// { add_op term } -> ( add_op() term() )* + final public Node parse() throws ParseException { + /*@bgen(jjtree) parse */ + SimpleNode jjtn000 = new SimpleNode(JJTPARSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + stored_definition(); + jj_consume_token(0); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + {if (true) return jjtn000;} + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + throw new Error("Missing return statement in function"); + } + +/*** Stored Definition - Within ************************************/ + final public Node stored_definition() throws ParseException { + /*@bgen(jjtree) STORED */ + SimpleNode jjtn000 = new SimpleNode(JJTSTORED); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 53: + jj_consume_token(53); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + name(); + break; + default: + jj_la1[0] = jj_gen; + ; + } + jj_consume_token(70); + break; + default: + jj_la1[1] = jj_gen; + ; + } + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 7: + case 11: + case 17: + case 24: + case 26: + case 30: + case 34: + case 37: + case 38: + case 44: + case 47: + case 50: + case 61: + case 94: + case 95: + ; + break; + default: + jj_la1[2] = jj_gen; + break label_1; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 11: + jj_consume_token(11); + break; + default: + jj_la1[3] = jj_gen; + ; + } + class_definition(); + jj_consume_token(70); + } + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + {if (true) return jjtn000;} + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + throw new Error("Missing return statement in function"); + } + +/*** Class Definition **********************************************/ + final public void class_definition() throws ParseException { + /*@bgen(jjtree) class_definition */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASS_DEFINITION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 30: + jj_consume_token(30); + break; + default: + jj_la1[4] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 47: + jj_consume_token(47); + break; + default: + jj_la1[5] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 34: + jj_consume_token(34); + break; + case 7: + jj_consume_token(7); + break; + case 61: + jj_consume_token(61); + break; + case 24: + jj_consume_token(24); + break; + case 44: + case 50: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 50: + jj_consume_token(50); + break; + default: + jj_la1[6] = jj_gen; + ; + } + jj_consume_token(44); + break; + case 38: + jj_consume_token(38); + break; + case 37: + jj_consume_token(37); + break; + case 26: + jj_consume_token(26); + jjtn000.op = "function"; + break; + case 17: + jj_consume_token(17); + break; + case 94: + jj_consume_token(94); + break; + case 95: + jj_consume_token(95); + break; + default: + jj_la1[7] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + class_specifier(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void class_specifier() throws ParseException { + /*@bgen(jjtree) class_specifier */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASS_SPECIFIER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);Token t; + try { + if (jj_2_1(2)) { + t = jj_consume_token(IDENT); + jjtn000.op = t.image; + string_comment(); + composition(); + jj_consume_token(35); + jj_consume_token(IDENT); + } else if (jj_2_2(2)) { + jj_consume_token(IDENT); + jj_consume_token(88); + base_prefix(); + name(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 66: + array_subscripts(); + break; + default: + jj_la1[8] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + class_modification(); + break; + default: + jj_la1[9] = jj_gen; + ; + } + comment(); + } else if (jj_2_3(3)) { + jj_consume_token(IDENT); + jj_consume_token(88); + jj_consume_token(40); + jj_consume_token(62); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENT: + enum_list(); + break; + default: + jj_la1[10] = jj_gen; + ; + } + jj_consume_token(63); + comment(); + } else if (jj_2_4(3)) { + jj_consume_token(IDENT); + jj_consume_token(88); + jj_consume_token(58); + jj_consume_token(62); + name(); + jj_consume_token(71); + jj_consume_token(IDENT); + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[11] = jj_gen; + break label_2; + } + jj_consume_token(71); + jj_consume_token(IDENT); + } + jj_consume_token(63); + comment(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 55: + jj_consume_token(55); + jj_consume_token(IDENT); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + class_modification(); + break; + default: + jj_la1[12] = jj_gen; + ; + } + string_comment(); + composition(); + jj_consume_token(35); + jj_consume_token(IDENT); + break; + default: + jj_la1[13] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void base_prefix() throws ParseException { + /*@bgen(jjtree) base_prefix */ + SimpleNode jjtn000 = new SimpleNode(JJTBASE_PREFIX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + type_prefix(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void enum_list() throws ParseException { + /*@bgen(jjtree) enum_list */ + SimpleNode jjtn000 = new SimpleNode(JJTENUM_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + enumeration_literal(); + label_3: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[14] = jj_gen; + break label_3; + } + jj_consume_token(71); + enumeration_literal(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void enumeration_literal() throws ParseException { + /*@bgen(jjtree) enumeration_literal */ + SimpleNode jjtn000 = new SimpleNode(JJTENUMERATION_LITERAL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(IDENT); + comment(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void parse_composition() throws ParseException { + /*@bgen(jjtree) parse_composition */ + SimpleNode jjtn000 = new SimpleNode(JJTPARSE_COMPOSITION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + composition(); + jj_consume_token(0); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void composition() throws ParseException { + /*@bgen(jjtree) composition */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPOSITION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + element_list(); + label_4: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 4: + case 45: + case 46: + case 52: + case 57: + ; + break; + default: + jj_la1[15] = jj_gen; + break label_4; + } + if (jj_2_5(2)) { + jj_consume_token(57); + element_list(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 52: + jj_consume_token(52); + element_list(); + break; + case 45: + case 46: + equation_section(); + break; + case 4: + algorithm_section(); + break; + default: + jj_la1[16] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 59: + jj_consume_token(59); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING: + language_specification(); + break; + default: + jj_la1[17] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + external_function_call(); + break; + default: + jj_la1[18] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 14: + annotation(); + break; + default: + jj_la1[19] = jj_gen; + ; + } + jj_consume_token(70); + break; + default: + jj_la1[20] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 14: + annotation(); + jj_consume_token(70); + break; + default: + jj_la1[21] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void language_specification() throws ParseException { + /*@bgen(jjtree) language_specification */ + SimpleNode jjtn000 = new SimpleNode(JJTLANGUAGE_SPECIFICATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(STRING); + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void external_function_call() throws ParseException { + /*@bgen(jjtree) external_function_call */ + SimpleNode jjtn000 = new SimpleNode(JJTEXTERNAL_FUNCTION_CALL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + component_reference(); + jj_consume_token(88); + break; + default: + jj_la1[22] = jj_gen; + ; + } + jj_consume_token(IDENT); + jj_consume_token(62); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 31: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + expression_list(); + break; + default: + jj_la1[23] = jj_gen; + ; + } + jj_consume_token(63); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void element_list() throws ParseException { + /*@bgen(jjtree) element_list */ + SimpleNode jjtn000 = new SimpleNode(JJTELEMENT_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + label_5: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 7: + case 8: + case 11: + case 13: + case 16: + case 17: + case 23: + case 24: + case 26: + case 27: + case 30: + case 32: + case 34: + case 36: + case 37: + case 38: + case 42: + case 44: + case 47: + case 49: + case 50: + case 51: + case 55: + case 56: + case 61: + case 68: + case IDENT: + case 94: + case 95: + ; + break; + default: + jj_la1[24] = jj_gen; + break label_5; + } + element(); + jj_consume_token(70); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public Node element() throws ParseException { + /*@bgen(jjtree) element */ + SimpleNode jjtn000 = new SimpleNode(JJTELEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 36: + import_clause(); + break; + case 55: + extends_clause(); + break; + case 5: + case 7: + case 8: + case 11: + case 13: + case 16: + case 17: + case 23: + case 24: + case 26: + case 27: + case 30: + case 32: + case 34: + case 37: + case 38: + case 42: + case 44: + case 47: + case 49: + case 50: + case 51: + case 56: + case 61: + case 68: + case IDENT: + case 94: + case 95: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 8: + jj_consume_token(8); + break; + default: + jj_la1[25] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 11: + jj_consume_token(11); + break; + default: + jj_la1[26] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 51: + jj_consume_token(51); + break; + default: + jj_la1[27] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 27: + jj_consume_token(27); + break; + default: + jj_la1[28] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 7: + case 16: + case 17: + case 23: + case 24: + case 26: + case 30: + case 32: + case 34: + case 37: + case 38: + case 42: + case 44: + case 47: + case 49: + case 50: + case 56: + case 61: + case 68: + case IDENT: + case 94: + case 95: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 7: + case 17: + case 24: + case 26: + case 30: + case 34: + case 37: + case 38: + case 44: + case 47: + case 50: + case 61: + case 94: + case 95: + class_definition(); + break; + case 5: + case 16: + case 23: + case 32: + case 42: + case 49: + case 56: + case 68: + case IDENT: + component_clause(); + break; + default: + jj_la1[29] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + case 13: + jj_consume_token(13); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 7: + case 17: + case 24: + case 26: + case 30: + case 34: + case 37: + case 38: + case 44: + case 47: + case 50: + case 61: + case 94: + case 95: + class_definition(); + break; + case 5: + case 16: + case 23: + case 32: + case 42: + case 49: + case 56: + case 68: + case IDENT: + component_clause(); + break; + default: + jj_la1[30] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 54: + constraining_clause(); + comment(); + break; + default: + jj_la1[31] = jj_gen; + ; + } + break; + default: + jj_la1[32] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + {if (true) return jjtn000;} + break; + default: + jj_la1[33] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + throw new Error("Missing return statement in function"); + } + + final public void import_clause() throws ParseException { + /*@bgen(jjtree) import_clause */ + SimpleNode jjtn000 = new SimpleNode(JJTIMPORT_CLAUSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(36); + if (jj_2_6(2)) { + jj_consume_token(IDENT); + jj_consume_token(88); + name(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + name(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + jj_consume_token(68); + jj_consume_token(82); + break; + default: + jj_la1[34] = jj_gen; + ; + } + break; + default: + jj_la1[35] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + comment(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + +/*** Extends *******************************************************/ + final public void extends_clause() throws ParseException { + /*@bgen(jjtree) extends_clause */ + SimpleNode jjtn000 = new SimpleNode(JJTEXTENDS_CLAUSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(55); + name(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + class_modification(); + break; + default: + jj_la1[36] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 14: + annotation(); + break; + default: + jj_la1[37] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void constraining_clause() throws ParseException { + /*@bgen(jjtree) constraining_clause */ + SimpleNode jjtn000 = new SimpleNode(JJTCONSTRAINING_CLAUSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(54); + name(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + class_modification(); + break; + default: + jj_la1[38] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + +/*** Component Clause **********************************************/ + final public void component_clause() throws ParseException { + /*@bgen(jjtree) component_clause */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPONENT_CLAUSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);InterfaceVariableType ioType = InterfaceVariableType.OTHER; + String typeSpecifier = ""; + //String arraySubscripts = null; + ArrayList componentList = new ArrayList(); + try { + ioType = type_prefix(); + typeSpecifier = type_specifier(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 66: + array_subscripts(); + break; + default: + jj_la1[39] = jj_gen; + ; + } + componentList = component_list(); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + if (ioType == InterfaceVariableType.INPUT) { + for (Parameter input : componentList) { + input.type = typeSpecifier; + inputs.add(input); + } + } else if (ioType == InterfaceVariableType.OUTPUT) { + for (Parameter output : componentList) { + output.type = typeSpecifier; + outputs.add(output); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public InterfaceVariableType type_prefix() throws ParseException { + /*@bgen(jjtree) type_prefix */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPE_PREFIX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);InterfaceVariableType type = InterfaceVariableType.OTHER; + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 16: + case 23: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 16: + jj_consume_token(16); + break; + case 23: + jj_consume_token(23); + break; + default: + jj_la1[40] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[41] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 42: + case 49: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + jj_consume_token(5); + jjtn000.op = "discrete"; + break; + case 42: + jj_consume_token(42); + jjtn000.op = "parameter"; + break; + case 49: + jj_consume_token(49); + jjtn000.op = "constant"; + break; + default: + jj_la1[42] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[43] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 32: + case 56: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 32: + jj_consume_token(32); + type = InterfaceVariableType.OUTPUT; jjtn000.op = "output"; + break; + case 56: + jj_consume_token(56); + type = InterfaceVariableType.INPUT; jjtn000.op = "input"; + break; + default: + jj_la1[44] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[45] = jj_gen; + ; + } + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + {if (true) return type;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + throw new Error("Missing return statement in function"); + } + + final public String type_specifier() throws ParseException { + /*@bgen(jjtree) type_specifier */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPE_SPECIFIER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);String ret = new String(""); + try { + ret = name(); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = ret; + {if (true) return ret;} + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + throw new Error("Missing return statement in function"); + } + + final public ArrayList component_list() throws ParseException { + /*@bgen(jjtree) component_list */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPONENT_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);ArrayList ret = new ArrayList(); + Parameter temp; + try { + // component_declaration { "," component_declaration } + temp = component_declaration(); + ret.add(temp); + label_6: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[46] = jj_gen; + break label_6; + } + jj_consume_token(71); + temp = component_declaration(); + ret.add(temp); + } + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + {if (true) return ret;} + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + throw new Error("Missing return statement in function"); + } + + final public Parameter component_declaration() throws ParseException { + /*@bgen(jjtree) component_declaration */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPONENT_DECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);Parameter ret; + String temp = ""; + try { + // declaration [ conditional_attribute ] comment + ret = declaration(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 31: + conditional_attribute(); + break; + default: + jj_la1[47] = jj_gen; + ; + } + ret.description = comment(); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + {if (true) return ret;} + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + throw new Error("Missing return statement in function"); + } + + final public void conditional_attribute() throws ParseException { + /*@bgen(jjtree) conditional_attribute */ + SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONAL_ATTRIBUTE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(31); + expression(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public Parameter declaration() throws ParseException { + /*@bgen(jjtree) declaration */ + SimpleNode jjtn000 = new SimpleNode(JJTDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);Token t; + // Parameter here without comment yet. + Parameter ret = new Parameter(); + try { + jj_consume_token(IDENT); + ret.name = new String(token.image); jjtn000.op = token.image; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 66: + array_subscripts(); + break; + default: + jj_la1[48] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + case 88: + case 89: + ret.optional = modification(); + break; + default: + jj_la1[49] = jj_gen; + ; + } + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + {if (true) return ret;} + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + throw new Error("Missing return statement in function"); + } + +/*** Modification **********************************************/ + final public boolean modification() throws ParseException { + /*@bgen(jjtree) modification */ + SimpleNode jjtn000 = new SimpleNode(JJTMODIFICATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);boolean optional = false; + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + class_modification(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 88: + jj_consume_token(88); + expression(); + break; + default: + jj_la1[50] = jj_gen; + ; + } + break; + case 88: + jj_consume_token(88); + expression(); + optional = true; + break; + case 89: + jj_consume_token(89); + expression(); + optional = true; + break; + default: + jj_la1[51] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + {if (true) return optional;} + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + throw new Error("Missing return statement in function"); + } + + final public void class_modification() throws ParseException { + /*@bgen(jjtree) class_modification */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASS_MODIFICATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(62); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 8: + case 10: + case 11: + case 13: + case 68: + case IDENT: + argument_list(); + break; + default: + jj_la1[52] = jj_gen; + ; + } + jj_consume_token(63); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void argument_list() throws ParseException { + /*@bgen(jjtree) argument_list */ + SimpleNode jjtn000 = new SimpleNode(JJTARGUMENT_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + argument(); + label_7: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[53] = jj_gen; + break label_7; + } + jj_consume_token(71); + argument(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void argument() throws ParseException { + /*@bgen(jjtree) argument */ + SimpleNode jjtn000 = new SimpleNode(JJTARGUMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 10: + case 11: + case 13: + case 68: + case IDENT: + element_modification_or_replaceable(); + break; + case 8: + element_redeclaration(); + break; + default: + jj_la1[54] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void element_modification_or_replaceable() throws ParseException { + /*@bgen(jjtree) element_modification_or_replaceable */ + SimpleNode jjtn000 = new SimpleNode(JJTELEMENT_MODIFICATION_OR_REPLACEABLE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 10: + jj_consume_token(10); + break; + default: + jj_la1[55] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 11: + jj_consume_token(11); + break; + default: + jj_la1[56] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + element_modification(); + break; + case 13: + element_replaceable(); + break; + default: + jj_la1[57] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void element_modification() throws ParseException { + /*@bgen(jjtree) element_modification */ + SimpleNode jjtn000 = new SimpleNode(JJTELEMENT_MODIFICATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + name(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 62: + case 88: + case 89: + modification(); + break; + default: + jj_la1[58] = jj_gen; + ; + } + string_comment(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void element_redeclaration() throws ParseException { + /*@bgen(jjtree) element_redeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTELEMENT_REDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(8); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 10: + jj_consume_token(10); + break; + default: + jj_la1[59] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 11: + jj_consume_token(11); + break; + default: + jj_la1[60] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 5: + case 7: + case 16: + case 17: + case 23: + case 24: + case 26: + case 30: + case 32: + case 34: + case 37: + case 38: + case 42: + case 44: + case 47: + case 49: + case 50: + case 56: + case 61: + case 68: + case IDENT: + case 94: + case 95: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 7: + case 17: + case 24: + case 26: + case 30: + case 34: + case 37: + case 38: + case 44: + case 47: + case 50: + case 61: + case 94: + case 95: + class_definition(); + break; + case 5: + case 16: + case 23: + case 32: + case 42: + case 49: + case 56: + case 68: + case IDENT: + component_clause1(); + break; + default: + jj_la1[61] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + case 13: + element_replaceable(); + break; + default: + jj_la1[62] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void element_replaceable() throws ParseException { + /*@bgen(jjtree) element_replaceable */ + SimpleNode jjtn000 = new SimpleNode(JJTELEMENT_REPLACEABLE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(13); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 7: + case 17: + case 24: + case 26: + case 30: + case 34: + case 37: + case 38: + case 44: + case 47: + case 50: + case 61: + case 94: + case 95: + class_definition(); + break; + case 5: + case 16: + case 23: + case 32: + case 42: + case 49: + case 56: + case 68: + case IDENT: + component_clause1(); + break; + default: + jj_la1[63] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 54: + constraining_clause(); + break; + default: + jj_la1[64] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void component_clause1() throws ParseException { + /*@bgen(jjtree) component_clause1 */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPONENT_CLAUSE1); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + type_prefix(); + type_specifier(); + component_declaration1(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void component_declaration1() throws ParseException { + /*@bgen(jjtree) component_declaration1 */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPONENT_DECLARATION1); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + declaration(); + comment(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + +/*** Equations *************************************************/ + final public void equation_section() throws ParseException { + /*@bgen(jjtree) equation_section */ + SimpleNode jjtn000 = new SimpleNode(JJTEQUATION_SECTION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 46: + jj_consume_token(46); + jjtn000.op = "initial"; + break; + default: + jj_la1[65] = jj_gen; + ; + } + jj_consume_token(45); + label_8: + while (true) { + if (jj_2_7(2)) { + ; + } else { + break label_8; + } + equation(); + jj_consume_token(70); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void algorithm_section() throws ParseException { + /*@bgen(jjtree) algorithm_section */ + SimpleNode jjtn000 = new SimpleNode(JJTALGORITHM_SECTION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 46: + jj_consume_token(46); + break; + default: + jj_la1[66] = jj_gen; + ; + } + jj_consume_token(4); + label_9: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[67] = jj_gen; + break label_9; + } + statement(); + jj_consume_token(70); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void assignment() throws ParseException { + /*@bgen(jjtree) assignment */ + SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + simple_expression(); + jj_consume_token(88); + expression(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public Node equation() throws ParseException { + /*@bgen(jjtree) equation */ + SimpleNode jjtn000 = new SimpleNode(JJTEQUATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + if (jj_2_8(3)) { + assignment(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 31: + if_equation(); + break; + case 21: + for_equation(); + break; + case 39: + connect_clause(); + break; + case 43: + when_equation(); + break; + case IDENT: + jj_consume_token(IDENT); + function_call_args(); + break; + default: + jj_la1[68] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + comment(); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + {if (true) return jjtn000;} + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + throw new Error("Missing return statement in function"); + } + + final public void statement() throws ParseException { + /*@bgen(jjtree) statement */ + SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + component_reference(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 89: + jj_consume_token(89); + expression(); + break; + case 62: + function_call_args(); + break; + default: + jj_la1[69] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + case 62: + jj_consume_token(62); + output_expression_list(); + jj_consume_token(63); + jj_consume_token(89); + component_reference(); + function_call_args(); + break; + case 29: + jj_consume_token(29); + break; + case 18: + jj_consume_token(18); + break; + case 31: + if_statement(); + break; + case 21: + for_statement(); + break; + case 48: + while_statement(); + break; + case 43: + when_statement(); + break; + default: + jj_la1[70] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + comment(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void if_equation() throws ParseException { + /*@bgen(jjtree) if_equation */ + SimpleNode jjtn000 = new SimpleNode(JJTIF_EQUATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(31); + expression(); + jj_consume_token(28); + label_10: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 21: + case 31: + case 33: + case 35: + case 39: + case 43: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + ; + break; + default: + jj_la1[71] = jj_gen; + break label_10; + } + equation(); + jj_consume_token(70); + } + label_11: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + ; + break; + default: + jj_la1[72] = jj_gen; + break label_11; + } + jj_consume_token(20); + expression(); + jj_consume_token(28); + label_12: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 21: + case 31: + case 33: + case 35: + case 39: + case 43: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + ; + break; + default: + jj_la1[73] = jj_gen; + break label_12; + } + equation(); + jj_consume_token(70); + } + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 15: + jj_consume_token(15); + label_13: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 21: + case 31: + case 33: + case 35: + case 39: + case 43: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + ; + break; + default: + jj_la1[74] = jj_gen; + break label_13; + } + equation(); + jj_consume_token(70); + } + break; + default: + jj_la1[75] = jj_gen; + ; + } + jj_consume_token(35); + jj_consume_token(31); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void then_statement() throws ParseException { + /*@bgen(jjtree) then_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTTHEN_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + statement(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void elseif_statement() throws ParseException { + /*@bgen(jjtree) elseif_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTELSEIF_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + statement(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void else_statement() throws ParseException { + /*@bgen(jjtree) else_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTELSE_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + statement(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void if_statement() throws ParseException { + /*@bgen(jjtree) if_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTIF_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(31); + expression(); + jj_consume_token(28); + label_14: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[76] = jj_gen; + break label_14; + } + then_statement(); + jj_consume_token(70); + } + label_15: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + ; + break; + default: + jj_la1[77] = jj_gen; + break label_15; + } + jj_consume_token(20); + expression(); + jj_consume_token(28); + label_16: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[78] = jj_gen; + break label_16; + } + elseif_statement(); + jj_consume_token(70); + } + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 15: + jj_consume_token(15); + label_17: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[79] = jj_gen; + break label_17; + } + else_statement(); + jj_consume_token(70); + } + break; + default: + jj_la1[80] = jj_gen; + ; + } + jj_consume_token(35); + jj_consume_token(31); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void for_equation() throws ParseException { + /*@bgen(jjtree) for_equation */ + SimpleNode jjtn000 = new SimpleNode(JJTFOR_EQUATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(21); + for_indices(); + jj_consume_token(60); + label_18: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 21: + case 31: + case 33: + case 35: + case 39: + case 43: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + ; + break; + default: + jj_la1[81] = jj_gen; + break label_18; + } + equation(); + jj_consume_token(70); + } + jj_consume_token(35); + jj_consume_token(21); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void for_statement() throws ParseException { + /*@bgen(jjtree) for_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTFOR_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(21); + for_indices(); + jj_consume_token(60); + label_19: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[82] = jj_gen; + break label_19; + } + statement(); + jj_consume_token(70); + } + jj_consume_token(35); + jj_consume_token(21); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void for_indices() throws ParseException { + /*@bgen(jjtree) for_indices */ + SimpleNode jjtn000 = new SimpleNode(JJTFOR_INDICES); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + for_index(); + label_20: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[83] = jj_gen; + break label_20; + } + jj_consume_token(71); + for_index(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void for_index() throws ParseException { + /*@bgen(jjtree) for_index */ + SimpleNode jjtn000 = new SimpleNode(JJTFOR_INDEX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);Token t; + try { + //IDENT [ in expression ] + t = jj_consume_token(IDENT); + jjtn000.op = t.image; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 41: + jj_consume_token(41); + expression(); + break; + default: + jj_la1[84] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void while_statement() throws ParseException { + /*@bgen(jjtree) while_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTWHILE_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(48); + expression(); + jj_consume_token(60); + label_21: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[85] = jj_gen; + break label_21; + } + statement(); + jj_consume_token(70); + } + jj_consume_token(35); + jj_consume_token(48); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void when_equation() throws ParseException { + /*@bgen(jjtree) when_equation */ + SimpleNode jjtn000 = new SimpleNode(JJTWHEN_EQUATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(43); + expression(); + jj_consume_token(28); + label_22: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 21: + case 31: + case 33: + case 35: + case 39: + case 43: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + ; + break; + default: + jj_la1[86] = jj_gen; + break label_22; + } + equation(); + jj_consume_token(70); + } + label_23: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 25: + ; + break; + default: + jj_la1[87] = jj_gen; + break label_23; + } + jj_consume_token(25); + expression(); + jj_consume_token(28); + label_24: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 21: + case 31: + case 33: + case 35: + case 39: + case 43: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + ; + break; + default: + jj_la1[88] = jj_gen; + break label_24; + } + equation(); + jj_consume_token(70); + } + } + jj_consume_token(35); + jj_consume_token(43); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void when_statement() throws ParseException { + /*@bgen(jjtree) when_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTWHEN_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(43); + expression(); + jj_consume_token(28); + label_25: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[89] = jj_gen; + break label_25; + } + statement(); + jj_consume_token(70); + } + label_26: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 25: + ; + break; + default: + jj_la1[90] = jj_gen; + break label_26; + } + jj_consume_token(25); + expression(); + jj_consume_token(28); + label_27: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 18: + case 21: + case 29: + case 31: + case 43: + case 48: + case 62: + case 68: + case IDENT: + ; + break; + default: + jj_la1[91] = jj_gen; + break label_27; + } + statement(); + jj_consume_token(70); + } + } + jj_consume_token(35); + jj_consume_token(43); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void connect_clause() throws ParseException { + /*@bgen(jjtree) connect_clause */ + SimpleNode jjtn000 = new SimpleNode(JJTCONNECT_CLAUSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(39); + jj_consume_token(62); + component_reference(); + jj_consume_token(71); + component_reference(); + jj_consume_token(63); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + +/*** Expressions ***************************************************/ + final public void expr() throws ParseException { + /*@bgen(jjtree) expr */ + SimpleNode jjtn000 = new SimpleNode(JJTEXPR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + simple_expression(); + jj_consume_token(0); + break; + case 31: + jj_consume_token(31); + expression(); + jj_consume_token(28); + expression(); + label_28: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + ; + break; + default: + jj_la1[92] = jj_gen; + break label_28; + } + jj_consume_token(20); + expression(); + jj_consume_token(28); + expression(); + } + jj_consume_token(15); + expression(); + jj_consume_token(0); + break; + default: + jj_la1[93] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void if_expression() throws ParseException { + /*@bgen(jjtree) if_expression */ + SimpleNode jjtn000 = new SimpleNode(JJTIF_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(31); + expression(); + jj_consume_token(28); + expression(); + label_29: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 20: + ; + break; + default: + jj_la1[94] = jj_gen; + break label_29; + } + jj_consume_token(20); + expression(); + jj_consume_token(28); + expression(); + } + jj_consume_token(15); + expression(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void expression() throws ParseException { + /*@bgen(jjtree) expression */ + SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + simple_expression(); + break; + case 31: + if_expression(); + break; + default: + jj_la1[95] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void simple_expression() throws ParseException { + /*@bgen(jjtree) simple_expression */ + SimpleNode jjtn000 = new SimpleNode(JJTSIMPLE_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + logical_expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 69: + jj_consume_token(69); + logical_expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 69: + jj_consume_token(69); + logical_expression(); + break; + default: + jj_la1[96] = jj_gen; + ; + } + break; + default: + jj_la1[97] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void logical_expression() throws ParseException { + /*@bgen(jjtree) logical_expression */ + SimpleNode jjtn000 = new SimpleNode(JJTLOGICAL_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + logical_term(); + label_30: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 22: + ; + break; + default: + jj_la1[98] = jj_gen; + break label_30; + } + jj_consume_token(22); + logical_term(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void logical_term() throws ParseException { + /*@bgen(jjtree) logical_term */ + SimpleNode jjtn000 = new SimpleNode(JJTLOGICAL_TERM); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + logical_factor(); + label_31: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 9: + ; + break; + default: + jj_la1[99] = jj_gen; + break label_31; + } + jj_consume_token(9); + logical_factor(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void logical_factor() throws ParseException { + /*@bgen(jjtree) logical_factor */ + SimpleNode jjtn000 = new SimpleNode(JJTLOGICAL_FACTOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 12: + jj_consume_token(12); + break; + default: + jj_la1[100] = jj_gen; + ; + } + relation(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void relation() throws ParseException { + /*@bgen(jjtree) relation */ + SimpleNode jjtn000 = new SimpleNode(JJTRELATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + arithmetic_expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 72: + case 73: + case 74: + case 75: + case 76: + case 77: + rel_op(); + arithmetic_expression(); + break; + default: + jj_la1[101] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void rel_op() throws ParseException { + /*@bgen(jjtree) rel_op */ + SimpleNode jjtn000 = new SimpleNode(JJTREL_OP); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 72: + jj_consume_token(72); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = "< "; + break; + case 73: + jj_consume_token(73); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = "<="; + break; + case 74: + jj_consume_token(74); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = " >"; + break; + case 75: + jj_consume_token(75); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = " >="; + break; + case 76: + jj_consume_token(76); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = "=="; + break; + case 77: + jj_consume_token(77); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = "<>"; + break; + default: + jj_la1[102] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void arithmetic_expression() throws ParseException { + /*@bgen(jjtree) arithmetic_expression */ + SimpleNode jjtn000 = new SimpleNode(JJTARITHMETIC_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 78: + case 79: + case 80: + case 81: + add_op(); + break; + default: + jj_la1[103] = jj_gen; + ; + } + term(); + label_32: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 78: + case 79: + case 80: + case 81: + ; + break; + default: + jj_la1[104] = jj_gen; + break label_32; + } + add_op(); + term(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void add_op() throws ParseException { + /*@bgen(jjtree) add_op */ + SimpleNode jjtn000 = new SimpleNode(JJTADD_OP); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 78: + jj_consume_token(78); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = "+"; + break; + case 79: + jj_consume_token(79); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = "-"; + break; + case 80: + jj_consume_token(80); + break; + case 81: + jj_consume_token(81); + break; + default: + jj_la1[105] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void term() throws ParseException { + /*@bgen(jjtree) term */ + SimpleNode jjtn000 = new SimpleNode(JJTTERM); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + factor(); + label_33: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 82: + case 83: + case 84: + case 85: + ; + break; + default: + jj_la1[106] = jj_gen; + break label_33; + } + mul_op(); + factor(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void mul_op() throws ParseException { + /*@bgen(jjtree) mul_op */ + SimpleNode jjtn000 = new SimpleNode(JJTMUL_OP); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 82: + jj_consume_token(82); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = "*"; + break; + case 83: + jj_consume_token(83); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = "/"; + break; + case 84: + jj_consume_token(84); + break; + case 85: + jj_consume_token(85); + break; + default: + jj_la1[107] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void factor() throws ParseException { + /*@bgen(jjtree) factor */ + SimpleNode jjtn000 = new SimpleNode(JJTFACTOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + primary(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 86: + case 87: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 86: + jj_consume_token(86); + break; + case 87: + jj_consume_token(87); + primary(); + break; + default: + jj_la1[108] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[109] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void der_initial() throws ParseException { + /*@bgen(jjtree) der_initial */ + SimpleNode jjtn000 = new SimpleNode(JJTDER_INITIAL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + name(); + jjtn000.op = "application"; + break; + case 58: + jj_consume_token(58); + jjtn000.op = "der"; + break; + case 46: + jj_consume_token(46); + jjtn000.op = "initial"; + break; + default: + jj_la1[110] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + function_call_args(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void subscript_2() throws ParseException { + /*@bgen(jjtree) subscript_2 */ + SimpleNode jjtn000 = new SimpleNode(JJTSUBSCRIPT_2); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + expression_list(); + label_34: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 70: + ; + break; + default: + jj_la1[111] = jj_gen; + break label_34; + } + jj_consume_token(70); + expression_list(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void array() throws ParseException { + /*@bgen(jjtree) array */ + SimpleNode jjtn000 = new SimpleNode(JJTARRAY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(64); + function_arguments(); + jj_consume_token(65); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void primary() throws ParseException { + /*@bgen(jjtree) primary */ + SimpleNode jjtn000 = new SimpleNode(JJTPRIMARY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);Token t; + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case UNSIGNED_NUMBER: + t = jj_consume_token(UNSIGNED_NUMBER); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = token.image; + break; + case UNSIGNED_INTEGER: + t = jj_consume_token(UNSIGNED_INTEGER); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = token.image; + break; + case STRING: + t = jj_consume_token(STRING); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = token.image; + break; + case 6: + t = jj_consume_token(6); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = token.image; + break; + case 33: + t = jj_consume_token(33); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = token.image; + break; + default: + jj_la1[112] = jj_gen; + if (jj_2_9(2147483647)) { + der_initial(); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + case IDENT: + component_reference(); + break; + case 62: + jj_consume_token(62); + expression(); + jj_consume_token(63); + break; + case 66: + jj_consume_token(66); + subscript_2(); + jj_consume_token(67); + break; + case 64: + array(); + break; + case 35: + jj_consume_token(35); + break; + default: + jj_la1[113] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public String name() throws ParseException { + /*@bgen(jjtree) name */ + SimpleNode jjtn000 = new SimpleNode(JJTNAME); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);String ret = new String(""); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + jj_consume_token(68); + ret += "."; + break; + default: + jj_la1[114] = jj_gen; + ; + } + jj_consume_token(IDENT); + ret += token.image; jjtn000.op = token.image; + label_35: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + ; + break; + default: + jj_la1[115] = jj_gen; + break label_35; + } + jj_consume_token(68); + ret += "."; + jj_consume_token(IDENT); + ret += token.image; jjtn000.op = token.image; + } + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + {if (true) return ret;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + throw new Error("Missing return statement in function"); + } + + final public void component_reference() throws ParseException { + /*@bgen(jjtree) component_reference */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPONENT_REFERENCE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000);Token t; + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + jj_consume_token(68); + break; + default: + jj_la1[116] = jj_gen; + ; + } + t = jj_consume_token(IDENT); + jjtn000.op = t.image; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 66: + array_subscripts(); + break; + default: + jj_la1[117] = jj_gen; + ; + } + label_36: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 68: + ; + break; + default: + jj_la1[118] = jj_gen; + break label_36; + } + jj_consume_token(68); + jj_consume_token(IDENT); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 66: + array_subscripts(); + break; + default: + jj_la1[119] = jj_gen; + ; + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void function_call_args() throws ParseException { + /*@bgen(jjtree) function_call_args */ + SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_CALL_ARGS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(62); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 31: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + function_arguments(); + break; + default: + jj_la1[120] = jj_gen; + ; + } + jj_consume_token(63); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void function_arguments() throws ParseException { + /*@bgen(jjtree) function_arguments */ + SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_ARGUMENTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + if (jj_2_10(2)) { + expression(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 21: + case 71: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + jj_consume_token(71); + function_arguments(); + break; + case 21: + jj_consume_token(21); + for_indices(); + break; + default: + jj_la1[121] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[122] = jj_gen; + ; + } + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case IDENT: + named_arguments(); + break; + default: + jj_la1[123] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void named_arguments() throws ParseException { + /*@bgen(jjtree) named_arguments */ + SimpleNode jjtn000 = new SimpleNode(JJTNAMED_ARGUMENTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + named_argument(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + jj_consume_token(71); + named_arguments(); + break; + default: + jj_la1[124] = jj_gen; + ; + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void named_argument() throws ParseException { + /*@bgen(jjtree) named_argument */ + SimpleNode jjtn000 = new SimpleNode(JJTNAMED_ARGUMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(IDENT); + jj_consume_token(88); + expression(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void output_expression_list() throws ParseException { + /*@bgen(jjtree) output_expression_list */ + SimpleNode jjtn000 = new SimpleNode(JJTOUTPUT_EXPRESSION_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 31: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + expression(); + break; + default: + jj_la1[125] = jj_gen; + ; + } + label_37: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[126] = jj_gen; + break label_37; + } + jj_consume_token(71); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 6: + case 12: + case 31: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + expression(); + break; + default: + jj_la1[127] = jj_gen; + ; + } + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void expression_list() throws ParseException { + /*@bgen(jjtree) expression_list */ + SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + expression(); + label_38: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[128] = jj_gen; + break label_38; + } + jj_consume_token(71); + expression(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void array_subscripts() throws ParseException { + /*@bgen(jjtree) array_subscripts */ + SimpleNode jjtn000 = new SimpleNode(JJTARRAY_SUBSCRIPTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(66); + subscript(); + label_39: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 71: + ; + break; + default: + jj_la1[129] = jj_gen; + break label_39; + } + jj_consume_token(71); + subscript(); + } + jj_consume_token(67); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public void subscript() throws ParseException { + /*@bgen(jjtree) subscript */ + SimpleNode jjtn000 = new SimpleNode(JJTSUBSCRIPT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 69: + jj_consume_token(69); + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + jjtn000.op = "all"; + break; + case 6: + case 12: + case 31: + case 33: + case 35: + case 46: + case 58: + case 62: + case 64: + case 66: + case 68: + case 78: + case 79: + case 80: + case 81: + case IDENT: + case STRING: + case UNSIGNED_INTEGER: + case UNSIGNED_NUMBER: + expression(); + break; + default: + jj_la1[130] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + final public String comment() throws ParseException { + String ret; + // string_comment [ annotation ] + ret = string_comment(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 14: + annotation(); + break; + default: + jj_la1[131] = jj_gen; + ; + } + {if (true) return ret;} + throw new Error("Missing return statement in function"); + } + + final public String string_comment() throws ParseException { + String ret = null; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING: + jj_consume_token(STRING); + ret = new String(token.image); + label_40: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 78: + ; + break; + default: + jj_la1[132] = jj_gen; + break label_40; + } + jj_consume_token(78); + ret += "+"; + jj_consume_token(STRING); + ret += token.image; + } + break; + default: + jj_la1[133] = jj_gen; + ; + } + {if (true) return ret;} + throw new Error("Missing return statement in function"); + } + + final public void annotation() throws ParseException { + /*@bgen(jjtree) annotation */ + SimpleNode jjtn000 = new SimpleNode(JJTANNOTATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); + try { + jj_consume_token(14); + class_modification(); + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + {if (true) throw (RuntimeException)jjte000;} + } + if (jjte000 instanceof ParseException) { + {if (true) throw (ParseException)jjte000;} + } + {if (true) throw (Error)jjte000;} + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } + } + + private boolean jj_2_1(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_1(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(0, xla); } + } + + private boolean jj_2_2(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_2(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(1, xla); } + } + + private boolean jj_2_3(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_3(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(2, xla); } + } + + private boolean jj_2_4(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_4(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(3, xla); } + } + + private boolean jj_2_5(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_5(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(4, xla); } + } + + private boolean jj_2_6(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_6(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(5, xla); } + } + + private boolean jj_2_7(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_7(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(6, xla); } + } + + private boolean jj_2_8(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_8(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(7, xla); } + } + + private boolean jj_2_9(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_9(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(8, xla); } + } + + private boolean jj_2_10(int xla) { + jj_la = xla; jj_lastpos = jj_scanpos = token; + try { return !jj_3_10(); } + catch(LookaheadSuccess ls) { return true; } + finally { jj_save(9, xla); } + } + + private boolean jj_3_10() { + if (jj_3R_47()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_48()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_158() { + if (jj_3R_157()) return true; + return false; + } + + private boolean jj_3R_157() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_10()) { + jj_scanpos = xsp; + if (jj_3R_161()) return true; + } + return false; + } + + private boolean jj_3R_85() { + if (jj_3R_93()) return true; + return false; + } + + private boolean jj_3R_120() { + if (jj_scan_token(75)) return true; + return false; + } + + private boolean jj_3R_125() { + if (jj_scan_token(49)) return true; + return false; + } + + private boolean jj_3R_74() { + if (jj_scan_token(62)) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_158()) jj_scanpos = xsp; + if (jj_scan_token(63)) return true; + return false; + } + + private boolean jj_3R_42() { + if (jj_3R_43()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_50()) { jj_scanpos = xsp; break; } + } + xsp = jj_scanpos; + if (jj_3R_51()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_52()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_103() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(50)) jj_scanpos = xsp; + if (jj_scan_token(44)) return true; + return false; + } + + private boolean jj_3R_147() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(68)) jj_scanpos = xsp; + if (jj_scan_token(IDENT)) return true; + xsp = jj_scanpos; + if (jj_3R_153()) jj_scanpos = xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_154()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_78() { + if (jj_scan_token(68)) return true; + if (jj_scan_token(IDENT)) return true; + return false; + } + + private boolean jj_3R_151() { + if (jj_scan_token(58)) return true; + return false; + } + + private boolean jj_3R_71() { + if (jj_scan_token(21)) return true; + if (jj_3R_85()) return true; + return false; + } + + private boolean jj_3R_77() { + if (jj_scan_token(68)) return true; + return false; + } + + private boolean jj_3R_60() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_77()) jj_scanpos = xsp; + if (jj_scan_token(IDENT)) return true; + while (true) { + xsp = jj_scanpos; + if (jj_3R_78()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_46() { + if (jj_3R_60()) return true; + return false; + } + + private boolean jj_3_9() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_46()) { + jj_scanpos = xsp; + if (jj_scan_token(58)) { + jj_scanpos = xsp; + if (jj_scan_token(46)) return true; + } + } + if (jj_scan_token(62)) return true; + return false; + } + + private boolean jj_3R_119() { + if (jj_scan_token(74)) return true; + return false; + } + + private boolean jj_3_4() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + if (jj_scan_token(58)) return true; + return false; + } + + private boolean jj_3_3() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + if (jj_scan_token(40)) return true; + return false; + } + + private boolean jj_3_2() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + return false; + } + + private boolean jj_3R_156() { + if (jj_scan_token(70)) return true; + return false; + } + + private boolean jj_3R_142() { + if (jj_3R_149()) return true; + return false; + } + + private boolean jj_3_1() { + if (jj_scan_token(IDENT)) return true; + if (jj_3R_41()) return true; + if (jj_3R_42()) return true; + if (jj_scan_token(35)) return true; + return false; + } + + private boolean jj_3R_141() { + if (jj_scan_token(66)) return true; + if (jj_3R_148()) return true; + if (jj_scan_token(67)) return true; + return false; + } + + private boolean jj_3R_140() { + if (jj_scan_token(62)) return true; + if (jj_3R_47()) return true; + if (jj_scan_token(63)) return true; + return false; + } + + private boolean jj_3R_138() { + if (jj_3R_146()) return true; + return false; + } + + private boolean jj_3R_104() { + if (jj_scan_token(26)) return true; + return false; + } + + private boolean jj_3R_139() { + if (jj_3R_147()) return true; + return false; + } + + private boolean jj_3R_137() { + if (jj_scan_token(33)) return true; + return false; + } + + private boolean jj_3R_133() { + if (jj_scan_token(UNSIGNED_NUMBER)) return true; + return false; + } + + private boolean jj_3R_130() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_133()) { + jj_scanpos = xsp; + if (jj_3R_134()) { + jj_scanpos = xsp; + if (jj_3R_135()) { + jj_scanpos = xsp; + if (jj_3R_136()) { + jj_scanpos = xsp; + if (jj_3R_137()) { + jj_scanpos = xsp; + if (jj_3R_138()) { + jj_scanpos = xsp; + if (jj_3R_139()) { + jj_scanpos = xsp; + if (jj_3R_140()) { + jj_scanpos = xsp; + if (jj_3R_141()) { + jj_scanpos = xsp; + if (jj_3R_142()) { + jj_scanpos = xsp; + if (jj_scan_token(35)) return true; + } + } + } + } + } + } + } + } + } + } + return false; + } + + private boolean jj_3R_136() { + if (jj_scan_token(6)) return true; + return false; + } + + private boolean jj_3R_145() { + if (jj_scan_token(83)) return true; + return false; + } + + private boolean jj_3R_143() { + if (jj_scan_token(87)) return true; + if (jj_3R_130()) return true; + return false; + } + + private boolean jj_3R_135() { + if (jj_scan_token(STRING)) return true; + return false; + } + + private boolean jj_3R_134() { + if (jj_scan_token(UNSIGNED_INTEGER)) return true; + return false; + } + + private boolean jj_3R_124() { + if (jj_scan_token(42)) return true; + return false; + } + + private boolean jj_3R_131() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(86)) { + jj_scanpos = xsp; + if (jj_3R_143()) return true; + } + return false; + } + + private boolean jj_3R_149() { + if (jj_scan_token(64)) return true; + if (jj_3R_157()) return true; + if (jj_scan_token(65)) return true; + return false; + } + + private boolean jj_3R_129() { + if (jj_scan_token(79)) return true; + return false; + } + + private boolean jj_3R_148() { + if (jj_3R_155()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_156()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_150() { + if (jj_3R_60()) return true; + return false; + } + + private boolean jj_3R_118() { + if (jj_scan_token(73)) return true; + return false; + } + + private boolean jj_3R_99() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(30)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(47)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(34)) { + jj_scanpos = xsp; + if (jj_scan_token(7)) { + jj_scanpos = xsp; + if (jj_scan_token(61)) { + jj_scanpos = xsp; + if (jj_scan_token(24)) { + jj_scanpos = xsp; + if (jj_3R_103()) { + jj_scanpos = xsp; + if (jj_scan_token(38)) { + jj_scanpos = xsp; + if (jj_scan_token(37)) { + jj_scanpos = xsp; + if (jj_3R_104()) { + jj_scanpos = xsp; + if (jj_scan_token(17)) { + jj_scanpos = xsp; + if (jj_scan_token(94)) { + jj_scanpos = xsp; + if (jj_scan_token(95)) return true; + } + } + } + } + } + } + } + } + } + } + return false; + } + + private boolean jj_3R_115() { + if (jj_3R_130()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_131()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_146() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_150()) { + jj_scanpos = xsp; + if (jj_3R_151()) { + jj_scanpos = xsp; + if (jj_3R_152()) return true; + } + } + if (jj_3R_74()) return true; + return false; + } + + private boolean jj_3R_116() { + if (jj_3R_132()) return true; + if (jj_3R_115()) return true; + return false; + } + + private boolean jj_3R_109() { + if (jj_3R_114()) return true; + if (jj_3R_108()) return true; + return false; + } + + private boolean jj_3R_102() { + if (jj_3R_110()) return true; + if (jj_3R_101()) return true; + return false; + } + + private boolean jj_3R_144() { + if (jj_scan_token(82)) return true; + return false; + } + + private boolean jj_3R_132() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_144()) { + jj_scanpos = xsp; + if (jj_3R_145()) { + jj_scanpos = xsp; + if (jj_scan_token(84)) { + jj_scanpos = xsp; + if (jj_scan_token(85)) return true; + } + } + } + return false; + } + + private boolean jj_3R_106() { + if (jj_3R_60()) return true; + return false; + } + + private boolean jj_3R_108() { + if (jj_3R_115()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_116()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_70() { + if (jj_scan_token(31)) return true; + if (jj_3R_47()) return true; + return false; + } + + private boolean jj_3R_128() { + if (jj_scan_token(78)) return true; + return false; + } + + private boolean jj_3R_127() { + if (jj_scan_token(56)) return true; + return false; + } + + private boolean jj_3R_114() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_128()) { + jj_scanpos = xsp; + if (jj_3R_129()) { + jj_scanpos = xsp; + if (jj_scan_token(80)) { + jj_scanpos = xsp; + if (jj_scan_token(81)) return true; + } + } + } + return false; + } + + private boolean jj_3_7() { + if (jj_3R_44()) return true; + return false; + } + + private boolean jj_3R_95() { + if (jj_scan_token(9)) return true; + if (jj_3R_94()) return true; + return false; + } + + private boolean jj_3R_107() { + if (jj_3R_114()) return true; + return false; + } + + private boolean jj_3R_126() { + if (jj_scan_token(32)) return true; + return false; + } + + private boolean jj_3R_113() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_126()) { + jj_scanpos = xsp; + if (jj_3R_127()) return true; + } + return false; + } + + private boolean jj_3R_101() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_107()) jj_scanpos = xsp; + if (jj_3R_108()) return true; + while (true) { + xsp = jj_scanpos; + if (jj_3R_109()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_123() { + if (jj_scan_token(5)) return true; + return false; + } + + private boolean jj_3R_117() { + if (jj_scan_token(72)) return true; + return false; + } + + private boolean jj_3R_112() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_123()) { + jj_scanpos = xsp; + if (jj_3R_124()) { + jj_scanpos = xsp; + if (jj_3R_125()) return true; + } + } + return false; + } + + private boolean jj_3R_110() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_117()) { + jj_scanpos = xsp; + if (jj_3R_118()) { + jj_scanpos = xsp; + if (jj_3R_119()) { + jj_scanpos = xsp; + if (jj_3R_120()) { + jj_scanpos = xsp; + if (jj_3R_121()) { + jj_scanpos = xsp; + if (jj_3R_122()) return true; + } + } + } + } + } + return false; + } + + private boolean jj_3R_111() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(16)) { + jj_scanpos = xsp; + if (jj_scan_token(23)) return true; + } + return false; + } + + private boolean jj_3R_76() { + if (jj_scan_token(69)) return true; + if (jj_3R_75()) return true; + return false; + } + + private boolean jj_3R_87() { + if (jj_scan_token(22)) return true; + if (jj_3R_86()) return true; + return false; + } + + private boolean jj_3R_105() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_111()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_112()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_113()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_98() { + if (jj_3R_101()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_102()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_67() { + if (jj_3R_81()) return true; + return false; + } + + private boolean jj_3R_62() { + if (jj_3R_79()) return true; + return false; + } + + private boolean jj_3R_94() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(12)) jj_scanpos = xsp; + if (jj_3R_98()) return true; + return false; + } + + private boolean jj_3R_58() { + if (jj_scan_token(IDENT)) return true; + if (jj_3R_74()) return true; + return false; + } + + private boolean jj_3R_57() { + if (jj_3R_73()) return true; + return false; + } + + private boolean jj_3R_56() { + if (jj_3R_72()) return true; + return false; + } + + private boolean jj_3R_55() { + if (jj_3R_71()) return true; + return false; + } + + private boolean jj_3R_86() { + if (jj_3R_94()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_95()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_54() { + if (jj_3R_70()) return true; + return false; + } + + private boolean jj_3R_75() { + if (jj_3R_86()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_87()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3_8() { + if (jj_3R_45()) return true; + return false; + } + + private boolean jj_3R_59() { + if (jj_3R_75()) return true; + Token xsp; + xsp = jj_scanpos; + if (jj_3R_76()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_66() { + if (jj_3R_80()) return true; + return false; + } + + private boolean jj_3R_100() { + if (jj_3R_105()) return true; + if (jj_3R_106()) return true; + return false; + } + + private boolean jj_3R_61() { + if (jj_3R_59()) return true; + return false; + } + + private boolean jj_3R_47() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_61()) { + jj_scanpos = xsp; + if (jj_3R_62()) return true; + } + return false; + } + + private boolean jj_3R_165() { + if (jj_3R_47()) return true; + return false; + } + + private boolean jj_3R_44() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_8()) { + jj_scanpos = xsp; + if (jj_3R_54()) { + jj_scanpos = xsp; + if (jj_3R_55()) { + jj_scanpos = xsp; + if (jj_3R_56()) { + jj_scanpos = xsp; + if (jj_3R_57()) { + jj_scanpos = xsp; + if (jj_3R_58()) return true; + } + } + } + } + } + return false; + } + + private boolean jj_3R_68() { + if (jj_scan_token(14)) return true; + return false; + } + + private boolean jj_3R_97() { + if (jj_3R_100()) return true; + return false; + } + + private boolean jj_3R_79() { + if (jj_scan_token(31)) return true; + if (jj_3R_47()) return true; + return false; + } + + private boolean jj_3R_154() { + if (jj_scan_token(68)) return true; + if (jj_scan_token(IDENT)) return true; + return false; + } + + private boolean jj_3_6() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + return false; + } + + private boolean jj_3R_64() { + if (jj_scan_token(21)) return true; + return false; + } + + private boolean jj_3R_49() { + if (jj_scan_token(STRING)) return true; + return false; + } + + private boolean jj_3R_90() { + if (jj_scan_token(55)) return true; + return false; + } + + private boolean jj_3R_122() { + if (jj_scan_token(77)) return true; + return false; + } + + private boolean jj_3R_45() { + if (jj_3R_59()) return true; + if (jj_scan_token(88)) return true; + if (jj_3R_47()) return true; + return false; + } + + private boolean jj_3R_81() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(46)) jj_scanpos = xsp; + if (jj_scan_token(4)) return true; + return false; + } + + private boolean jj_3R_41() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_49()) jj_scanpos = xsp; + return false; + } + + private boolean jj_3R_88() { + if (jj_scan_token(46)) return true; + return false; + } + + private boolean jj_3R_72() { + if (jj_scan_token(39)) return true; + if (jj_scan_token(62)) return true; + return false; + } + + private boolean jj_3R_89() { + if (jj_scan_token(36)) return true; + return false; + } + + private boolean jj_3R_80() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_88()) jj_scanpos = xsp; + if (jj_scan_token(45)) return true; + return false; + } + + private boolean jj_3R_92() { + if (jj_scan_token(13)) return true; + return false; + } + + private boolean jj_3R_65() { + if (jj_scan_token(52)) return true; + return false; + } + + private boolean jj_3R_96() { + if (jj_3R_99()) return true; + return false; + } + + private boolean jj_3R_91() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_96()) { + jj_scanpos = xsp; + if (jj_3R_97()) return true; + } + return false; + } + + private boolean jj_3R_164() { + if (jj_scan_token(69)) return true; + return false; + } + + private boolean jj_3R_84() { + Token xsp; + xsp = jj_scanpos; + if (jj_scan_token(8)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(11)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(51)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_scan_token(27)) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_91()) { + jj_scanpos = xsp; + if (jj_3R_92()) return true; + } + return false; + } + + private boolean jj_3R_162() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_164()) { + jj_scanpos = xsp; + if (jj_3R_165()) return true; + } + return false; + } + + private boolean jj_3R_160() { + if (jj_scan_token(71)) return true; + return false; + } + + private boolean jj_3R_83() { + if (jj_3R_90()) return true; + return false; + } + + private boolean jj_3R_153() { + if (jj_3R_159()) return true; + return false; + } + + private boolean jj_3R_82() { + if (jj_3R_89()) return true; + return false; + } + + private boolean jj_3R_159() { + if (jj_scan_token(66)) return true; + if (jj_3R_162()) return true; + return false; + } + + private boolean jj_3R_63() { + if (jj_scan_token(71)) return true; + return false; + } + + private boolean jj_3R_48() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_63()) { + jj_scanpos = xsp; + if (jj_3R_64()) return true; + } + return false; + } + + private boolean jj_3R_69() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_82()) { + jj_scanpos = xsp; + if (jj_3R_83()) { + jj_scanpos = xsp; + if (jj_3R_84()) return true; + } + } + return false; + } + + private boolean jj_3R_121() { + if (jj_scan_token(76)) return true; + return false; + } + + private boolean jj_3R_53() { + if (jj_3R_69()) return true; + return false; + } + + private boolean jj_3R_43() { + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_53()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_155() { + if (jj_3R_47()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_160()) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_73() { + if (jj_scan_token(43)) return true; + if (jj_3R_47()) return true; + return false; + } + + private boolean jj_3R_166() { + if (jj_scan_token(IDENT)) return true; + if (jj_scan_token(88)) return true; + return false; + } + + private boolean jj_3R_152() { + if (jj_scan_token(46)) return true; + return false; + } + + private boolean jj_3R_163() { + if (jj_3R_166()) return true; + return false; + } + + private boolean jj_3R_52() { + if (jj_3R_68()) return true; + return false; + } + + private boolean jj_3R_51() { + if (jj_scan_token(59)) return true; + return false; + } + + private boolean jj_3R_161() { + if (jj_3R_163()) return true; + return false; + } + + private boolean jj_3R_50() { + Token xsp; + xsp = jj_scanpos; + if (jj_3_5()) { + jj_scanpos = xsp; + if (jj_3R_65()) { + jj_scanpos = xsp; + if (jj_3R_66()) { + jj_scanpos = xsp; + if (jj_3R_67()) return true; + } + } + } + return false; + } + + private boolean jj_3_5() { + if (jj_scan_token(57)) return true; + if (jj_3R_43()) return true; + return false; + } + + private boolean jj_3R_93() { + if (jj_scan_token(IDENT)) return true; + return false; + } + + /** Generated Token Manager. */ + public ModelParserTokenManager token_source; + SimpleCharStream jj_input_stream; + /** Current token. */ + public Token token; + /** Next token. */ + public Token jj_nt; + private int jj_ntk; + private Token jj_scanpos, jj_lastpos; + private int jj_la; + private int jj_gen; + final private int[] jj_la1 = new int[134]; + static private int[] jj_la1_0; + static private int[] jj_la1_1; + static private int[] jj_la1_2; + static { + jj_la1_init_0(); + jj_la1_init_1(); + jj_la1_init_2(); + } + private static void jj_la1_init_0() { + jj_la1_0 = new int[] {0x0,0x0,0x45020880,0x800,0x40000000,0x0,0x0,0x5020080,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x10,0x0,0x0,0x4000,0x0,0x4000,0x0,0x80001040,0x4d8329a0,0x100,0x800,0x0,0x8000000,0x458300a0,0x458300a0,0x0,0x458320a0,0x4d8329a0,0x0,0x0,0x0,0x4000,0x0,0x0,0x810000,0x810000,0x20,0x20,0x0,0x0,0x0,0x80000000,0x0,0x0,0x0,0x0,0x2d00,0x0,0x2d00,0x400,0x800,0x2000,0x0,0x400,0x800,0x458300a0,0x458320a0,0x458300a0,0x0,0x0,0x0,0xa0240000,0x80200000,0x0,0xa0240000,0x80201040,0x100000,0x80201040,0x80201040,0x8000,0xa0240000,0x100000,0xa0240000,0xa0240000,0x8000,0x80201040,0xa0240000,0x0,0x0,0xa0240000,0x80201040,0x2000000,0x80201040,0xa0240000,0x2000000,0xa0240000,0x100000,0x80001040,0x100000,0x80001040,0x0,0x0,0x400000,0x200,0x1000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x80001040,0x200000,0x200000,0x0,0x0,0x80001040,0x0,0x80001040,0x0,0x0,0x80001040,0x4000,0x0,0x0,}; + } + private static void jj_la1_init_1() { + jj_la1_1 = new int[] {0x0,0x200000,0x20049064,0x0,0x0,0x8000,0x40000,0x20041064,0x0,0x40000000,0x0,0x0,0x40000000,0x800000,0x0,0x2106000,0x106000,0x0,0x0,0x0,0x8000000,0x0,0x0,0x4400400a,0x218e9475,0x0,0x0,0x80000,0x0,0x21069465,0x21069465,0x400000,0x21069465,0x218e9475,0x0,0x0,0x40000000,0x0,0x40000000,0x0,0x0,0x0,0x20400,0x20400,0x1000001,0x1000001,0x0,0x0,0x0,0x40000000,0x0,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,0x0,0x21069465,0x21069465,0x21069465,0x400000,0x4000,0x4000,0x40010800,0x880,0x40000000,0x40010800,0x4400488a,0x0,0x4400488a,0x4400488a,0x0,0x40010800,0x0,0x40010800,0x40010800,0x0,0x4400488a,0x40010800,0x0,0x200,0x40010800,0x4400488a,0x0,0x4400488a,0x40010800,0x0,0x40010800,0x0,0x4400400a,0x0,0x4400400a,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4004000,0x0,0x2,0x40000008,0x0,0x0,0x0,0x0,0x0,0x0,0x4400400a,0x0,0x0,0x0,0x0,0x4400400a,0x0,0x4400400a,0x0,0x0,0x4400400a,0x0,0x0,0x0,}; + } + private static void jj_la1_init_2() { + jj_la1_2 = new int[] {0x4000010,0x0,0xc0000000,0x0,0x0,0x0,0x0,0xc0000000,0x4,0x0,0x4000000,0x80,0x0,0x0,0x80,0x0,0x0,0x8000000,0x4000010,0x0,0x0,0x0,0x4000010,0x3c03c015,0xc4000010,0x0,0x0,0x0,0x0,0xc4000010,0xc4000010,0x0,0xc4000010,0xc4000010,0x10,0x4000010,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x4,0x3000000,0x1000000,0x3000000,0x4000010,0x80,0x4000010,0x0,0x0,0x4000010,0x3000000,0x0,0x0,0xc4000010,0xc4000010,0xc4000010,0x0,0x0,0x0,0x4000010,0x4000000,0x2000000,0x4000010,0x3c03c015,0x0,0x3c03c015,0x3c03c015,0x0,0x4000010,0x0,0x4000010,0x4000010,0x0,0x3c03c015,0x4000010,0x80,0x0,0x4000010,0x3c03c015,0x0,0x3c03c015,0x4000010,0x0,0x4000010,0x0,0x3c03c015,0x0,0x3c03c015,0x20,0x20,0x0,0x0,0x0,0x3f00,0x3f00,0x3c000,0x3c000,0x3c000,0x3c0000,0x3c0000,0xc00000,0xc00000,0x4000010,0x40,0x38000000,0x4000015,0x10,0x10,0x10,0x4,0x10,0x4,0x3c03c015,0x80,0x80,0x4000000,0x80,0x3c03c015,0x80,0x3c03c015,0x80,0x80,0x3c03c035,0x0,0x4000,0x8000000,}; + } + final private JJCalls[] jj_2_rtns = new JJCalls[10]; + private boolean jj_rescan = false; + private int jj_gc = 0; + + /** Constructor with InputStream. */ + public ModelParser(java.io.InputStream stream) { + this(stream, null); + } + /** Constructor with InputStream and supplied encoding */ + public ModelParser(java.io.InputStream stream, String encoding) { + try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source = new ModelParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 134; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream stream) { + ReInit(stream, null); + } + /** Reinitialise. */ + public void ReInit(java.io.InputStream stream, String encoding) { + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + jj_gen = 0; + for (int i = 0; i < 134; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Constructor. */ + public ModelParser(java.io.Reader stream) { + jj_input_stream = new SimpleCharStream(stream, 1, 1); + token_source = new ModelParserTokenManager(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 134; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader stream) { + jj_input_stream.ReInit(stream, 1, 1); + token_source.ReInit(jj_input_stream); + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + jj_gen = 0; + for (int i = 0; i < 134; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Constructor with generated Token Manager. */ + public ModelParser(ModelParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jj_gen = 0; + for (int i = 0; i < 134; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + /** Reinitialise. */ + public void ReInit(ModelParserTokenManager tm) { + token_source = tm; + token = new Token(); + jj_ntk = -1; + jjtree.reset(); + jj_gen = 0; + for (int i = 0; i < 134; i++) jj_la1[i] = -1; + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); + } + + private Token jj_consume_token(int kind) throws ParseException { + Token oldToken; + if ((oldToken = token).next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + if (token.kind == kind) { + jj_gen++; + if (++jj_gc > 100) { + jj_gc = 0; + for (int i = 0; i < jj_2_rtns.length; i++) { + JJCalls c = jj_2_rtns[i]; + while (c != null) { + if (c.gen < jj_gen) c.first = null; + c = c.next; + } + } + } + return token; + } + token = oldToken; + jj_kind = kind; + throw generateParseException(); + } + + static private final class LookaheadSuccess extends java.lang.Error { } + final private LookaheadSuccess jj_ls = new LookaheadSuccess(); + private boolean jj_scan_token(int kind) { + if (jj_scanpos == jj_lastpos) { + jj_la--; + if (jj_scanpos.next == null) { + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); + } else { + jj_lastpos = jj_scanpos = jj_scanpos.next; + } + } else { + jj_scanpos = jj_scanpos.next; + } + if (jj_rescan) { + int i = 0; Token tok = token; + while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } + if (tok != null) jj_add_error_token(kind, i); + } + if (jj_scanpos.kind != kind) return true; + if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; + return false; + } + + +/** Get the next Token. */ + final public Token getNextToken() { + if (token.next != null) token = token.next; + else token = token.next = token_source.getNextToken(); + jj_ntk = -1; + jj_gen++; + return token; + } + +/** Get the specific Token. */ + final public Token getToken(int index) { + Token t = token; + for (int i = 0; i < index; i++) { + if (t.next != null) t = t.next; + else t = t.next = token_source.getNextToken(); + } + return t; + } + + private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + private java.util.List jj_expentries = new java.util.ArrayList(); + private int[] jj_expentry; + private int jj_kind = -1; + private int[] jj_lasttokens = new int[100]; + private int jj_endpos; + + private void jj_add_error_token(int kind, int pos) { + if (pos >= 100) return; + if (pos == jj_endpos + 1) { + jj_lasttokens[jj_endpos++] = kind; + } else if (jj_endpos != 0) { + jj_expentry = new int[jj_endpos]; + for (int i = 0; i < jj_endpos; i++) { + jj_expentry[i] = jj_lasttokens[i]; + } + jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { + int[] oldentry = (int[])(it.next()); + if (oldentry.length == jj_expentry.length) { + for (int i = 0; i < jj_expentry.length; i++) { + if (oldentry[i] != jj_expentry[i]) { + continue jj_entries_loop; + } + } + jj_expentries.add(jj_expentry); + break jj_entries_loop; + } + } + if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; + } + } + + /** Generate ParseException. */ + public ParseException generateParseException() { + jj_expentries.clear(); + boolean[] la1tokens = new boolean[96]; + if (jj_kind >= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 134; i++) { + if (jj_la1[i] == jj_gen) { + for (int j = 0; j < 32; j++) { + if ((jj_la1_0[i] & (1< jj_gen) { + jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; + switch (i) { + case 0: jj_3_1(); break; + case 1: jj_3_2(); break; + case 2: jj_3_3(); break; + case 3: jj_3_4(); break; + case 4: jj_3_5(); break; + case 5: jj_3_6(); break; + case 6: jj_3_7(); break; + case 7: jj_3_8(); break; + case 8: jj_3_9(); break; + case 9: jj_3_10(); break; + } + } + p = p.next; + } while (p != null); + } catch(LookaheadSuccess ls) { } + } + jj_rescan = false; + } + + private void jj_save(int index, int xla) { + JJCalls p = jj_2_rtns[index]; + while (p.gen > jj_gen) { + if (p.next == null) { p = p.next = new JJCalls(); break; } + p = p.next; + } + p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; + } + + static final class JJCalls { + int gen; + Token first; + int arg; + JJCalls next; + } + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserConstants.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserConstants.java new file mode 100644 index 00000000..1f375ca7 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserConstants.java @@ -0,0 +1,131 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. ModelParserConstants.java */ +package fi.semantum.sysdyn.solver.parser; + + +/** + * Token literal values and constants. + * Generated by org.javacc.parser.OtherFilesGen#start() + */ +public interface ModelParserConstants { + + /** End of File. */ + int EOF = 0; + /** RegularExpression Id. */ + int WHITESPACE = 1; + /** RegularExpression Id. */ + int COMMENT1 = 2; + /** RegularExpression Id. */ + int COMMENT2 = 3; + /** RegularExpression Id. */ + int IDENT = 90; + /** RegularExpression Id. */ + int STRING = 91; + /** RegularExpression Id. */ + int UNSIGNED_INTEGER = 92; + /** RegularExpression Id. */ + int UNSIGNED_NUMBER = 93; + + /** Lexical state. */ + int DEFAULT = 0; + + /** Literal token values. */ + String[] tokenImage = { + "", + "", + "", + "", + "\"algorithm\"", + "\"discrete\"", + "\"false\"", + "\"model\"", + "\"redeclare\"", + "\"and\"", + "\"each\"", + "\"final\"", + "\"not\"", + "\"replaceable\"", + "\"annotation\"", + "\"else\"", + "\"flow\"", + "\"operator\"", + "\"return\"", + "\"assert\"", + "\"elseif\"", + "\"for\"", + "\"or\"", + "\"stream\"", + "\"block\"", + "\"elsewhen\"", + "\"function\"", + "\"outer\"", + "\"then\"", + "\"break\"", + "\"encapsulated\"", + "\"if\"", + "\"output\"", + "\"true\"", + "\"class\"", + "\"end\"", + "\"import\"", + "\"package\"", + "\"type\"", + "\"connect\"", + "\"enumeration\"", + "\"in\"", + "\"parameter\"", + "\"when\"", + "\"connector\"", + "\"equation\"", + "\"initial\"", + "\"partial\"", + "\"while\"", + "\"constant\"", + "\"expandable\"", + "\"inner\"", + "\"protected\"", + "\"within\"", + "\"constrainedby\"", + "\"extends\"", + "\"input\"", + "\"public\"", + "\"der\"", + "\"external\"", + "\"loop\"", + "\"record\"", + "\"(\"", + "\")\"", + "\"{\"", + "\"}\"", + "\"[\"", + "\"]\"", + "\".\"", + "\":\"", + "\";\"", + "\",\"", + "\"<\"", + "\"<=\"", + "\">\"", + "\">=\"", + "\"==\"", + "\"<>\"", + "\"+\"", + "\"-\"", + "\".+\"", + "\".-\"", + "\"*\"", + "\"/\"", + "\".*\"", + "\"./\"", + "\"^\"", + "\".^\"", + "\"=\"", + "\":=\"", + "", + "", + "", + "", + "\"operator function\"", + "\"operator record\"", + }; + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserTokenManager.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserTokenManager.java new file mode 100644 index 00000000..471f3ac8 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserTokenManager.java @@ -0,0 +1,1484 @@ +/* Generated By:JJTree&JavaCC: Do not edit this line. ModelParserTokenManager.java */ +package fi.semantum.sysdyn.solver.parser; +import java.util.ArrayList; + +/** Token Manager. */ +public class ModelParserTokenManager implements ModelParserConstants +{ + + /** Debug output. */ + public java.io.PrintStream debugStream = System.out; + /** Set debug output. */ + public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } +private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) +{ + switch (pos) + { + case 0: + if ((active1 & 0x80000L) != 0L) + return 15; + if ((active1 & 0x8000L) != 0L) + return 37; + if ((active1 & 0xb30010L) != 0L) + return 9; + if ((active0 & 0x3ffffffffffffff0L) != 0L || (active1 & 0xc0000000L) != 0L) + { + jjmatchedKind = 90; + return 2; + } + return -1; + case 1: + if ((active1 & 0x20000L) != 0L) + return 10; + if ((active0 & 0x108420080400000L) != 0L) + return 2; + if ((active0 & 0x3ef7bdff7fbffff0L) != 0L || (active1 & 0xc0000000L) != 0L) + { + if (jjmatchedPos != 1) + { + jjmatchedKind = 90; + jjmatchedPos = 1; + } + return 2; + } + return -1; + case 2: + if ((active0 & 0x400000800201200L) != 0L) + return 2; + if ((active0 & 0x3bfffdf77f9fedf0L) != 0L || (active1 & 0xc0000000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 2; + return 2; + } + return -1; + case 3: + if ((active0 & 0x1000084212118400L) != 0L) + return 2; + if ((active0 & 0x2bfff5b56d8e69f0L) != 0L || (active1 & 0xc0000000L) != 0L) + { + if (jjmatchedPos != 3) + { + jjmatchedKind = 90; + jjmatchedPos = 3; + } + return 2; + } + return -1; + case 4: + if ((active0 & 0x1090004290008c0L) != 0L) + return 2; + if ((active0 & 0x2af6f5b1469e6130L) != 0L || (active1 & 0xc0000000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 4; + return 2; + } + return -1; + case 5: + if ((active0 & 0x22200011009c0000L) != 0L) + return 2; + if ((active0 & 0x8d6f5a046026130L) != 0L || (active1 & 0xc0000000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 5; + return 2; + } + return -1; + case 6: + if ((active0 & 0x80d0a000000000L) != 0L) + return 2; + if ((active0 & 0x856250046026130L) != 0L || (active1 & 0xc0000000L) != 0L) + { + if (jjmatchedPos != 6) + { + jjmatchedKind = 90; + jjmatchedPos = 6; + } + return 2; + } + return -1; + case 7: + if ((active0 & 0x54150040006110L) != 0L) + { + if (jjmatchedPos != 7) + { + jjmatchedKind = 90; + jjmatchedPos = 7; + } + return 2; + } + if ((active0 & 0x802200006020020L) != 0L || (active1 & 0xc0000000L) != 0L) + return 2; + return -1; + case 8: + if ((active0 & 0x10140000000110L) != 0L) + return 2; + if ((active0 & 0x44010040006000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 8; + return 2; + } + return -1; + case 9: + if ((active0 & 0x40010040002000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 9; + return 2; + } + if ((active0 & 0x4000000004000L) != 0L) + return 2; + return -1; + case 10: + if ((active0 & 0x10000002000L) != 0L) + return 2; + if ((active0 & 0x40000040000000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 10; + return 2; + } + return -1; + case 11: + if ((active0 & 0x40000000L) != 0L) + return 2; + if ((active0 & 0x40000000000000L) != 0L) + { + jjmatchedKind = 90; + jjmatchedPos = 11; + return 2; + } + return -1; + case 12: + if ((active0 & 0x40000000000000L) != 0L) + return 2; + return -1; + default : + return -1; + } +} +private final int jjStartNfa_0(int pos, long active0, long active1) +{ + return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1); +} +private int jjStopAtPos(int pos, int kind) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; +} +private int jjMoveStringLiteralDfa0_0() +{ + switch(curChar) + { + case 40: + return jjStopAtPos(0, 62); + case 41: + return jjStopAtPos(0, 63); + case 42: + return jjStopAtPos(0, 82); + case 43: + return jjStopAtPos(0, 78); + case 44: + return jjStopAtPos(0, 71); + case 45: + return jjStartNfaWithStates_0(0, 79, 37); + case 46: + jjmatchedKind = 68; + return jjMoveStringLiteralDfa1_0(0x0L, 0xb30000L); + case 47: + return jjStartNfaWithStates_0(0, 83, 15); + case 58: + jjmatchedKind = 69; + return jjMoveStringLiteralDfa1_0(0x0L, 0x2000000L); + case 59: + return jjStopAtPos(0, 70); + case 60: + jjmatchedKind = 72; + return jjMoveStringLiteralDfa1_0(0x0L, 0x2200L); + case 61: + jjmatchedKind = 88; + return jjMoveStringLiteralDfa1_0(0x0L, 0x1000L); + case 62: + jjmatchedKind = 74; + return jjMoveStringLiteralDfa1_0(0x0L, 0x800L); + case 91: + return jjStopAtPos(0, 66); + case 93: + return jjStopAtPos(0, 67); + case 94: + return jjStopAtPos(0, 86); + case 97: + return jjMoveStringLiteralDfa1_0(0x84210L, 0x0L); + case 98: + return jjMoveStringLiteralDfa1_0(0x21000000L, 0x0L); + case 99: + return jjMoveStringLiteralDfa1_0(0x42108400000000L, 0x0L); + case 100: + return jjMoveStringLiteralDfa1_0(0x400000000000020L, 0x0L); + case 101: + return jjMoveStringLiteralDfa1_0(0x884210842108400L, 0x0L); + case 102: + return jjMoveStringLiteralDfa1_0(0x4210840L, 0x0L); + case 105: + return jjMoveStringLiteralDfa1_0(0x108421080000000L, 0x0L); + case 108: + return jjMoveStringLiteralDfa1_0(0x1000000000000000L, 0x0L); + case 109: + return jjMoveStringLiteralDfa1_0(0x80L, 0x0L); + case 110: + return jjMoveStringLiteralDfa1_0(0x1000L, 0x0L); + case 111: + return jjMoveStringLiteralDfa1_0(0x108420000L, 0xc0000000L); + case 112: + return jjMoveStringLiteralDfa1_0(0x210842000000000L, 0x0L); + case 114: + return jjMoveStringLiteralDfa1_0(0x2000000000042100L, 0x0L); + case 115: + return jjMoveStringLiteralDfa1_0(0x800000L, 0x0L); + case 116: + return jjMoveStringLiteralDfa1_0(0x4210000000L, 0x0L); + case 119: + return jjMoveStringLiteralDfa1_0(0x21080000000000L, 0x0L); + case 123: + return jjStopAtPos(0, 64); + case 125: + return jjStopAtPos(0, 65); + default : + return jjMoveNfa_0(0, 0); + } +} +private int jjMoveStringLiteralDfa1_0(long active0, long active1) +{ + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(0, active0, active1); + return 1; + } + switch(curChar) + { + case 42: + if ((active1 & 0x100000L) != 0L) + return jjStopAtPos(1, 84); + break; + case 43: + if ((active1 & 0x10000L) != 0L) + return jjStopAtPos(1, 80); + break; + case 45: + if ((active1 & 0x20000L) != 0L) + return jjStartNfaWithStates_0(1, 81, 10); + break; + case 47: + if ((active1 & 0x200000L) != 0L) + return jjStopAtPos(1, 85); + break; + case 61: + if ((active1 & 0x200L) != 0L) + return jjStopAtPos(1, 73); + else if ((active1 & 0x800L) != 0L) + return jjStopAtPos(1, 75); + else if ((active1 & 0x1000L) != 0L) + return jjStopAtPos(1, 76); + else if ((active1 & 0x2000000L) != 0L) + return jjStopAtPos(1, 89); + break; + case 62: + if ((active1 & 0x2000L) != 0L) + return jjStopAtPos(1, 77); + break; + case 94: + if ((active1 & 0x800000L) != 0L) + return jjStopAtPos(1, 87); + break; + case 97: + return jjMoveStringLiteralDfa2_0(active0, 0x842000000440L, active1, 0L); + case 101: + return jjMoveStringLiteralDfa2_0(active0, 0x2400000000042100L, active1, 0L); + case 102: + if ((active0 & 0x80000000L) != 0L) + return jjStartNfaWithStates_0(1, 31, 2); + break; + case 104: + return jjMoveStringLiteralDfa2_0(active0, 0x1080010000000L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa2_0(active0, 0x20000000000820L, active1, 0L); + case 108: + return jjMoveStringLiteralDfa2_0(active0, 0x403118010L, active1, 0L); + case 109: + return jjMoveStringLiteralDfa2_0(active0, 0x1000000000L, active1, 0L); + case 110: + if ((active0 & 0x20000000000L) != 0L) + { + jjmatchedKind = 41; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0x108410840004200L, active1, 0L); + case 111: + return jjMoveStringLiteralDfa2_0(active0, 0x1042108000201080L, active1, 0L); + case 112: + return jjMoveStringLiteralDfa2_0(active0, 0x20000L, active1, 0xc0000000L); + case 113: + return jjMoveStringLiteralDfa2_0(active0, 0x200000000000L, active1, 0L); + case 114: + if ((active0 & 0x400000L) != 0L) + return jjStartNfaWithStates_0(1, 22, 2); + return jjMoveStringLiteralDfa2_0(active0, 0x10000220000000L, active1, 0L); + case 115: + return jjMoveStringLiteralDfa2_0(active0, 0x80000L, active1, 0L); + case 116: + return jjMoveStringLiteralDfa2_0(active0, 0x800000L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa2_0(active0, 0x20000010c000000L, active1, 0L); + case 120: + return jjMoveStringLiteralDfa2_0(active0, 0x884000000000000L, active1, 0L); + case 121: + return jjMoveStringLiteralDfa2_0(active0, 0x4000000000L, active1, 0L); + default : + break; + } + return jjStartNfa_0(0, active0, active1); +} +private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(0, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(1, active0, active1); + return 2; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa3_0(active0, 0x400000000L, active1, 0L); + case 98: + return jjMoveStringLiteralDfa3_0(active0, 0x200000000000000L, active1, 0L); + case 99: + return jjMoveStringLiteralDfa3_0(active0, 0x2000002040000400L, active1, 0L); + case 100: + if ((active0 & 0x200L) != 0L) + return jjStartNfaWithStates_0(2, 9, 2); + else if ((active0 & 0x800000000L) != 0L) + return jjStartNfaWithStates_0(2, 35, 2); + return jjMoveStringLiteralDfa3_0(active0, 0x180L, active1, 0L); + case 101: + return jjMoveStringLiteralDfa3_0(active0, 0x80030020000L, active1, 0xc0000000L); + case 103: + return jjMoveStringLiteralDfa3_0(active0, 0x10L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa3_0(active0, 0x1400000000000L, active1, 0L); + case 108: + return jjMoveStringLiteralDfa3_0(active0, 0x40L, active1, 0L); + case 110: + return jjMoveStringLiteralDfa3_0(active0, 0x4a108004004800L, active1, 0L); + case 111: + return jjMoveStringLiteralDfa3_0(active0, 0x1010000001010000L, active1, 0L); + case 112: + return jjMoveStringLiteralDfa3_0(active0, 0x104005000002000L, active1, 0L); + case 114: + if ((active0 & 0x200000L) != 0L) + return jjStartNfaWithStates_0(2, 21, 2); + else if ((active0 & 0x400000000000000L) != 0L) + return jjStartNfaWithStates_0(2, 58, 2); + return jjMoveStringLiteralDfa3_0(active0, 0x840000800000L, active1, 0L); + case 115: + return jjMoveStringLiteralDfa3_0(active0, 0x2188020L, active1, 0L); + case 116: + if ((active0 & 0x1000L) != 0L) + return jjStartNfaWithStates_0(2, 12, 2); + return jjMoveStringLiteralDfa3_0(active0, 0x8a0000108040000L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa3_0(active0, 0x210200000000L, active1, 0L); + default : + break; + } + return jjStartNfa_0(1, active0, active1); +} +private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(1, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(2, active0, active1); + return 3; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa4_0(active0, 0x4240060000800L, active1, 0L); + case 99: + return jjMoveStringLiteralDfa4_0(active0, 0x5000020L, active1, 0L); + case 101: + if ((active0 & 0x8000L) != 0L) + { + jjmatchedKind = 15; + jjmatchedPos = 3; + } + else if ((active0 & 0x200000000L) != 0L) + return jjStartNfaWithStates_0(3, 33, 2); + else if ((active0 & 0x4000000000L) != 0L) + return jjStartNfaWithStates_0(3, 38, 2); + return jjMoveStringLiteralDfa4_0(active0, 0x88800000a980180L, active1, 0L); + case 104: + if ((active0 & 0x400L) != 0L) + return jjStartNfaWithStates_0(3, 10, 2); + return jjMoveStringLiteralDfa4_0(active0, 0x20000000000000L, active1, 0L); + case 107: + return jjMoveStringLiteralDfa4_0(active0, 0x2000000000L, active1, 0L); + case 108: + return jjMoveStringLiteralDfa4_0(active0, 0x201000000002000L, active1, 0L); + case 109: + return jjMoveStringLiteralDfa4_0(active0, 0x10000000000L, active1, 0L); + case 110: + if ((active0 & 0x10000000L) != 0L) + return jjStartNfaWithStates_0(3, 28, 2); + else if ((active0 & 0x80000000000L) != 0L) + return jjStartNfaWithStates_0(3, 43, 2); + return jjMoveStringLiteralDfa4_0(active0, 0x108000000000L, active1, 0L); + case 111: + return jjMoveStringLiteralDfa4_0(active0, 0x2000001000004010L, active1, 0L); + case 112: + if ((active0 & 0x1000000000000000L) != 0L) + return jjStartNfaWithStates_0(3, 60, 2); + return jjMoveStringLiteralDfa4_0(active0, 0x100000000L, active1, 0L); + case 114: + return jjMoveStringLiteralDfa4_0(active0, 0x20000L, active1, 0xc0000000L); + case 115: + return jjMoveStringLiteralDfa4_0(active0, 0x42000400000040L, active1, 0L); + case 116: + return jjMoveStringLiteralDfa4_0(active0, 0x10c00000000000L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa4_0(active0, 0x100000000040000L, active1, 0L); + case 119: + if ((active0 & 0x10000L) != 0L) + return jjStartNfaWithStates_0(3, 16, 2); + break; + default : + break; + } + return jjStartNfa_0(2, active0, active1); +} +private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(2, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(3, active0, active1); + return 4; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa5_0(active0, 0x2000822000L, active1, 0xc0000000L); + case 99: + return jjMoveStringLiteralDfa5_0(active0, 0x100L, active1, 0L); + case 101: + if ((active0 & 0x40L) != 0L) + return jjStartNfaWithStates_0(4, 6, 2); + else if ((active0 & 0x1000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 48, 2); + return jjMoveStringLiteralDfa5_0(active0, 0x10118000000000L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa5_0(active0, 0x220c00000100000L, active1, 0L); + case 107: + if ((active0 & 0x1000000L) != 0L) + return jjStartNfaWithStates_0(4, 24, 2); + else if ((active0 & 0x20000000L) != 0L) + return jjStartNfaWithStates_0(4, 29, 2); + break; + case 108: + if ((active0 & 0x80L) != 0L) + return jjStartNfaWithStates_0(4, 7, 2); + else if ((active0 & 0x800L) != 0L) + return jjStartNfaWithStates_0(4, 11, 2); + break; + case 109: + return jjMoveStringLiteralDfa5_0(active0, 0x40000000000L, active1, 0L); + case 110: + return jjMoveStringLiteralDfa5_0(active0, 0x84000000000000L, active1, 0L); + case 112: + return jjMoveStringLiteralDfa5_0(active0, 0x40000000L, active1, 0L); + case 114: + if ((active0 & 0x8000000L) != 0L) + return jjStartNfaWithStates_0(4, 27, 2); + else if ((active0 & 0x8000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 51, 2); + return jjMoveStringLiteralDfa5_0(active0, 0x28000010000c0030L, active1, 0L); + case 115: + if ((active0 & 0x400000000L) != 0L) + return jjStartNfaWithStates_0(4, 34, 2); + break; + case 116: + if ((active0 & 0x100000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 56, 2); + return jjMoveStringLiteralDfa5_0(active0, 0x42200004004000L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa5_0(active0, 0x100000000L, active1, 0L); + case 119: + return jjMoveStringLiteralDfa5_0(active0, 0x2000000L, active1, 0L); + default : + break; + } + return jjStartNfa_0(3, active0, active1); +} +private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(3, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(4, active0, active1); + return 5; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa6_0(active0, 0x2c00000004000L, active1, 0L); + case 99: + if ((active0 & 0x200000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 57, 2); + return jjMoveStringLiteralDfa6_0(active0, 0x10108000002000L, active1, 0L); + case 100: + if ((active0 & 0x2000000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 61, 2); + return jjMoveStringLiteralDfa6_0(active0, 0x84000000000000L, active1, 0L); + case 101: + return jjMoveStringLiteralDfa6_0(active0, 0x40000000020L, active1, 0L); + case 102: + if ((active0 & 0x100000L) != 0L) + return jjStartNfaWithStates_0(5, 20, 2); + break; + case 103: + return jjMoveStringLiteralDfa6_0(active0, 0x2000000000L, active1, 0L); + case 104: + return jjMoveStringLiteralDfa6_0(active0, 0x2000000L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa6_0(active0, 0x200004000010L, active1, 0L); + case 108: + return jjMoveStringLiteralDfa6_0(active0, 0x100L, active1, 0L); + case 109: + if ((active0 & 0x800000L) != 0L) + return jjStartNfaWithStates_0(5, 23, 2); + break; + case 110: + if ((active0 & 0x40000L) != 0L) + return jjStartNfaWithStates_0(5, 18, 2); + else if ((active0 & 0x20000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 53, 2); + return jjMoveStringLiteralDfa6_0(active0, 0x800000000000000L, active1, 0L); + case 114: + return jjMoveStringLiteralDfa6_0(active0, 0x40010000000000L, active1, 0L); + case 115: + return jjMoveStringLiteralDfa6_0(active0, 0x40000000L, active1, 0L); + case 116: + if ((active0 & 0x80000L) != 0L) + return jjStartNfaWithStates_0(5, 19, 2); + else if ((active0 & 0x100000000L) != 0L) + return jjStartNfaWithStates_0(5, 32, 2); + else if ((active0 & 0x1000000000L) != 0L) + return jjStartNfaWithStates_0(5, 36, 2); + return jjMoveStringLiteralDfa6_0(active0, 0x20000L, active1, 0xc0000000L); + default : + break; + } + return jjStartNfa_0(4, active0, active1); +} +private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(4, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(5, active0, active1); + return 6; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa7_0(active0, 0x844010000000100L, active1, 0L); + case 101: + if ((active0 & 0x2000000000L) != 0L) + return jjStartNfaWithStates_0(6, 37, 2); + return jjMoveStringLiteralDfa7_0(active0, 0x2002000L, active1, 0L); + case 108: + if ((active0 & 0x400000000000L) != 0L) + return jjStartNfaWithStates_0(6, 46, 2); + else if ((active0 & 0x800000000000L) != 0L) + return jjStartNfaWithStates_0(6, 47, 2); + break; + case 110: + return jjMoveStringLiteralDfa7_0(active0, 0x2000000000000L, active1, 0L); + case 111: + return jjMoveStringLiteralDfa7_0(active0, 0x200004020000L, active1, 0xc0000000L); + case 115: + if ((active0 & 0x80000000000000L) != 0L) + return jjStartNfaWithStates_0(6, 55, 2); + break; + case 116: + if ((active0 & 0x8000000000L) != 0L) + { + jjmatchedKind = 39; + jjmatchedPos = 6; + } + return jjMoveStringLiteralDfa7_0(active0, 0x10140000004030L, active1, 0L); + case 117: + return jjMoveStringLiteralDfa7_0(active0, 0x40000000L, active1, 0L); + default : + break; + } + return jjStartNfa_0(5, active0, active1); +} +private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(5, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(6, active0, active1); + return 7; + } + switch(curChar) + { + case 97: + return jjMoveStringLiteralDfa8_0(active0, 0x2000L, active1, 0L); + case 98: + return jjMoveStringLiteralDfa8_0(active0, 0x4000000000000L, active1, 0L); + case 101: + if ((active0 & 0x20L) != 0L) + return jjStartNfaWithStates_0(7, 5, 2); + return jjMoveStringLiteralDfa8_0(active0, 0x10040000000000L, active1, 0L); + case 104: + return jjMoveStringLiteralDfa8_0(active0, 0x10L, active1, 0L); + case 105: + return jjMoveStringLiteralDfa8_0(active0, 0x40000000004000L, active1, 0L); + case 108: + if ((active0 & 0x800000000000000L) != 0L) + return jjStartNfaWithStates_0(7, 59, 2); + return jjMoveStringLiteralDfa8_0(active0, 0x40000000L, active1, 0L); + case 110: + if ((active0 & 0x2000000L) != 0L) + return jjStartNfaWithStates_0(7, 25, 2); + else if ((active0 & 0x4000000L) != 0L) + return jjStartNfaWithStates_0(7, 26, 2); + else if ((active0 & 0x200000000000L) != 0L) + return jjStartNfaWithStates_0(7, 45, 2); + break; + case 111: + return jjMoveStringLiteralDfa8_0(active0, 0x100000000000L, active1, 0L); + case 114: + if ((active0 & 0x20000L) != 0L) + { + jjmatchedKind = 17; + jjmatchedPos = 7; + } + return jjMoveStringLiteralDfa8_0(active0, 0x100L, active1, 0xc0000000L); + case 116: + if ((active0 & 0x2000000000000L) != 0L) + return jjStartNfaWithStates_0(7, 49, 2); + return jjMoveStringLiteralDfa8_0(active0, 0x10000000000L, active1, 0L); + default : + break; + } + return jjStartNfa_0(6, active0, active1); +} +private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(6, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(7, active0, active1); + return 8; + } + switch(curChar) + { + case 32: + return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0xc0000000L); + case 97: + return jjMoveStringLiteralDfa9_0(active0, 0x40000000L, active1, 0L); + case 98: + return jjMoveStringLiteralDfa9_0(active0, 0x2000L, active1, 0L); + case 100: + if ((active0 & 0x10000000000000L) != 0L) + return jjStartNfaWithStates_0(8, 52, 2); + break; + case 101: + if ((active0 & 0x100L) != 0L) + return jjStartNfaWithStates_0(8, 8, 2); + break; + case 105: + return jjMoveStringLiteralDfa9_0(active0, 0x10000000000L, active1, 0L); + case 108: + return jjMoveStringLiteralDfa9_0(active0, 0x4000000000000L, active1, 0L); + case 109: + if ((active0 & 0x10L) != 0L) + return jjStartNfaWithStates_0(8, 4, 2); + break; + case 110: + return jjMoveStringLiteralDfa9_0(active0, 0x40000000000000L, active1, 0L); + case 111: + return jjMoveStringLiteralDfa9_0(active0, 0x4000L, active1, 0L); + case 114: + if ((active0 & 0x40000000000L) != 0L) + return jjStartNfaWithStates_0(8, 42, 2); + else if ((active0 & 0x100000000000L) != 0L) + return jjStartNfaWithStates_0(8, 44, 2); + break; + default : + break; + } + return jjStartNfa_0(7, active0, active1); +} +private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(7, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(8, active0, active1); + return 9; + } + switch(curChar) + { + case 101: + if ((active0 & 0x4000000000000L) != 0L) + return jjStartNfaWithStates_0(9, 50, 2); + return jjMoveStringLiteralDfa10_0(active0, 0x40000000000000L, active1, 0L); + case 102: + return jjMoveStringLiteralDfa10_0(active0, 0L, active1, 0x40000000L); + case 108: + return jjMoveStringLiteralDfa10_0(active0, 0x2000L, active1, 0L); + case 110: + if ((active0 & 0x4000L) != 0L) + return jjStartNfaWithStates_0(9, 14, 2); + break; + case 111: + return jjMoveStringLiteralDfa10_0(active0, 0x10000000000L, active1, 0L); + case 114: + return jjMoveStringLiteralDfa10_0(active0, 0L, active1, 0x80000000L); + case 116: + return jjMoveStringLiteralDfa10_0(active0, 0x40000000L, active1, 0L); + default : + break; + } + return jjStartNfa_0(8, active0, active1); +} +private int jjMoveStringLiteralDfa10_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(8, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(9, active0, active1); + return 10; + } + switch(curChar) + { + case 100: + return jjMoveStringLiteralDfa11_0(active0, 0x40000000000000L, active1, 0L); + case 101: + if ((active0 & 0x2000L) != 0L) + return jjStartNfaWithStates_0(10, 13, 2); + return jjMoveStringLiteralDfa11_0(active0, 0x40000000L, active1, 0x80000000L); + case 110: + if ((active0 & 0x10000000000L) != 0L) + return jjStartNfaWithStates_0(10, 40, 2); + break; + case 117: + return jjMoveStringLiteralDfa11_0(active0, 0L, active1, 0x40000000L); + default : + break; + } + return jjStartNfa_0(9, active0, active1); +} +private int jjMoveStringLiteralDfa11_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(9, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(10, active0, active1); + return 11; + } + switch(curChar) + { + case 98: + return jjMoveStringLiteralDfa12_0(active0, 0x40000000000000L, active1, 0L); + case 99: + return jjMoveStringLiteralDfa12_0(active0, 0L, active1, 0x80000000L); + case 100: + if ((active0 & 0x40000000L) != 0L) + return jjStartNfaWithStates_0(11, 30, 2); + break; + case 110: + return jjMoveStringLiteralDfa12_0(active0, 0L, active1, 0x40000000L); + default : + break; + } + return jjStartNfa_0(10, active0, active1); +} +private int jjMoveStringLiteralDfa12_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(10, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(11, active0, active1); + return 12; + } + switch(curChar) + { + case 99: + return jjMoveStringLiteralDfa13_0(active0, 0L, active1, 0x40000000L); + case 111: + return jjMoveStringLiteralDfa13_0(active0, 0L, active1, 0x80000000L); + case 121: + if ((active0 & 0x40000000000000L) != 0L) + return jjStartNfaWithStates_0(12, 54, 2); + break; + default : + break; + } + return jjStartNfa_0(11, active0, active1); +} +private int jjMoveStringLiteralDfa13_0(long old0, long active0, long old1, long active1) +{ + if (((active0 &= old0) | (active1 &= old1)) == 0L) + return jjStartNfa_0(11, old0, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(12, 0L, active1); + return 13; + } + switch(curChar) + { + case 114: + return jjMoveStringLiteralDfa14_0(active1, 0x80000000L); + case 116: + return jjMoveStringLiteralDfa14_0(active1, 0x40000000L); + default : + break; + } + return jjStartNfa_0(12, 0L, active1); +} +private int jjMoveStringLiteralDfa14_0(long old1, long active1) +{ + if (((active1 &= old1)) == 0L) + return jjStartNfa_0(12, 0L, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(13, 0L, active1); + return 14; + } + switch(curChar) + { + case 100: + if ((active1 & 0x80000000L) != 0L) + return jjStopAtPos(14, 95); + break; + case 105: + return jjMoveStringLiteralDfa15_0(active1, 0x40000000L); + default : + break; + } + return jjStartNfa_0(13, 0L, active1); +} +private int jjMoveStringLiteralDfa15_0(long old1, long active1) +{ + if (((active1 &= old1)) == 0L) + return jjStartNfa_0(13, 0L, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(14, 0L, active1); + return 15; + } + switch(curChar) + { + case 111: + return jjMoveStringLiteralDfa16_0(active1, 0x40000000L); + default : + break; + } + return jjStartNfa_0(14, 0L, active1); +} +private int jjMoveStringLiteralDfa16_0(long old1, long active1) +{ + if (((active1 &= old1)) == 0L) + return jjStartNfa_0(14, 0L, old1); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(15, 0L, active1); + return 16; + } + switch(curChar) + { + case 110: + if ((active1 & 0x40000000L) != 0L) + return jjStopAtPos(16, 94); + break; + default : + break; + } + return jjStartNfa_0(15, 0L, active1); +} +private int jjStartNfaWithStates_0(int pos, int kind, int state) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { return pos + 1; } + return jjMoveNfa_0(state, pos + 1); +} +static final long[] jjbitVec0 = { + 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL +}; +private int jjMoveNfa_0(int startState, int curPos) +{ + int startsAt = 0; + jjnewStateCnt = 37; + int i = 1; + jjstateSet[0] = startState; + int kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + do + { + switch(jjstateSet[--i]) + { + case 9: + if ((0x3ff000000000000L & l) != 0L) + { + if (kind > 93) + kind = 93; + jjCheckNAddTwoStates(10, 11); + } + else if (curChar == 45) + jjCheckNAdd(10); + break; + case 37: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(32, 33); + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(25, 26); + if ((0x3ff000000000000L & l) != 0L) + { + if (kind > 92) + kind = 92; + jjCheckNAdd(24); + } + break; + case 0: + if ((0x3ff000000000000L & l) != 0L) + { + if (kind > 92) + kind = 92; + jjCheckNAddStates(0, 4); + } + else if ((0x100002600L & l) != 0L) + { + if (kind > 1) + kind = 1; + } + else if (curChar == 45) + jjCheckNAddStates(5, 7); + else if (curChar == 47) + jjAddStates(8, 9); + else if (curChar == 46) + jjCheckNAddTwoStates(9, 10); + else if (curChar == 34) + jjCheckNAddStates(10, 12); + break; + case 15: + if (curChar == 47) + { + if (kind > 3) + kind = 3; + jjCheckNAdd(22); + } + else if (curChar == 42) + jjCheckNAddStates(13, 15); + break; + case 2: + if ((0x3ff400000000000L & l) == 0L) + break; + if (kind > 90) + kind = 90; + jjstateSet[jjnewStateCnt++] = 2; + break; + case 3: + if (curChar == 34) + jjCheckNAddStates(10, 12); + break; + case 4: + if ((0xfffffffbfffffbffL & l) != 0L) + jjCheckNAddStates(10, 12); + break; + case 6: + if ((0xfffffffffffffbffL & l) != 0L) + jjCheckNAddStates(10, 12); + break; + case 7: + if (curChar == 34 && kind > 91) + kind = 91; + break; + case 8: + if (curChar == 46) + jjCheckNAddTwoStates(9, 10); + break; + case 10: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 93) + kind = 93; + jjCheckNAddTwoStates(10, 11); + break; + case 12: + if (curChar == 45) + jjCheckNAdd(13); + break; + case 13: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 93) + kind = 93; + jjCheckNAdd(13); + break; + case 14: + if (curChar == 47) + jjAddStates(8, 9); + break; + case 16: + if ((0xfffffbffffffffffL & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 17: + if (curChar == 42) + jjstateSet[jjnewStateCnt++] = 18; + break; + case 18: + if ((0xffff7fffffffffffL & l) != 0L) + jjCheckNAddStates(13, 15); + break; + case 19: + if (curChar == 47 && kind > 2) + kind = 2; + break; + case 20: + if (curChar == 42) + jjstateSet[jjnewStateCnt++] = 19; + break; + case 21: + if (curChar != 47) + break; + if (kind > 3) + kind = 3; + jjCheckNAdd(22); + break; + case 22: + if ((0xfffffffffffffbffL & l) == 0L) + break; + if (kind > 3) + kind = 3; + jjCheckNAdd(22); + break; + case 23: + if (curChar == 45) + jjCheckNAddStates(5, 7); + break; + case 24: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 92) + kind = 92; + jjCheckNAdd(24); + break; + case 25: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(25, 26); + break; + case 26: + if (curChar != 46) + break; + if (kind > 93) + kind = 93; + jjCheckNAddStates(16, 18); + break; + case 27: + if (curChar == 45) + jjCheckNAdd(28); + break; + case 28: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 93) + kind = 93; + jjCheckNAddTwoStates(28, 29); + break; + case 30: + if (curChar == 45) + jjCheckNAdd(31); + break; + case 31: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 93) + kind = 93; + jjCheckNAdd(31); + break; + case 32: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(32, 33); + break; + case 34: + if (curChar == 45) + jjCheckNAdd(35); + break; + case 35: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 93) + kind = 93; + jjCheckNAdd(35); + break; + case 36: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 92) + kind = 92; + jjCheckNAddStates(0, 4); + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + do + { + switch(jjstateSet[--i]) + { + case 0: + case 2: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 90) + kind = 90; + jjCheckNAdd(2); + break; + case 4: + if ((0xffffffffefffffffL & l) != 0L) + jjCheckNAddStates(10, 12); + break; + case 5: + if (curChar == 92) + jjstateSet[jjnewStateCnt++] = 6; + break; + case 6: + jjCheckNAddStates(10, 12); + break; + case 11: + if ((0x2000000020L & l) != 0L) + jjAddStates(19, 20); + break; + case 16: + case 18: + jjCheckNAddStates(13, 15); + break; + case 22: + if (kind > 3) + kind = 3; + jjstateSet[jjnewStateCnt++] = 22; + break; + case 29: + if ((0x2000000020L & l) != 0L) + jjAddStates(21, 22); + break; + case 33: + if ((0x2000000020L & l) != 0L) + jjAddStates(23, 24); + break; + default : break; + } + } while(i != startsAt); + } + else + { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + do + { + switch(jjstateSet[--i]) + { + case 4: + case 6: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddStates(10, 12); + break; + case 16: + case 18: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddStates(13, 15); + break; + case 22: + if ((jjbitVec0[i2] & l2) == 0L) + break; + if (kind > 3) + kind = 3; + jjstateSet[jjnewStateCnt++] = 22; + break; + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 37 - (jjnewStateCnt = startsAt))) + return curPos; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { return curPos; } + } +} +static final int[] jjnextStates = { + 24, 25, 26, 32, 33, 24, 25, 32, 15, 21, 4, 5, 7, 16, 17, 20, + 27, 28, 29, 12, 13, 30, 31, 34, 35, +}; + +/** Token literal values. */ +public static final String[] jjstrLiteralImages = { +"", null, null, null, "\141\154\147\157\162\151\164\150\155", +"\144\151\163\143\162\145\164\145", "\146\141\154\163\145", "\155\157\144\145\154", +"\162\145\144\145\143\154\141\162\145", "\141\156\144", "\145\141\143\150", "\146\151\156\141\154", "\156\157\164", +"\162\145\160\154\141\143\145\141\142\154\145", "\141\156\156\157\164\141\164\151\157\156", "\145\154\163\145", +"\146\154\157\167", "\157\160\145\162\141\164\157\162", "\162\145\164\165\162\156", +"\141\163\163\145\162\164", "\145\154\163\145\151\146", "\146\157\162", "\157\162", +"\163\164\162\145\141\155", "\142\154\157\143\153", "\145\154\163\145\167\150\145\156", +"\146\165\156\143\164\151\157\156", "\157\165\164\145\162", "\164\150\145\156", "\142\162\145\141\153", +"\145\156\143\141\160\163\165\154\141\164\145\144", "\151\146", "\157\165\164\160\165\164", "\164\162\165\145", +"\143\154\141\163\163", "\145\156\144", "\151\155\160\157\162\164", "\160\141\143\153\141\147\145", +"\164\171\160\145", "\143\157\156\156\145\143\164", +"\145\156\165\155\145\162\141\164\151\157\156", "\151\156", "\160\141\162\141\155\145\164\145\162", "\167\150\145\156", +"\143\157\156\156\145\143\164\157\162", "\145\161\165\141\164\151\157\156", "\151\156\151\164\151\141\154", +"\160\141\162\164\151\141\154", "\167\150\151\154\145", "\143\157\156\163\164\141\156\164", +"\145\170\160\141\156\144\141\142\154\145", "\151\156\156\145\162", "\160\162\157\164\145\143\164\145\144", +"\167\151\164\150\151\156", "\143\157\156\163\164\162\141\151\156\145\144\142\171", +"\145\170\164\145\156\144\163", "\151\156\160\165\164", "\160\165\142\154\151\143", "\144\145\162", +"\145\170\164\145\162\156\141\154", "\154\157\157\160", "\162\145\143\157\162\144", "\50", "\51", "\173", "\175", +"\133", "\135", "\56", "\72", "\73", "\54", "\74", "\74\75", "\76", "\76\75", +"\75\75", "\74\76", "\53", "\55", "\56\53", "\56\55", "\52", "\57", "\56\52", "\56\57", +"\136", "\56\136", "\75", "\72\75", null, null, null, null, +"\157\160\145\162\141\164\157\162\40\146\165\156\143\164\151\157\156", "\157\160\145\162\141\164\157\162\40\162\145\143\157\162\144", }; + +/** Lexer state names. */ +public static final String[] lexStateNames = { + "DEFAULT", +}; +static final long[] jjtoToken = { + 0xfffffffffffffff1L, 0xffffffffL, +}; +static final long[] jjtoSkip = { + 0xeL, 0x0L, +}; +protected SimpleCharStream input_stream; +private final int[] jjrounds = new int[37]; +private final int[] jjstateSet = new int[74]; +private final StringBuilder jjimage = new StringBuilder(); +private StringBuilder image = jjimage; +private int jjimageLen; +private int lengthOfMatch; +protected char curChar; +/** Constructor. */ +public ModelParserTokenManager(SimpleCharStream stream){ + if (SimpleCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} + +/** Constructor. */ +public ModelParserTokenManager(SimpleCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} + +/** Reinitialise parser. */ +public void ReInit(SimpleCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 37; i-- > 0;) + jjrounds[i] = 0x80000000; +} + +/** Reinitialise parser. */ +public void ReInit(SimpleCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} + +/** Switch to specified lex state. */ +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; + String im = jjstrLiteralImages[jjmatchedKind]; + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind, curTokenImage); + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + + return t; +} + +int curLexState = 0; +int defaultLexState = 0; +int jjnewStateCnt; +int jjround; +int jjmatchedPos; +int jjmatchedKind; + +/** Get the next Token. */ +public Token getNextToken() +{ + Token matchedToken; + int curPos = 0; + + EOFLoop : + for (;;) + { + try + { + curChar = input_stream.BeginToken(); + } + catch(java.io.IOException e) + { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + return matchedToken; + } + image = jjimage; + image.setLength(0); + jjimageLen = 0; + + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + if (jjmatchedKind != 0x7fffffff) + { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + matchedToken = jjFillToken(); + TokenLexicalActions(matchedToken); + return matchedToken; + } + else + { + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { input_stream.readChar(); input_stream.backup(1); } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } + else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } +} + +void TokenLexicalActions(Token matchedToken) +{ + switch(jjmatchedKind) + { + case 91 : + image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1))); + matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); + break; + default : + break; + } +} +private void jjCheckNAdd(int state) +{ + if (jjrounds[state] != jjround) + { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } +} +private void jjAddStates(int start, int end) +{ + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); +} +private void jjCheckNAddTwoStates(int state1, int state2) +{ + jjCheckNAdd(state1); + jjCheckNAdd(state2); +} + +private void jjCheckNAddStates(int start, int end) +{ + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); +} + +} diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserTreeConstants.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserTreeConstants.java new file mode 100644 index 00000000..39cc66d4 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelParserTreeConstants.java @@ -0,0 +1,173 @@ +/* Generated By:JavaCC: Do not edit this line. ModelParserTreeConstants.java Version 5.0 */ +package fi.semantum.sysdyn.solver.parser; + +public interface ModelParserTreeConstants +{ + public int JJTPARSE = 0; + public int JJTSTORED = 1; + public int JJTCLASS_DEFINITION = 2; + public int JJTCLASS_SPECIFIER = 3; + public int JJTBASE_PREFIX = 4; + public int JJTENUM_LIST = 5; + public int JJTENUMERATION_LITERAL = 6; + public int JJTPARSE_COMPOSITION = 7; + public int JJTCOMPOSITION = 8; + public int JJTLANGUAGE_SPECIFICATION = 9; + public int JJTEXTERNAL_FUNCTION_CALL = 10; + public int JJTELEMENT_LIST = 11; + public int JJTELEMENT = 12; + public int JJTIMPORT_CLAUSE = 13; + public int JJTEXTENDS_CLAUSE = 14; + public int JJTCONSTRAINING_CLAUSE = 15; + public int JJTCOMPONENT_CLAUSE = 16; + public int JJTTYPE_PREFIX = 17; + public int JJTTYPE_SPECIFIER = 18; + public int JJTCOMPONENT_LIST = 19; + public int JJTCOMPONENT_DECLARATION = 20; + public int JJTCONDITIONAL_ATTRIBUTE = 21; + public int JJTDECLARATION = 22; + public int JJTMODIFICATION = 23; + public int JJTCLASS_MODIFICATION = 24; + public int JJTARGUMENT_LIST = 25; + public int JJTARGUMENT = 26; + public int JJTELEMENT_MODIFICATION_OR_REPLACEABLE = 27; + public int JJTELEMENT_MODIFICATION = 28; + public int JJTELEMENT_REDECLARATION = 29; + public int JJTELEMENT_REPLACEABLE = 30; + public int JJTCOMPONENT_CLAUSE1 = 31; + public int JJTCOMPONENT_DECLARATION1 = 32; + public int JJTEQUATION_SECTION = 33; + public int JJTALGORITHM_SECTION = 34; + public int JJTASSIGNMENT = 35; + public int JJTEQUATION = 36; + public int JJTSTATEMENT = 37; + public int JJTIF_EQUATION = 38; + public int JJTTHEN_STATEMENT = 39; + public int JJTELSEIF_STATEMENT = 40; + public int JJTELSE_STATEMENT = 41; + public int JJTIF_STATEMENT = 42; + public int JJTFOR_EQUATION = 43; + public int JJTFOR_STATEMENT = 44; + public int JJTFOR_INDICES = 45; + public int JJTFOR_INDEX = 46; + public int JJTWHILE_STATEMENT = 47; + public int JJTWHEN_EQUATION = 48; + public int JJTWHEN_STATEMENT = 49; + public int JJTCONNECT_CLAUSE = 50; + public int JJTEXPR = 51; + public int JJTIF_EXPRESSION = 52; + public int JJTEXPRESSION = 53; + public int JJTSIMPLE_EXPRESSION = 54; + public int JJTLOGICAL_EXPRESSION = 55; + public int JJTLOGICAL_TERM = 56; + public int JJTLOGICAL_FACTOR = 57; + public int JJTRELATION = 58; + public int JJTREL_OP = 59; + public int JJTARITHMETIC_EXPRESSION = 60; + public int JJTADD_OP = 61; + public int JJTTERM = 62; + public int JJTMUL_OP = 63; + public int JJTFACTOR = 64; + public int JJTDER_INITIAL = 65; + public int JJTSUBSCRIPT_2 = 66; + public int JJTARRAY = 67; + public int JJTPRIMARY = 68; + public int JJTNAME = 69; + public int JJTCOMPONENT_REFERENCE = 70; + public int JJTFUNCTION_CALL_ARGS = 71; + public int JJTFUNCTION_ARGUMENTS = 72; + public int JJTNAMED_ARGUMENTS = 73; + public int JJTNAMED_ARGUMENT = 74; + public int JJTOUTPUT_EXPRESSION_LIST = 75; + public int JJTEXPRESSION_LIST = 76; + public int JJTARRAY_SUBSCRIPTS = 77; + public int JJTSUBSCRIPT = 78; + public int JJTVOID = 79; + public int JJTANNOTATION = 80; + + + public String[] jjtNodeName = { + "parse", + "STORED", + "class_definition", + "class_specifier", + "base_prefix", + "enum_list", + "enumeration_literal", + "parse_composition", + "composition", + "language_specification", + "external_function_call", + "element_list", + "element", + "import_clause", + "extends_clause", + "constraining_clause", + "component_clause", + "type_prefix", + "type_specifier", + "component_list", + "component_declaration", + "conditional_attribute", + "declaration", + "modification", + "class_modification", + "argument_list", + "argument", + "element_modification_or_replaceable", + "element_modification", + "element_redeclaration", + "element_replaceable", + "component_clause1", + "component_declaration1", + "equation_section", + "algorithm_section", + "assignment", + "equation", + "statement", + "if_equation", + "then_statement", + "elseif_statement", + "else_statement", + "if_statement", + "for_equation", + "for_statement", + "for_indices", + "for_index", + "while_statement", + "when_equation", + "when_statement", + "connect_clause", + "expr", + "if_expression", + "expression", + "simple_expression", + "logical_expression", + "logical_term", + "logical_factor", + "relation", + "rel_op", + "arithmetic_expression", + "add_op", + "term", + "mul_op", + "factor", + "der_initial", + "subscript_2", + "array", + "primary", + "name", + "component_reference", + "function_call_args", + "function_arguments", + "named_arguments", + "named_argument", + "output_expression_list", + "expression_list", + "array_subscripts", + "subscript", + "void", + "annotation", + }; +} +/* JavaCC - OriginalChecksum=2406c3a5da0aa9cd9047b868bc6069b1 (do not edit this line) */ diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jj b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jj new file mode 100644 index 00000000..990cfd10 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jj @@ -0,0 +1,2922 @@ +/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. ModelicaParser.jj */ +/*@egen*/options { + JDK_VERSION = "1.6"; + STATIC = false; +} + +PARSER_BEGIN(ModelParser) +package fi.semantum.sysdyn.solver.parser; + +import java.util.ArrayList; + +public class ModelParser/*@bgen(jjtree)*/implements ModelParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/ + protected JJTModelParserState jjtree = new JJTModelParserState(); + +/*@egen*/ + + private ArrayList inputs = new ArrayList(); + private ArrayList outputs = new ArrayList(); + + private enum InterfaceVariableType { INPUT, OUTPUT, OTHER + } + + public class Parameter { + public String name; + public boolean optional; + public String description; + public String type; + + public Parameter() { + name = new String(""); + optional = false; + description = null; + type = null; + } } + + public ArrayList getInputs() + { + return inputs; + } + + public ArrayList getOutputs() + { + return outputs; + } + +} + +PARSER_END(ModelParser) + +/*** Lexer *********************************************************/ + +SKIP: +{ +| +| +} + +TOKEN: +{ +"algorithm" | "discrete" | "false" | "model" | "redeclare" +| "and" | "each" | "final" | "not" | "replaceable" +| "annotation" | "else" | "flow" | "operator" | "return" +|"assert" | "elseif" | "for" | "or" | "stream" +| "block" | "elsewhen" | "function" | "outer" | "then" +| "break" | "encapsulated" | "if" | "output" | "true" +| "class" | "end" | "import" | "package" | "type" +| "connect" | "enumeration" | "in" | "parameter" | "when" +| "connector" | "equation" | "initial" | "partial" | "while" +| "constant" | "expandable" | "inner" | "protected" | "within" +| "constrainedby" | "extends" | "input" | "public" +| "der" | "external" | "loop" | "record" +| "(" | ")" | "{" | "}" | "[" | "]" | "." | ":" | ";" | "," +| "<" | "<=" | ">" | ">=" | "==" | "<>" +| "+" | "-" | ".+" | ".-" +| "*" | "/" | ".*" | "./" +| "^" | ".^" +| "=" | ":=" +| +| + { matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); } +| +| "." ()? (["e","E"] )? + | "." (["e","E"] )? + | ["e","E"] + ) > +} + +/*** Parser ********************************************************/ + +// https://javacc.dev.java.net/doc/javaccgrm.html +// add_op -> add_op() +// [ add_op ] -> ( add_op() )? +// { add_op term } -> ( add_op() term() )* + +Node parse() : {/*@bgen(jjtree) parse */ + SimpleNode jjtn000 = new SimpleNode(JJTPARSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) parse */ + try { +/*@egen*/ + stored_definition() /*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ + { return jjtn000; }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +/*** Stored Definition - Within ************************************/ + +Node stored_definition() : {/*@bgen(jjtree) STORED */ + SimpleNode jjtn000 = new SimpleNode(JJTSTORED); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) STORED */ + try { +/*@egen*/ +// stored_definition: +// [ within [ name ] ";" ] +// { [ final ] class_definition ";" } + ( "within" ( name() )? ";" )? + ( ( "final" )? class_definition() ";" )*/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ + { return jjtn000; }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +/*** Class Definition **********************************************/ + +void class_definition() : {/*@bgen(jjtree) class_definition */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASS_DEFINITION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) class_definition */ + try { +/*@egen*/ +// class_definition : +// [ encapsulated ] +// [ partial +// ] ( class modelrecordblock expandableconnectortype +// | | | | [ ] | | package | function | operator | operator function | operator record ) +// class_specifier + ( "encapsulated" )? + ( "partial" )? + ( "class" | "model" | "record" | "block" | ( "expandable" )? "connector" | "type" | + "package" | "function" { jjtn000.op = "function"; } | "operator" | "operator function" | "operator record" ) + class_specifier()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + + +void class_specifier() : {/*@bgen(jjtree) class_specifier */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASS_SPECIFIER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ Token t; +} {/*@bgen(jjtree) class_specifier */ + try { +/*@egen*/ +// class_specifier : +// IDENT string_comment composition end IDENT +// | IDENT "=" base_prefix name [ array_subscripts ] +// [ class_modification ] comment +// | IDENT "=" enumeration "(" ( [enum_list] | ":" ) ")" comment +// | IDENT "=" der "(" name "," IDENT { "," IDENT } ")" comment +// | extends IDENT [ class_modification ] string_comment composition +// end IDENT + LOOKAHEAD(2) t= { jjtn000.op = t.image; } string_comment() composition() "end" + | LOOKAHEAD(2) "=" base_prefix() name() ( array_subscripts() )? ( class_modification() )? comment() + | LOOKAHEAD(3) "=" "enumeration" "(" ( ( enum_list() )? | ":" ) ")" comment() + |LOOKAHEAD(3) "=" "der" "(" name() "," ( "," )* ")" comment() + | "extends" ( class_modification() )? string_comment() composition() "end" /*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void base_prefix() : {/*@bgen(jjtree) base_prefix */ + SimpleNode jjtn000 = new SimpleNode(JJTBASE_PREFIX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) base_prefix */ + try { +/*@egen*/ + type_prefix()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void enum_list() : {/*@bgen(jjtree) enum_list */ + SimpleNode jjtn000 = new SimpleNode(JJTENUM_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) enum_list */ + try { +/*@egen*/ +// enumeration_literal { "," enumeration_literal} + enumeration_literal() ( "," enumeration_literal() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void enumeration_literal() : {/*@bgen(jjtree) enumeration_literal */ + SimpleNode jjtn000 = new SimpleNode(JJTENUMERATION_LITERAL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) enumeration_literal */ + try { +/*@egen*/ + comment()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void parse_composition() : {/*@bgen(jjtree) parse_composition */ + SimpleNode jjtn000 = new SimpleNode(JJTPARSE_COMPOSITION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) parse_composition */ + try { +/*@egen*/ + composition() /*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void composition() : {/*@bgen(jjtree) composition */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPOSITION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) composition */ + try { +/*@egen*/ +// element_list +// { public element_list | +// protected element_list | +// equation_section | +// algorithm_section +// } +// [ external [ language_specification ] +// [ external_function_call ] [ annotation ] ";" ] +// [ annotation ";" ] + element_list() + ( LOOKAHEAD(2) "public" element_list() | "protected" element_list() | equation_section() | algorithm_section() )* + ( "external" ( language_specification() )? ( external_function_call() )? ( annotation() )? ";" )? + ( annotation() ";" )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void language_specification() : {/*@bgen(jjtree) language_specification */ + SimpleNode jjtn000 = new SimpleNode(JJTLANGUAGE_SPECIFICATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) language_specification */ + try { +/*@egen*/ + /*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void external_function_call() : {/*@bgen(jjtree) external_function_call */ + SimpleNode jjtn000 = new SimpleNode(JJTEXTERNAL_FUNCTION_CALL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) external_function_call */ + try { +/*@egen*/ +// [ component_reference "=" ] +// IDENT "(" [ expression_list ] ")" + ( component_reference() "=" )? + "(" ( expression_list() )? ")"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void element_list() : {/*@bgen(jjtree) element_list */ + SimpleNode jjtn000 = new SimpleNode(JJTELEMENT_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) element_list */ + try { +/*@egen*/ + ( element() ";" )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +Node element() : {/*@bgen(jjtree) element */ + SimpleNode jjtn000 = new SimpleNode(JJTELEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) element */ + try { +/*@egen*/ +// import_clause | +// extends_clause | +// [ redeclare ] +// [ final ] +// [ inner ] [ outer ] +// ( ( class_definition | component_clause) | +// replaceable ( class_definition | component_clause) +// [constraining_clause comment]) + import_clause() | + extends_clause() | + ( "redeclare" )? + ( "final" )? + ( "inner" )? ( "outer" )? + ( (class_definition() | component_clause()) | + "replaceable" (class_definition() | component_clause()) + (constraining_clause() comment())?)/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ + { return jjtn000; }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void import_clause() : {/*@bgen(jjtree) import_clause */ + SimpleNode jjtn000 = new SimpleNode(JJTIMPORT_CLAUSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) import_clause */ + try { +/*@egen*/ +// import ( IDENT "=" name | name ["." "*"] ) comment + "import" (LOOKAHEAD(2) "=" name() | name() ("." "*")? ) comment()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +/*** Extends *******************************************************/ +void extends_clause() : {/*@bgen(jjtree) extends_clause */ + SimpleNode jjtn000 = new SimpleNode(JJTEXTENDS_CLAUSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) extends_clause */ + try { +/*@egen*/ +// extends name [ class_modification ] [annotation] + "extends" name() ( class_modification() )? ( annotation() )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void constraining_clause() : {/*@bgen(jjtree) constraining_clause */ + SimpleNode jjtn000 = new SimpleNode(JJTCONSTRAINING_CLAUSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) constraining_clause */ + try { +/*@egen*/ +// constrainedby name [ class_modification ] + "constrainedby" name() ( class_modification() )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +/*** Component Clause **********************************************/ +void component_clause() : {/*@bgen(jjtree) component_clause */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPONENT_CLAUSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ + InterfaceVariableType ioType = InterfaceVariableType.OTHER; + String typeSpecifier = ""; + //String arraySubscripts = null; + ArrayList componentList = new ArrayList(); +} {/*@bgen(jjtree) component_clause */ + try { +/*@egen*/ + +// type_prefix type_specifier [ array_subscripts ] component_list + ( ioType = type_prefix() ) + ( typeSpecifier = type_specifier() ) + ( /*arraySubscripts =*/ array_subscripts() )? + ( componentList = component_list() )/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ + { + if (ioType == InterfaceVariableType.INPUT) { + for (Parameter input : componentList) { + input.type = typeSpecifier; + inputs.add(input); } + } else if (ioType == InterfaceVariableType.OUTPUT) { + for (Parameter output : componentList) { + output.type = typeSpecifier; + outputs.add(output); + } + } + }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +InterfaceVariableType type_prefix() : {/*@bgen(jjtree) type_prefix */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPE_PREFIX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ + InterfaceVariableType type = InterfaceVariableType.OTHER; +} {/*@bgen(jjtree) type_prefix */ + try { +/*@egen*/ +// [ flow | stream ] +// [ discrete | parameter | constant ] [ input | output ] + ( "flow" | "stream" )? + ( "discrete" { jjtn000.op = "discrete"; }| "parameter" { jjtn000.op = "parameter"; }| "constant" { jjtn000.op = "constant"; })? + ( "output" { type = InterfaceVariableType.OUTPUT; jjtn000.op = "output"; } + | "input" { type = InterfaceVariableType.INPUT; jjtn000.op = "input"; } + )?/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ + { + return type; + }/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} +String type_specifier() : {/*@bgen(jjtree) type_specifier */ + SimpleNode jjtn000 = new SimpleNode(JJTTYPE_SPECIFIER); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ + String ret = new String(""); +} {/*@bgen(jjtree) type_specifier */ + try { +/*@egen*/ + ret = name()/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ + { + jjtn000.op = ret; return ret; + }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +ArrayList component_list() : {/*@bgen(jjtree) component_list */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPONENT_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ + ArrayList ret = new ArrayList(); + Parameter temp; +} {/*@bgen(jjtree) component_list */ + try { +/*@egen*/ +// component_declaration { "," component_declaration } + temp = component_declaration() { ret.add(temp); } ( "," temp = component_declaration() { ret.add(temp); } )*/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ + { return ret; + }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +Parameter component_declaration() : {/*@bgen(jjtree) component_declaration */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPONENT_DECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ + Parameter ret; + String temp = ""; +} {/*@bgen(jjtree) component_declaration */ + try { +/*@egen*/ +// declaration [ conditional_attribute ] comment + ret = declaration() ( conditional_attribute() )? ret.description = comment()/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ + { + return ret; + }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void conditional_attribute() : {/*@bgen(jjtree) conditional_attribute */ + SimpleNode jjtn000 = new SimpleNode(JJTCONDITIONAL_ATTRIBUTE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) conditional_attribute */ + try { +/*@egen*/ + "if" expression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +Parameter declaration() : {/*@bgen(jjtree) declaration */ + SimpleNode jjtn000 = new SimpleNode(JJTDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ Token t; + // Parameter here without comment yet. + Parameter ret = new Parameter(); +} {/*@bgen(jjtree) declaration */ + try { +/*@egen*/ +// IDENT [ array_subscripts ] [ modification ] + { ret.name = new String(token.image); jjtn000.op = token.image; } + ( array_subscripts() )? + ( ret.optional = modification() )?/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ + { return ret; }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +/*** Modification **********************************************/ +boolean modification() : {/*@bgen(jjtree) modification */ + SimpleNode jjtn000 = new SimpleNode(JJTMODIFICATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ + boolean optional = false; +} {/*@bgen(jjtree) modification */ + try { +/*@egen*/ +// class_modification [ "=" expression ] +// | "=" expression +// | ":=" expression + ( class_modification() ( "=" expression() )? + | "=" expression() { optional = true; } + | ":=" expression() { optional = true; } )/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ + { return optional; + }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void class_modification() : {/*@bgen(jjtree) class_modification */ + SimpleNode jjtn000 = new SimpleNode(JJTCLASS_MODIFICATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) class_modification */ + try { +/*@egen*/ +// "(" [ argument_list ] ")" + "(" ( argument_list() )? ")"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void argument_list() : {/*@bgen(jjtree) argument_list */ + SimpleNode jjtn000 = new SimpleNode(JJTARGUMENT_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) argument_list */ + try { +/*@egen*/ +// argument { "," argument } + argument() ( "," argument() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void argument() : {/*@bgen(jjtree) argument */ + SimpleNode jjtn000 = new SimpleNode(JJTARGUMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) argument */ + try { +/*@egen*/ +// element_modification_or_replaceable +// | element_redeclaration + element_modification_or_replaceable() | + element_redeclaration()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void element_modification_or_replaceable() : {/*@bgen(jjtree) element_modification_or_replaceable */ + SimpleNode jjtn000 = new SimpleNode(JJTELEMENT_MODIFICATION_OR_REPLACEABLE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) element_modification_or_replaceable */ + try { +/*@egen*/ +// [ each ] [ final ] ( element_modification | element_replaceable) + ( "each" )? ( "final" )? ( element_modification() | element_replaceable() )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ } + +void element_modification() : {/*@bgen(jjtree) element_modification */ + SimpleNode jjtn000 = new SimpleNode(JJTELEMENT_MODIFICATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) element_modification */ + try { +/*@egen*/ +// name [ modification ] string_comment + name() ( modification() )? string_comment()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void element_redeclaration() : {/*@bgen(jjtree) element_redeclaration */ + SimpleNode jjtn000 = new SimpleNode(JJTELEMENT_REDECLARATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) element_redeclaration */ + try { +/*@egen*/ +// redeclare [ each ] [ final ] +// ( ( class_definition | component_clause1) | element_replaceable ) + "redeclare" ( "each" )? ( "final" )? + ( ( class_definition() | component_clause1() ) | element_replaceable() )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ } + +void element_replaceable() : {/*@bgen(jjtree) element_replaceable */ + SimpleNode jjtn000 = new SimpleNode(JJTELEMENT_REPLACEABLE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) element_replaceable */ + try { +/*@egen*/ +// replaceable ( class_definition | component_clause1) +// [constraining_clause] + "replaceable" ( class_definition() | component_clause1() ) ( constraining_clause() )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void component_clause1() : {/*@bgen(jjtree) component_clause1 */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPONENT_CLAUSE1); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) component_clause1 */ + try { +/*@egen*/ +// type_prefix type_specifier component_declaration1 + type_prefix() type_specifier() component_declaration1()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void component_declaration1() : {/*@bgen(jjtree) component_declaration1 */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPONENT_DECLARATION1); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) component_declaration1 */ + try { +/*@egen*/ + declaration() comment()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + + +/*** Equations *************************************************/ +void equation_section() : {/*@bgen(jjtree) equation_section */ + SimpleNode jjtn000 = new SimpleNode(JJTEQUATION_SECTION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) equation_section */ + try { +/*@egen*/ +// [ initial ] equation { equation ";" } + ( "initial" { jjtn000.op = "initial"; } )? "equation" ( LOOKAHEAD(2) equation() ";" )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void algorithm_section() : {/*@bgen(jjtree) algorithm_section */ + SimpleNode jjtn000 = new SimpleNode(JJTALGORITHM_SECTION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) algorithm_section */ + try { +/*@egen*/ +// [ initial ] algorithm { statement ";" } + ( "initial" )? "algorithm" ( statement() ";" )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ } + +void assignment() : {/*@bgen(jjtree) assignment */ + SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) assignment */ + try { +/*@egen*/ + ( simple_expression() "=" expression() )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +Node equation() : {/*@bgen(jjtree) equation */ + SimpleNode jjtn000 = new SimpleNode(JJTEQUATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) equation */ + try { +/*@egen*/ +// ( simple_expression "=" expression +// | if_equation +// | for_equation +// | connect_clause +// | when_equation +// | IDENT function_call_args ) +// comment + ( LOOKAHEAD(3) assignment() + | if_equation() + | for_equation() + | connect_clause() + | when_equation() + | function_call_args() ) + comment()/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { return jjtn000; }/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void statement() : {/*@bgen(jjtree) statement */ + SimpleNode jjtn000 = new SimpleNode(JJTSTATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) statement */ + try { +/*@egen*/ +// ( component_reference ( ":=" expression | function_call_args ) +// | "(" output_expression_list ")" ":=" component_reference function_call_args +// | break +// | return +// | if_statement +// | for_statement +// | while_statement +// | when_statement ) +// comment + ( component_reference() ( ":=" expression() | function_call_args() ) + | "(" output_expression_list() ")" ":=" component_reference() function_call_args() + | "break" + | "return" + | if_statement() + | for_statement() + | while_statement() + | when_statement() ) + comment()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void if_equation() : {/*@bgen(jjtree) if_equation */ + SimpleNode jjtn000 = new SimpleNode(JJTIF_EQUATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) if_equation */ + try { +/*@egen*/ +// if expression then +// { equation ";" } +// { elseif expression then +// { equation ";" } +// } +// [ else +// { equation ";" } +// ] +// end if + "if" expression() "then" + ( equation() ";" )* + ( "elseif" expression() "then" + ( equation() ";" )* + )* + ( "else" + ( equation() ";" )* + )? + "end" "if"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ } + +void then_statement() : {/*@bgen(jjtree) then_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTTHEN_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) then_statement */ + try { +/*@egen*/ + ( statement() )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ } + +void elseif_statement() : {/*@bgen(jjtree) elseif_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTELSEIF_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) elseif_statement */ + try { +/*@egen*/ + ( statement() )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void else_statement() : {/*@bgen(jjtree) else_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTELSE_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) else_statement */ + try { +/*@egen*/ + ( statement() )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void if_statement() : {/*@bgen(jjtree) if_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTIF_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) if_statement */ + try { +/*@egen*/ +// if expression then +// { statement ";" } +// { elseif expression then +// { statement ";" } +// } +// [ else +// { statement ";" } +// ] +// end if + "if" expression() "then" + ( then_statement() ";" )* + ( "elseif" expression() "then" + ( elseif_statement() ";" )* + )* + ( "else" + ( else_statement() ";" )* + )? + "end" "if"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ } + +void for_equation() : {/*@bgen(jjtree) for_equation */ + SimpleNode jjtn000 = new SimpleNode(JJTFOR_EQUATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) for_equation */ + try { +/*@egen*/ +// for for_indices loop +// { equation ";" } +// end for + "for" for_indices() "loop" + ( equation() ";" )* + "end" "for"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ } + +void for_statement() : {/*@bgen(jjtree) for_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTFOR_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) for_statement */ + try { +/*@egen*/ +// for for_indices loop +// { equation ";" } +// end for + "for" for_indices() "loop" + ( statement() ";" )* + "end" "for"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ } + +void for_indices() : {/*@bgen(jjtree) for_indices */ + SimpleNode jjtn000 = new SimpleNode(JJTFOR_INDICES); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) for_indices */ + try { +/*@egen*/ + //for_index {"," for_index} + for_index() ("," for_index())*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void for_index() : {/*@bgen(jjtree) for_index */ + SimpleNode jjtn000 = new SimpleNode(JJTFOR_INDEX); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ Token t; +} {/*@bgen(jjtree) for_index */ + try { +/*@egen*/ + //IDENT [ in expression ] + t= { jjtn000.op = t.image; } ( "in" expression() )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void while_statement() : {/*@bgen(jjtree) while_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTWHILE_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) while_statement */ + try { +/*@egen*/ +// while expression loop +// { statement ";" } +// end while + "while" expression() "loop" + ( statement() ";" )* + "end" "while"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ } + +void when_equation() : {/*@bgen(jjtree) when_equation */ + SimpleNode jjtn000 = new SimpleNode(JJTWHEN_EQUATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) when_equation */ + try { +/*@egen*/ +// when expression then +// { equation ";" } +// { elsewhen expression then +// { equation ";" } } +// end when + "when" expression() "then" + ( equation() ";" )* + ( "elsewhen" expression() "then" + ( equation() ";" )* + )* + "end" "when"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ } + +void when_statement() : {/*@bgen(jjtree) when_statement */ + SimpleNode jjtn000 = new SimpleNode(JJTWHEN_STATEMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) when_statement */ + try { +/*@egen*/ +// when expression then +// { statement ";" } +// { elsewhen expression then +// { statement ";" } } +// end when + "when" expression() "then" + ( statement() ";" )* + ( "elsewhen" expression() "then" + ( statement() ";" )* + )* + "end" "when"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ } + +void connect_clause() : {/*@bgen(jjtree) connect_clause */ + SimpleNode jjtn000 = new SimpleNode(JJTCONNECT_CLAUSE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) connect_clause */ + try { +/*@egen*/ +// connect "(" component_reference "," component_reference ")" + "connect" "(" component_reference() "," component_reference() ")"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +/*** Expressions ***************************************************/ +void expr() : {/*@bgen(jjtree) expr */ + SimpleNode jjtn000 = new SimpleNode(JJTEXPR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) expr */ + try { +/*@egen*/ + simple_expression() + | + "if" expression() "then" expression() ( "elseif" expression() "then" expression() )* + "else" expression() /*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void if_expression() : {/*@bgen(jjtree) if_expression */ + SimpleNode jjtn000 = new SimpleNode(JJTIF_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) if_expression */ + try { +/*@egen*/ + "if" expression() "then" expression() ( "elseif" expression() "then" expression() )* + "else" expression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + + +void expression() : {/*@bgen(jjtree) expression */ + SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) expression */ + try { +/*@egen*/ + simple_expression() | if_expression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void simple_expression() : {/*@bgen(jjtree) simple_expression */ + SimpleNode jjtn000 = new SimpleNode(JJTSIMPLE_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) simple_expression */ + try { +/*@egen*/ + logical_expression() ( ":" logical_expression() ( ":" logical_expression() )? )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void logical_expression() : {/*@bgen(jjtree) logical_expression */ + SimpleNode jjtn000 = new SimpleNode(JJTLOGICAL_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) logical_expression */ + try { +/*@egen*/ + logical_term() ( "or" logical_term() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void logical_term() : {/*@bgen(jjtree) logical_term */ + SimpleNode jjtn000 = new SimpleNode(JJTLOGICAL_TERM); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) logical_term */ + try { +/*@egen*/ + logical_factor() ( "and" logical_factor() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void logical_factor() : {/*@bgen(jjtree) logical_factor */ + SimpleNode jjtn000 = new SimpleNode(JJTLOGICAL_FACTOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) logical_factor */ + try { +/*@egen*/ + ( "not" )? relation()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void relation() : {/*@bgen(jjtree) relation */ + SimpleNode jjtn000 = new SimpleNode(JJTRELATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) relation */ + try { +/*@egen*/ + arithmetic_expression() ( rel_op() arithmetic_expression() )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void rel_op() : {/*@bgen(jjtree) rel_op */ + SimpleNode jjtn000 = new SimpleNode(JJTREL_OP); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) rel_op */ + try { +/*@egen*/ + "<"/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = "< ";} | "<="/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = "<=";} | ">"/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = " >";} | ">="/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = " >=";} | "=="/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = "==";} | "<>"/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = "<>";}/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void arithmetic_expression() : {/*@bgen(jjtree) arithmetic_expression */ + SimpleNode jjtn000 = new SimpleNode(JJTARITHMETIC_EXPRESSION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) arithmetic_expression */ + try { +/*@egen*/ + (add_op())? term() (add_op() term())*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void add_op() : {/*@bgen(jjtree) add_op */ + SimpleNode jjtn000 = new SimpleNode(JJTADD_OP); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) add_op */ + try { +/*@egen*/ + "+"/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = "+";} | "-"/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = "-";} | ".+" | ".-"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + + +void term() : {/*@bgen(jjtree) term */ + SimpleNode jjtn000 = new SimpleNode(JJTTERM); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) term */ + try { +/*@egen*/ + factor() ( mul_op() factor() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void mul_op() : {/*@bgen(jjtree) mul_op */ + SimpleNode jjtn000 = new SimpleNode(JJTMUL_OP); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) mul_op */ + try { +/*@egen*/ + "*"/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = "*";} | "/"/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = "/";} | ".*" | "./"/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void factor() : {/*@bgen(jjtree) factor */ + SimpleNode jjtn000 = new SimpleNode(JJTFACTOR); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) factor */ + try { +/*@egen*/ + primary() ( "^" | ".^" primary() )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void der_initial() : {/*@bgen(jjtree) der_initial */ + SimpleNode jjtn000 = new SimpleNode(JJTDER_INITIAL); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) der_initial */ + try { +/*@egen*/ + ( (name() { jjtn000.op = "application"; } |"der" { jjtn000.op = "der";} |"initial" { jjtn000.op = "initial";} ) function_call_args() )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void subscript_2() : {/*@bgen(jjtree) subscript_2 */ + SimpleNode jjtn000 = new SimpleNode(JJTSUBSCRIPT_2); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) subscript_2 */ + try { +/*@egen*/ + ( expression_list() ( ";" expression_list() )* )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void array() : {/*@bgen(jjtree) array */ + SimpleNode jjtn000 = new SimpleNode(JJTARRAY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ } {/*@bgen(jjtree) array */ + try { +/*@egen*/ + ( "{" function_arguments() "}" )/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ } + +void primary() : {/*@bgen(jjtree) primary */ + SimpleNode jjtn000 = new SimpleNode(JJTPRIMARY); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ Token t; +} {/*@bgen(jjtree) primary */ + try { +/*@egen*/ + t=/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = token.image; } + | t=/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = token.image; } + | t=/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = token.image; } + | t="false"/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = token.image; } + | t="true"/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = token.image; } + | LOOKAHEAD( (name()|"der"|"initial") "(" ) der_initial() | component_reference() + /* | "(" output_expression_list() ")" */ // Not needed, replaced with following: + | "(" expression() ")" + | "[" subscript_2() "]" + | array() + | "end"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +String name() : {/*@bgen(jjtree) name */ + SimpleNode jjtn000 = new SimpleNode(JJTNAME); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ + String ret = new String(""); +} {/*@bgen(jjtree) name */ + try { +/*@egen*/ +// [ "." ] IDENT { "." IDENT } + ( "." { ret += "."; } )? + { ret += token.image; jjtn000.op = token.image;} + ( "." { ret += "."; } + { ret += token.image; jjtn000.op = token.image;} + )*/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ + { return ret; + }/*@bgen(jjtree)*/ + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void component_reference() : {/*@bgen(jjtree) component_reference */ + SimpleNode jjtn000 = new SimpleNode(JJTCOMPONENT_REFERENCE); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ + Token t; +} {/*@bgen(jjtree) component_reference */ + try { +/*@egen*/ +// [ "." ] IDENT [ array_subscripts ] { "." IDENT [ array_subscripts ] } + ( "." )? t= { jjtn000.op = t.image; } ( array_subscripts() )? ( "." ( array_subscripts() )? )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void function_call_args() : {/*@bgen(jjtree) function_call_args */ + SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_CALL_ARGS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) function_call_args */ + try { +/*@egen*/ +// "(" [ function_arguments ] ")" + "(" ( function_arguments() )? ")"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void function_arguments() : {/*@bgen(jjtree) function_arguments */ + SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_ARGUMENTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) function_arguments */ + try { +/*@egen*/ + //expression [ "," function_arguments | for for_indices ] + //| named_arguments + LOOKAHEAD(2) expression() ( "," function_arguments() | "for" for_indices() )? + | named_arguments()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void named_arguments() : {/*@bgen(jjtree) named_arguments */ + SimpleNode jjtn000 = new SimpleNode(JJTNAMED_ARGUMENTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) named_arguments */ + try { +/*@egen*/ +// named_argument [ "," named_arguments ] + named_argument() ( "," named_arguments() )?/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void named_argument() : {/*@bgen(jjtree) named_argument */ + SimpleNode jjtn000 = new SimpleNode(JJTNAMED_ARGUMENT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) named_argument */ + try { +/*@egen*/ + "=" expression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void output_expression_list() : {/*@bgen(jjtree) output_expression_list */ + SimpleNode jjtn000 = new SimpleNode(JJTOUTPUT_EXPRESSION_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) output_expression_list */ + try { +/*@egen*/ +// [ expression ] { "," [ expression ] } + ( expression() )? ( "," ( expression() )? )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void expression_list() : {/*@bgen(jjtree) expression_list */ + SimpleNode jjtn000 = new SimpleNode(JJTEXPRESSION_LIST); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) expression_list */ + try { +/*@egen*/ +// expression { "," expression } + expression() ( "," expression() )*/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void array_subscripts() : {/*@bgen(jjtree) array_subscripts */ + SimpleNode jjtn000 = new SimpleNode(JJTARRAY_SUBSCRIPTS); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) array_subscripts */ + try { +/*@egen*/ +// "[" subscript { "," subscript } "]" + "[" subscript() ( "," subscript() )* "]"/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +void subscript() : {/*@bgen(jjtree) subscript */ + SimpleNode jjtn000 = new SimpleNode(JJTSUBSCRIPT); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) subscript */ + try { +/*@egen*/ +// ":" | expression ":"/*@bgen(jjtree)*/ + { + jjtree.closeNodeScope(jjtn000, true); + jjtc000 = false; + } +/*@egen*/ { jjtn000.op = "all"; } | expression()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + +String comment() : { + String ret; } { // string_comment [ annotation ] + ret = string_comment() ( annotation() )? + { return ret; + } +} + +String string_comment() : { + String ret = null; +} { +// [ STRING { "+" STRING } ] + ( { ret = new String(token.image); } + ( "+" { ret += "+"; } + { ret += token.image; } + )* + )? + { return ret; + } } + +void annotation() : {/*@bgen(jjtree) annotation */ + SimpleNode jjtn000 = new SimpleNode(JJTANNOTATION); + boolean jjtc000 = true; + jjtree.openNodeScope(jjtn000); +/*@egen*/ +} {/*@bgen(jjtree) annotation */ + try { +/*@egen*/ +// annotation class_modification + "annotation" class_modification()/*@bgen(jjtree)*/ + } catch (Throwable jjte000) { + if (jjtc000) { + jjtree.clearNodeScope(jjtn000); + jjtc000 = false; + } else { + jjtree.popNode(); + } + if (jjte000 instanceof RuntimeException) { + throw (RuntimeException)jjte000; + } + if (jjte000 instanceof ParseException) { + throw (ParseException)jjte000; + } + throw (Error)jjte000; + } finally { + if (jjtc000) { + jjtree.closeNodeScope(jjtn000, true); + } + } +/*@egen*/ +} + diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jjt b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jjt new file mode 100644 index 00000000..793e0cfd --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ModelicaParser.jjt @@ -0,0 +1,782 @@ +options { + JDK_VERSION = "1.6"; + STATIC = false; +} + +PARSER_BEGIN(ModelParser) +package fi.semantum.sysdyn.solver.parser; + +import java.util.ArrayList; + +public class ModelParser { + + private ArrayList inputs = new ArrayList(); + private ArrayList outputs = new ArrayList(); + + private enum InterfaceVariableType { INPUT, OUTPUT, OTHER + } + + public class Parameter { + public String name; + public boolean optional; + public String description; + public String type; + + public Parameter() { + name = new String(""); + optional = false; + description = null; + type = null; + } } + + public ArrayList getInputs() + { + return inputs; + } + + public ArrayList getOutputs() + { + return outputs; + } + +} + +PARSER_END(ModelParser) + +/*** Lexer *********************************************************/ + +SKIP: +{ +| +| +} + +TOKEN: +{ +"algorithm" | "discrete" | "false" | "model" | "redeclare" +| "and" | "each" | "final" | "not" | "replaceable" +| "annotation" | "else" | "flow" | "operator" | "return" +|"assert" | "elseif" | "for" | "or" | "stream" +| "block" | "elsewhen" | "function" | "outer" | "then" +| "break" | "encapsulated" | "if" | "output" | "true" +| "class" | "end" | "import" | "package" | "type" +| "connect" | "enumeration" | "in" | "parameter" | "when" +| "connector" | "equation" | "initial" | "partial" | "while" +| "constant" | "expandable" | "inner" | "protected" | "within" +| "constrainedby" | "extends" | "input" | "public" +| "der" | "external" | "loop" | "record" +| "(" | ")" | "{" | "}" | "[" | "]" | "." | ":" | ";" | "," +| "<" | "<=" | ">" | ">=" | "==" | "<>" +| "+" | "-" | ".+" | ".-" +| "*" | "/" | ".*" | "./" +| "^" | ".^" +| "=" | ":=" +| +| + { matchedToken.image = matchedToken.image.substring(1,matchedToken.image.length()-1); } +| +| "." ()? (["e","E"] )? + | "." (["e","E"] )? + | ["e","E"] + ) > +} + +/*** Parser ********************************************************/ + +// https://javacc.dev.java.net/doc/javaccgrm.html +// add_op -> add_op() +// [ add_op ] -> ( add_op() )? +// { add_op term } -> ( add_op() term() )* + +Node parse() : { +} { + stored_definition() + { return jjtThis; } +} + +/*** Stored Definition - Within ************************************/ + +Node stored_definition() #STORED : { +} { +// stored_definition: +// [ within [ name ] ";" ] +// { [ final ] class_definition ";" } + ( "within" ( name() )? ";" )? + ( ( "final" )? class_definition() ";" )* + { return jjtThis; } +} + +/*** Class Definition **********************************************/ + +void class_definition() : { +} { +// class_definition : +// [ encapsulated ] +// [ partial +// ] ( class modelrecordblock expandableconnectortype +// | | | | [ ] | | package | function | operator | operator function | operator record ) +// class_specifier + ( "encapsulated" )? + ( "partial" )? + ( "class" | "model" | "record" | "block" | ( "expandable" )? "connector" | "type" | + "package" | "function" { jjtThis.op = "function"; } | "operator" | "operator function" | "operator record" ) + class_specifier() +} + + +void class_specifier() : { Token t; +} { +// class_specifier : +// IDENT string_comment composition end IDENT +// | IDENT "=" base_prefix name [ array_subscripts ] +// [ class_modification ] comment +// | IDENT "=" enumeration "(" ( [enum_list] | ":" ) ")" comment +// | IDENT "=" der "(" name "," IDENT { "," IDENT } ")" comment +// | extends IDENT [ class_modification ] string_comment composition +// end IDENT + LOOKAHEAD(2) t= { jjtThis.op = t.image; } string_comment() composition() "end" + | LOOKAHEAD(2) "=" base_prefix() name() ( array_subscripts() )? ( class_modification() )? comment() + | LOOKAHEAD(3) "=" "enumeration" "(" ( ( enum_list() )? | ":" ) ")" comment() + |LOOKAHEAD(3) "=" "der" "(" name() "," ( "," )* ")" comment() + | "extends" ( class_modification() )? string_comment() composition() "end" +} + +void base_prefix() : { +} { + type_prefix() +} + +void enum_list() : { +} { +// enumeration_literal { "," enumeration_literal} + enumeration_literal() ( "," enumeration_literal() )* +} + +void enumeration_literal() : { +} { + comment() +} + +void parse_composition() : { +} { + composition() +} + +void composition() : { +} { +// element_list +// { public element_list | +// protected element_list | +// equation_section | +// algorithm_section +// } +// [ external [ language_specification ] +// [ external_function_call ] [ annotation ] ";" ] +// [ annotation ";" ] + element_list() + ( LOOKAHEAD(2) "public" element_list() | "protected" element_list() | equation_section() | algorithm_section() )* + ( "external" ( language_specification() )? ( external_function_call() )? ( annotation() )? ";" )? + ( annotation() ";" )? +} + +void language_specification() : { +} { + +} + +void external_function_call() : { +} { +// [ component_reference "=" ] +// IDENT "(" [ expression_list ] ")" + ( component_reference() "=" )? + "(" ( expression_list() )? ")" +} + +void element_list() : { +} { + ( element() ";" )* +} + +Node element() : { +} { +// import_clause | +// extends_clause | +// [ redeclare ] +// [ final ] +// [ inner ] [ outer ] +// ( ( class_definition | component_clause) | +// replaceable ( class_definition | component_clause) +// [constraining_clause comment]) + import_clause() | + extends_clause() | + ( "redeclare" )? + ( "final" )? + ( "inner" )? ( "outer" )? + ( (class_definition() | component_clause()) | + "replaceable" (class_definition() | component_clause()) + (constraining_clause() comment())?) + { return jjtThis; } +} + +void import_clause() : { +} { +// import ( IDENT "=" name | name ["." "*"] ) comment + "import" (LOOKAHEAD(2) "=" name() | name() ("." "*")? ) comment() +} + +/*** Extends *******************************************************/ +void extends_clause() : { +} { +// extends name [ class_modification ] [annotation] + "extends" name() ( class_modification() )? ( annotation() )? +} + +void constraining_clause() : { +} { +// constrainedby name [ class_modification ] + "constrainedby" name() ( class_modification() )? +} + +/*** Component Clause **********************************************/ +void component_clause() : { + InterfaceVariableType ioType = InterfaceVariableType.OTHER; + String typeSpecifier = ""; + //String arraySubscripts = null; + ArrayList componentList = new ArrayList(); +} { + +// type_prefix type_specifier [ array_subscripts ] component_list + ( ioType = type_prefix() ) + ( typeSpecifier = type_specifier() ) + ( /*arraySubscripts =*/ array_subscripts() )? + ( componentList = component_list() ) + { + if (ioType == InterfaceVariableType.INPUT) { + for (Parameter input : componentList) { + input.type = typeSpecifier; + inputs.add(input); } + } else if (ioType == InterfaceVariableType.OUTPUT) { + for (Parameter output : componentList) { + output.type = typeSpecifier; + outputs.add(output); + } + } + } +} + +InterfaceVariableType type_prefix() : { + InterfaceVariableType type = InterfaceVariableType.OTHER; +} { +// [ flow | stream ] +// [ discrete | parameter | constant ] [ input | output ] + ( "flow" | "stream" )? + ( "discrete" { jjtThis.op = "discrete"; }| "parameter" { jjtThis.op = "parameter"; }| "constant" { jjtThis.op = "constant"; })? + ( "output" { type = InterfaceVariableType.OUTPUT; jjtThis.op = "output"; } + | "input" { type = InterfaceVariableType.INPUT; jjtThis.op = "input"; } + )? + { + return type; + } +} +String type_specifier() : { + String ret = new String(""); +} { + ret = name() + { + jjtThis.op = ret; return ret; + } +} + +ArrayList component_list() : { + ArrayList ret = new ArrayList(); + Parameter temp; +} { +// component_declaration { "," component_declaration } + temp = component_declaration() { ret.add(temp); } ( "," temp = component_declaration() { ret.add(temp); } )* + { return ret; + } +} + +Parameter component_declaration() : { + Parameter ret; + String temp = ""; +} { +// declaration [ conditional_attribute ] comment + ret = declaration() ( conditional_attribute() )? ret.description = comment() + { + return ret; + } +} + +void conditional_attribute() : { +} { + "if" expression() +} + +Parameter declaration() : { Token t; + // Parameter here without comment yet. + Parameter ret = new Parameter(); +} { +// IDENT [ array_subscripts ] [ modification ] + { ret.name = new String(token.image); jjtThis.op = token.image; } + ( array_subscripts() )? + ( ret.optional = modification() )? + { return ret; } +} + +/*** Modification **********************************************/ +boolean modification() : { + boolean optional = false; +} { +// class_modification [ "=" expression ] +// | "=" expression +// | ":=" expression + ( class_modification() ( "=" expression() )? + | "=" expression() { optional = true; } + | ":=" expression() { optional = true; } ) + { return optional; + } +} + +void class_modification() : { +} { +// "(" [ argument_list ] ")" + "(" ( argument_list() )? ")" +} + +void argument_list() : { +} { +// argument { "," argument } + argument() ( "," argument() )* +} + +void argument() : { +} { +// element_modification_or_replaceable +// | element_redeclaration + element_modification_or_replaceable() | + element_redeclaration() +} + +void element_modification_or_replaceable() : { +} { +// [ each ] [ final ] ( element_modification | element_replaceable) + ( "each" )? ( "final" )? ( element_modification() | element_replaceable() ) } + +void element_modification() : { +} { +// name [ modification ] string_comment + name() ( modification() )? string_comment() +} + +void element_redeclaration() : { +} { +// redeclare [ each ] [ final ] +// ( ( class_definition | component_clause1) | element_replaceable ) + "redeclare" ( "each" )? ( "final" )? + ( ( class_definition() | component_clause1() ) | element_replaceable() ) } + +void element_replaceable() : { +} { +// replaceable ( class_definition | component_clause1) +// [constraining_clause] + "replaceable" ( class_definition() | component_clause1() ) ( constraining_clause() )? +} + +void component_clause1() : { +} { +// type_prefix type_specifier component_declaration1 + type_prefix() type_specifier() component_declaration1() +} + +void component_declaration1() : { +} { + declaration() comment() +} + + +/*** Equations *************************************************/ +void equation_section() : { +} { +// [ initial ] equation { equation ";" } + ( "initial" { jjtThis.op = "initial"; } )? "equation" ( LOOKAHEAD(2) equation() ";" )* +} + +void algorithm_section() : { +} { +// [ initial ] algorithm { statement ";" } + ( "initial" )? "algorithm" ( statement() ";" )* } + +void assignment() : { +} { + ( simple_expression() "=" expression() ) +} + +Node equation() : { +} { +// ( simple_expression "=" expression +// | if_equation +// | for_equation +// | connect_clause +// | when_equation +// | IDENT function_call_args ) +// comment + ( LOOKAHEAD(3) assignment() + | if_equation() + | for_equation() + | connect_clause() + | when_equation() + | function_call_args() ) + comment() { return jjtThis; } +} + +void statement() : { +} { +// ( component_reference ( ":=" expression | function_call_args ) +// | "(" output_expression_list ")" ":=" component_reference function_call_args +// | break +// | return +// | if_statement +// | for_statement +// | while_statement +// | when_statement ) +// comment + ( component_reference() ( ":=" expression() | function_call_args() ) + | "(" output_expression_list() ")" ":=" component_reference() function_call_args() + | "break" + | "return" + | if_statement() + | for_statement() + | while_statement() + | when_statement() ) + comment() +} + +void if_equation() : { +} { +// if expression then +// { equation ";" } +// { elseif expression then +// { equation ";" } +// } +// [ else +// { equation ";" } +// ] +// end if + "if" expression() "then" + ( equation() ";" )* + ( "elseif" expression() "then" + ( equation() ";" )* + )* + ( "else" + ( equation() ";" )* + )? + "end" "if" } + +void then_statement() : { +} { + ( statement() ) } + +void elseif_statement() : { +} { + ( statement() ) +} + +void else_statement() : { +} { + ( statement() ) +} + +void if_statement() : { +} { +// if expression then +// { statement ";" } +// { elseif expression then +// { statement ";" } +// } +// [ else +// { statement ";" } +// ] +// end if + "if" expression() "then" + ( then_statement() ";" )* + ( "elseif" expression() "then" + ( elseif_statement() ";" )* + )* + ( "else" + ( else_statement() ";" )* + )? + "end" "if" } + +void for_equation() : { +} { +// for for_indices loop +// { equation ";" } +// end for + "for" for_indices() "loop" + ( equation() ";" )* + "end" "for" } + +void for_statement() : { +} { +// for for_indices loop +// { equation ";" } +// end for + "for" for_indices() "loop" + ( statement() ";" )* + "end" "for" } + +void for_indices() : { +} { + //for_index {"," for_index} + for_index() ("," for_index())* +} + +void for_index() : { Token t; +} { + //IDENT [ in expression ] + t= { jjtThis.op = t.image; } ( "in" expression() )? +} + +void while_statement() : { +} { +// while expression loop +// { statement ";" } +// end while + "while" expression() "loop" + ( statement() ";" )* + "end" "while" } + +void when_equation() : { +} { +// when expression then +// { equation ";" } +// { elsewhen expression then +// { equation ";" } } +// end when + "when" expression() "then" + ( equation() ";" )* + ( "elsewhen" expression() "then" + ( equation() ";" )* + )* + "end" "when" } + +void when_statement() : { +} { +// when expression then +// { statement ";" } +// { elsewhen expression then +// { statement ";" } } +// end when + "when" expression() "then" + ( statement() ";" )* + ( "elsewhen" expression() "then" + ( statement() ";" )* + )* + "end" "when" } + +void connect_clause() : { +} { +// connect "(" component_reference "," component_reference ")" + "connect" "(" component_reference() "," component_reference() ")" +} + +/*** Expressions ***************************************************/ +void expr() : { +} { + simple_expression() + | + "if" expression() "then" expression() ( "elseif" expression() "then" expression() )* + "else" expression() +} + +void if_expression() : { +} { + "if" expression() "then" expression() ( "elseif" expression() "then" expression() )* + "else" expression() +} + + +void expression() : { +} { + simple_expression() | if_expression() +} + +void simple_expression() : { +} { + logical_expression() ( ":" logical_expression() ( ":" logical_expression() )? )? +} + +void logical_expression() : { +} { + logical_term() ( "or" logical_term() )* +} + +void logical_term() : { +} { + logical_factor() ( "and" logical_factor() )* +} + +void logical_factor() : { +} { + ( "not" )? relation() +} + +void relation() : { +} { + arithmetic_expression() ( rel_op() arithmetic_expression() )? +} + +void rel_op() : { +} { + "<" { jjtThis.op = "< ";} | "<=" { jjtThis.op = "<=";} | ">" { jjtThis.op = " >";} | ">=" { jjtThis.op = " >=";} | "==" { jjtThis.op = "==";} | "<>" { jjtThis.op = "<>";} +} + +void arithmetic_expression() : { +} { + (add_op())? term() (add_op() term())* +} + +void add_op() : { +} { + "+" { jjtThis.op = "+";} | "-" { jjtThis.op = "-";} | ".+" | ".-" +} + + +void term() : { +} { + factor() ( mul_op() factor() )* +} + +void mul_op() : { +} { + "*" { jjtThis.op = "*";} | "/" { jjtThis.op = "/";} | ".*" | "./" +} + +void factor() : { +} { + primary() ( "^" | ".^" primary() )? +} + +void der_initial() : { +} { + ( (name() { jjtThis.op = "application"; } |"der" { jjtThis.op = "der";} |"initial" { jjtThis.op = "initial";} ) function_call_args() ) +} + +void subscript_2() : { +} { + ( expression_list() ( ";" expression_list() )* ) +} + +void array() : { } { + ( "{" function_arguments() "}" ) } + +void primary() : { Token t; +} { + t= { jjtThis.op = token.image; } + | t= { jjtThis.op = token.image; } + | t= { jjtThis.op = token.image; } + | t="false" { jjtThis.op = token.image; } + | t="true" { jjtThis.op = token.image; } + | LOOKAHEAD( (name()|"der"|"initial") "(" ) der_initial() | component_reference() + /* | "(" output_expression_list() ")" */ // Not needed, replaced with following: + | "(" expression() ")" + | "[" subscript_2() "]" + | array() + | "end" +} + +String name() : { + String ret = new String(""); +} { +// [ "." ] IDENT { "." IDENT } + ( "." { ret += "."; } )? + { ret += token.image; jjtThis.op = token.image;} + ( "." { ret += "."; } + { ret += token.image; jjtThis.op = token.image;} + )* + { return ret; + } +} + +void component_reference() : { + Token t; +} { +// [ "." ] IDENT [ array_subscripts ] { "." IDENT [ array_subscripts ] } + ( "." )? t= { jjtThis.op = t.image; } ( array_subscripts() )? ( "." ( array_subscripts() )? )* +} + +void function_call_args() : { +} { +// "(" [ function_arguments ] ")" + "(" ( function_arguments() )? ")" +} + +void function_arguments() : { +} { + //expression [ "," function_arguments | for for_indices ] + //| named_arguments + LOOKAHEAD(2) expression() ( "," function_arguments() | "for" for_indices() )? + | named_arguments() +} + +void named_arguments() : { +} { +// named_argument [ "," named_arguments ] + named_argument() ( "," named_arguments() )? +} + +void named_argument() : { +} { + "=" expression() +} + +void output_expression_list() : { +} { +// [ expression ] { "," [ expression ] } + ( expression() )? ( "," ( expression() )? )* +} + +void expression_list() : { +} { +// expression { "," expression } + expression() ( "," expression() )* +} + +void array_subscripts() : { +} { +// "[" subscript { "," subscript } "]" + "[" subscript() ( "," subscript() )* "]" +} + +void subscript() : { +} { +// ":" | expression ":" { jjtThis.op = "all"; } | expression() +} + +String comment() #void : { + String ret; } { // string_comment [ annotation ] + ret = string_comment() ( annotation() )? + { return ret; + } +} + +String string_comment() #void : { + String ret = null; +} { +// [ STRING { "+" STRING } ] + ( { ret = new String(token.image); } + ( "+" { ret += "+"; } + { ret += token.image; } + )* + )? + { return ret; + } } + +void annotation() : { +} { +// annotation class_modification + "annotation" class_modification() +} + diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/Node.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/Node.java new file mode 100644 index 00000000..862f65fb --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/Node.java @@ -0,0 +1,36 @@ +/* Generated By:JJTree: Do not edit this line. Node.java Version 4.3 */ +/* JavaCCOptions:MULTI=false,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package fi.semantum.sysdyn.solver.parser; + +/* All AST nodes must implement this interface. It provides basic + machinery for constructing the parent and child relationships + between nodes. */ + +public +interface Node { + + /** This method is called after the node has been made the current + node. It indicates that child nodes can now be added to it. */ + public void jjtOpen(); + + /** This method is called after all the child nodes have been + added. */ + public void jjtClose(); + + /** This pair of methods are used to inform the node of its + parent. */ + public void jjtSetParent(Node n); + public Node jjtGetParent(); + + /** This method tells the node to add its argument to the node's + list of children. */ + public void jjtAddChild(Node n, int i); + + /** This method returns a child node. The children are numbered + from zero, left to right. */ + public Node jjtGetChild(int i); + + /** Return the number of children the node has. */ + public int jjtGetNumChildren(); +} +/* JavaCC - OriginalChecksum=3ac4c20d0d1bb5d97b8317a16454eef1 (do not edit this line) */ diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ParseException.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ParseException.java new file mode 100644 index 00000000..de4ad462 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/ParseException.java @@ -0,0 +1,187 @@ +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ +/* JavaCCOptions:KEEP_LINE_COL=null */ +package fi.semantum.sysdyn.solver.parser; + +/** + * This exception is thrown when parse errors are encountered. + * You can explicitly create objects of this exception type by + * calling the method generateParseException in the generated + * parser. + * + * You can modify this class to customize your error reporting + * mechanisms so long as you retain the public fields. + */ +public class ParseException extends Exception { + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * This constructor is used by the method "generateParseException" + * in the generated parser. Calling this constructor generates + * a new object of this type with the fields "currentToken", + * "expectedTokenSequences", and "tokenImage" set. + */ + public ParseException(Token currentTokenVal, + int[][] expectedTokenSequencesVal, + String[] tokenImageVal + ) + { + super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal)); + currentToken = currentTokenVal; + expectedTokenSequences = expectedTokenSequencesVal; + tokenImage = tokenImageVal; + } + + /** + * The following constructors are for use by you for whatever + * purpose you can think of. Constructing the exception in this + * manner makes the exception behave in the normal way - i.e., as + * documented in the class "Throwable". The fields "errorToken", + * "expectedTokenSequences", and "tokenImage" do not contain + * relevant information. The JavaCC generated code does not use + * these constructors. + */ + + public ParseException() { + super(); + } + + /** Constructor with message. */ + public ParseException(String message) { + super(message); + } + + + /** + * This is the last token that has been consumed successfully. If + * this object has been created due to a parse error, the token + * followng this token will (therefore) be the first error token. + */ + public Token currentToken; + + /** + * Each entry in this array is an array of integers. Each array + * of integers represents a sequence of tokens (by their ordinal + * values) that is expected at this point of the parse. + */ + public int[][] expectedTokenSequences; + + /** + * This is a reference to the "tokenImage" array of the generated + * parser within which the parse error occurred. This array is + * defined in the generated ...Constants interface. + */ + public String[] tokenImage; + + /** + * It uses "currentToken" and "expectedTokenSequences" to generate a parse + * error message and returns it. If this object has been created + * due to a parse error, and you do not catch it (it gets thrown + * from the parser) the correct error message + * gets displayed. + */ + private static String initialise(Token currentToken, + int[][] expectedTokenSequences, + String[] tokenImage) { + String eol = System.getProperty("line.separator", "\n"); + StringBuffer expected = new StringBuffer(); + int maxSize = 0; + for (int i = 0; i < expectedTokenSequences.length; i++) { + if (maxSize < expectedTokenSequences[i].length) { + maxSize = expectedTokenSequences[i].length; + } + for (int j = 0; j < expectedTokenSequences[i].length; j++) { + expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' '); + } + if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { + expected.append("..."); + } + expected.append(eol).append(" "); + } + String retval = "Encountered \""; + Token tok = currentToken.next; + for (int i = 0; i < maxSize; i++) { + if (i != 0) retval += " "; + if (tok.kind == 0) { + retval += tokenImage[0]; + break; + } + retval += " " + tokenImage[tok.kind]; + retval += " \""; + retval += add_escapes(tok.image); + retval += " \""; + tok = tok.next; + } + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; + retval += "." + eol; + if (expectedTokenSequences.length == 1) { + retval += "Was expecting:" + eol + " "; + } else { + retval += "Was expecting one of:" + eol + " "; + } + retval += expected.toString(); + return retval; + } + + /** + * The end of line string for this machine. + */ + protected String eol = System.getProperty("line.separator", "\n"); + + /** + * Used to convert raw characters to their escaped version + * when these raw version cannot be used as part of an ASCII + * string literal. + */ + static String add_escapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + +} +/* JavaCC - OriginalChecksum=b5f58e7b423243b1bf84726ed111c7e8 (do not edit this line) */ diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/SimpleCharStream.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/SimpleCharStream.java new file mode 100644 index 00000000..14ba6213 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/SimpleCharStream.java @@ -0,0 +1,471 @@ +/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */ +/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package fi.semantum.sysdyn.solver.parser; + +/** + * An implementation of interface CharStream, where the stream is assumed to + * contain only ASCII characters (without unicode processing). + */ + +public class SimpleCharStream +{ +/** Whether parser is static. */ + public static final boolean staticFlag = false; + int bufsize; + int available; + int tokenBegin; +/** Position in buffer. */ + public int bufpos = -1; + protected int bufline[]; + protected int bufcolumn[]; + + protected int column = 0; + protected int line = 1; + + protected boolean prevCharIsCR = false; + protected boolean prevCharIsLF = false; + + protected java.io.Reader inputStream; + + protected char[] buffer; + protected int maxNextCharInd = 0; + protected int inBuf = 0; + protected int tabSize = 8; + + protected void setTabSize(int i) { tabSize = i; } + protected int getTabSize(int i) { return tabSize; } + + + protected void ExpandBuff(boolean wrapAround) + { + char[] newbuffer = new char[bufsize + 2048]; + int newbufline[] = new int[bufsize + 2048]; + int newbufcolumn[] = new int[bufsize + 2048]; + + try + { + if (wrapAround) + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos += (bufsize - tokenBegin)); + } + else + { + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); + buffer = newbuffer; + + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); + bufline = newbufline; + + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); + bufcolumn = newbufcolumn; + + maxNextCharInd = (bufpos -= tokenBegin); + } + } + catch (Throwable t) + { + throw new Error(t.getMessage()); + } + + + bufsize += 2048; + available = bufsize; + tokenBegin = 0; + } + + protected void FillBuff() throws java.io.IOException + { + if (maxNextCharInd == available) + { + if (available == bufsize) + { + if (tokenBegin > 2048) + { + bufpos = maxNextCharInd = 0; + available = tokenBegin; + } + else if (tokenBegin < 0) + bufpos = maxNextCharInd = 0; + else + ExpandBuff(false); + } + else if (available > tokenBegin) + available = bufsize; + else if ((tokenBegin - available) < 2048) + ExpandBuff(true); + else + available = tokenBegin; + } + + int i; + try { + if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) + { + inputStream.close(); + throw new java.io.IOException(); + } + else + maxNextCharInd += i; + return; + } + catch(java.io.IOException e) { + --bufpos; + backup(0); + if (tokenBegin == -1) + tokenBegin = bufpos; + throw e; + } + } + +/** Start. */ + public char BeginToken() throws java.io.IOException + { + tokenBegin = -1; + char c = readChar(); + tokenBegin = bufpos; + + return c; + } + + protected void UpdateLineColumn(char c) + { + column++; + + if (prevCharIsLF) + { + prevCharIsLF = false; + line += (column = 1); + } + else if (prevCharIsCR) + { + prevCharIsCR = false; + if (c == '\n') + { + prevCharIsLF = true; + } + else + line += (column = 1); + } + + switch (c) + { + case '\r' : + prevCharIsCR = true; + break; + case '\n' : + prevCharIsLF = true; + break; + case '\t' : + column--; + column += (tabSize - (column % tabSize)); + break; + default : + break; + } + + bufline[bufpos] = line; + bufcolumn[bufpos] = column; + } + +/** Read a character. */ + public char readChar() throws java.io.IOException + { + if (inBuf > 0) + { + --inBuf; + + if (++bufpos == bufsize) + bufpos = 0; + + return buffer[bufpos]; + } + + if (++bufpos >= maxNextCharInd) + FillBuff(); + + char c = buffer[bufpos]; + + UpdateLineColumn(c); + return c; + } + + @Deprecated + /** + * @deprecated + * @see #getEndColumn + */ + + public int getColumn() { + return bufcolumn[bufpos]; + } + + @Deprecated + /** + * @deprecated + * @see #getEndLine + */ + + public int getLine() { + return bufline[bufpos]; + } + + /** Get token end column number. */ + public int getEndColumn() { + return bufcolumn[bufpos]; + } + + /** Get token end line number. */ + public int getEndLine() { + return bufline[bufpos]; + } + + /** Get token beginning column number. */ + public int getBeginColumn() { + return bufcolumn[tokenBegin]; + } + + /** Get token beginning line number. */ + public int getBeginLine() { + return bufline[tokenBegin]; + } + +/** Backup a number of characters. */ + public void backup(int amount) { + + inBuf += amount; + if ((bufpos -= amount) < 0) + bufpos += bufsize; + } + + /** Constructor. */ + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + + /** Constructor. */ + public SimpleCharStream(java.io.Reader dstream, int startline, + int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + + /** Constructor. */ + public SimpleCharStream(java.io.Reader dstream) + { + this(dstream, 1, 1, 4096); + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn, int buffersize) + { + inputStream = dstream; + line = startline; + column = startcolumn - 1; + + if (buffer == null || buffersize != buffer.length) + { + available = bufsize = buffersize; + buffer = new char[buffersize]; + bufline = new int[buffersize]; + bufcolumn = new int[buffersize]; + } + prevCharIsLF = prevCharIsCR = false; + tokenBegin = inBuf = maxNextCharInd = 0; + bufpos = -1; + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader dstream, int startline, + int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } + + /** Reinitialise. */ + public void ReInit(java.io.Reader dstream) + { + ReInit(dstream, 1, 1, 4096); + } + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, startline, startcolumn, 4096); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, int startline, + int startcolumn) + { + this(dstream, startline, startcolumn, 4096); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + this(dstream, encoding, 1, 1, 4096); + } + + /** Constructor. */ + public SimpleCharStream(java.io.InputStream dstream) + { + this(dstream, 1, 1, 4096); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException + { + ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn, int buffersize) + { + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, 1, 1, 4096); + } + + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream) + { + ReInit(dstream, 1, 1, 4096); + } + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, String encoding, int startline, + int startcolumn) throws java.io.UnsupportedEncodingException + { + ReInit(dstream, encoding, startline, startcolumn, 4096); + } + /** Reinitialise. */ + public void ReInit(java.io.InputStream dstream, int startline, + int startcolumn) + { + ReInit(dstream, startline, startcolumn, 4096); + } + /** Get token literal value. */ + public String GetImage() + { + if (bufpos >= tokenBegin) + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); + else + return new String(buffer, tokenBegin, bufsize - tokenBegin) + + new String(buffer, 0, bufpos + 1); + } + + /** Get the suffix. */ + public char[] GetSuffix(int len) + { + char[] ret = new char[len]; + + if ((bufpos + 1) >= len) + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); + else + { + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, + len - bufpos - 1); + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); + } + + return ret; + } + + /** Reset buffer when finished. */ + public void Done() + { + buffer = null; + bufline = null; + bufcolumn = null; + } + + /** + * Method to adjust line and column numbers for the start of a token. + */ + public void adjustBeginLineColumn(int newLine, int newCol) + { + int start = tokenBegin; + int len; + + if (bufpos >= tokenBegin) + { + len = bufpos - tokenBegin + inBuf + 1; + } + else + { + len = bufsize - tokenBegin + bufpos + 1 + inBuf; + } + + int i = 0, j = 0, k = 0; + int nextColDiff = 0, columnDiff = 0; + + while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) + { + bufline[j] = newLine; + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; + bufcolumn[j] = newCol + columnDiff; + columnDiff = nextColDiff; + i++; + } + + if (i < len) + { + bufline[j] = newLine++; + bufcolumn[j] = newCol + columnDiff; + + while (i++ < len) + { + if (bufline[j = start % bufsize] != bufline[++start % bufsize]) + bufline[j] = newLine++; + else + bufline[j] = newLine; + } + } + + line = bufline[j]; + column = bufcolumn[j]; + } + +} +/* JavaCC - OriginalChecksum=ca8536fa0e367b808d68ae76a4e5e3a7 (do not edit this line) */ diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/SimpleNode.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/SimpleNode.java new file mode 100644 index 00000000..b399a88f --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/SimpleNode.java @@ -0,0 +1,81 @@ +/* Generated By:JJTree: Do not edit this line. SimpleNode.java Version 4.3 */ +/* JavaCCOptions:MULTI=false,NODE_USES_PARSER=false,VISITOR=false,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY=,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package fi.semantum.sysdyn.solver.parser; + +public +class SimpleNode implements Node { + + protected Node parent; + protected Node[] children; + protected int id; + protected Object value; + protected ModelParser parser; + + public String op; + + public SimpleNode(int i) { + id = i; + } + + public SimpleNode(ModelParser p, int i) { + this(i); + parser = p; + } + + public void jjtOpen() { + } + + public void jjtClose() { + } + + public void jjtSetParent(Node n) { parent = n; } + public Node jjtGetParent() { return parent; } + + public void jjtAddChild(Node n, int i) { + if (children == null) { + children = new Node[i + 1]; + } else if (i >= children.length) { + Node c[] = new Node[i + 1]; + System.arraycopy(children, 0, c, 0, children.length); + children = c; + } + children[i] = n; + } + + public Node jjtGetChild(int i) { + return children[i]; + } + + public int jjtGetNumChildren() { + return (children == null) ? 0 : children.length; + } + + public void jjtSetValue(Object value) { this.value = value; } + public Object jjtGetValue() { return value; } + + /* You can override these two methods in subclasses of SimpleNode to + customize the way the node appears when the tree is dumped. If + your output uses more than one line you should override + toString(String), otherwise overriding toString() is probably all + you need to do. */ + + public String toString() { return ModelParserTreeConstants.jjtNodeName[id]; } + public String toString(String prefix) { return prefix + toString(); } + + /* Override this method if you want to customize how the node dumps + out its children. */ + + public void dump(String prefix) { + System.out.println(toString(prefix)); + if (children != null) { + for (int i = 0; i < children.length; ++i) { + SimpleNode n = (SimpleNode)children[i]; + if (n != null) { + n.dump(prefix + " "); + } + } + } + } +} + +/* JavaCC - OriginalChecksum=77b52cae8f60a97f6e484f498134f167 (do not edit this line) */ diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/Token.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/Token.java new file mode 100644 index 00000000..0cfda203 --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/Token.java @@ -0,0 +1,131 @@ +/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ +package fi.semantum.sysdyn.solver.parser; + +/** + * Describes the input token stream. + */ + +public class Token implements java.io.Serializable { + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /** + * An integer that describes the kind of this token. This numbering + * system is determined by JavaCCParser, and a table of these numbers is + * stored in the file ...Constants.java. + */ + public int kind; + + /** The line number of the first character of this Token. */ + public int beginLine; + /** The column number of the first character of this Token. */ + public int beginColumn; + /** The line number of the last character of this Token. */ + public int endLine; + /** The column number of the last character of this Token. */ + public int endColumn; + + /** + * The string image of the token. + */ + public String image; + + /** + * A reference to the next regular (non-special) token from the input + * stream. If this is the last token from the input stream, or if the + * token manager has not read tokens beyond this one, this field is + * set to null. This is true only if this token is also a regular + * token. Otherwise, see below for a description of the contents of + * this field. + */ + public Token next; + + /** + * This field is used to access special tokens that occur prior to this + * token, but after the immediately preceding regular (non-special) token. + * If there are no such special tokens, this field is set to null. + * When there are more than one such special token, this field refers + * to the last of these special tokens, which in turn refers to the next + * previous special token through its specialToken field, and so on + * until the first special token (whose specialToken field is null). + * The next fields of special tokens refer to other special tokens that + * immediately follow it (without an intervening regular token). If there + * is no such token, this field is null. + */ + public Token specialToken; + + /** + * An optional attribute value of the Token. + * Tokens which are not used as syntactic sugar will often contain + * meaningful values that will be used later on by the compiler or + * interpreter. This attribute value is often different from the image. + * Any subclass of Token that actually wants to return a non-null value can + * override this method as appropriate. + */ + public Object getValue() { + return null; + } + + /** + * No-argument constructor + */ + public Token() {} + + /** + * Constructs a new token for the specified Image. + */ + public Token(int kind) + { + this(kind, null); + } + + /** + * Constructs a new token for the specified Image and Kind. + */ + public Token(int kind, String image) + { + this.kind = kind; + this.image = image; + } + + /** + * Returns the image. + */ + public String toString() + { + return image; + } + + /** + * Returns a new Token object, by default. However, if you want, you + * can create and return subclass objects based on the value of ofKind. + * Simply add the cases to the switch for all those special cases. + * For example, if you have a subclass of Token called IDToken that + * you want to create if ofKind is ID, simply add something like : + * + * case MyParserConstants.ID : return new IDToken(ofKind, image); + * + * to the following switch statement. Then you can cast matchedToken + * variable to the appropriate type and use sit in your lexical actions. + */ + public static Token newToken(int ofKind, String image) + { + switch(ofKind) + { + default : return new Token(ofKind, image); + } + } + + public static Token newToken(int ofKind) + { + return newToken(ofKind, null); + } + +} +/* JavaCC - OriginalChecksum=849435840a0a4c85d87a2152b704b03b (do not edit this line) */ diff --git a/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/TokenMgrError.java b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/TokenMgrError.java new file mode 100644 index 00000000..f33980de --- /dev/null +++ b/fi.semantum.sysdyn.solver/src/fi/semantum/sysdyn/solver/parser/TokenMgrError.java @@ -0,0 +1,147 @@ +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ +/* JavaCCOptions: */ +package fi.semantum.sysdyn.solver.parser; + +/** Token Manager Error. */ +public class TokenMgrError extends Error +{ + + /** + * The version identifier for this Serializable class. + * Increment only if the serialized form of the + * class changes. + */ + private static final long serialVersionUID = 1L; + + /* + * Ordinals for various reasons why an Error of this type can be thrown. + */ + + /** + * Lexical error occurred. + */ + static final int LEXICAL_ERROR = 0; + + /** + * An attempt was made to create a second instance of a static token manager. + */ + static final int STATIC_LEXER_ERROR = 1; + + /** + * Tried to change to an invalid lexical state. + */ + static final int INVALID_LEXICAL_STATE = 2; + + /** + * Detected (and bailed out of) an infinite loop in the token manager. + */ + static final int LOOP_DETECTED = 3; + + /** + * Indicates the reason why the exception is thrown. It will have + * one of the above 4 values. + */ + int errorCode; + + /** + * Replaces unprintable characters by their escaped (or unicode escaped) + * equivalents in the given string + */ + protected static final String addEscapes(String str) { + StringBuffer retval = new StringBuffer(); + char ch; + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) + { + case 0 : + continue; + case '\b': + retval.append("\\b"); + continue; + case '\t': + retval.append("\\t"); + continue; + case '\n': + retval.append("\\n"); + continue; + case '\f': + retval.append("\\f"); + continue; + case '\r': + retval.append("\\r"); + continue; + case '\"': + retval.append("\\\""); + continue; + case '\'': + retval.append("\\\'"); + continue; + case '\\': + retval.append("\\\\"); + continue; + default: + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { + String s = "0000" + Integer.toString(ch, 16); + retval.append("\\u" + s.substring(s.length() - 4, s.length())); + } else { + retval.append(ch); + } + continue; + } + } + return retval.toString(); + } + + /** + * Returns a detailed message for the Error when it is thrown by the + * token manager to indicate a lexical error. + * Parameters : + * EOFSeen : indicates if EOF caused the lexical error + * curLexState : lexical state in which this error occurred + * errorLine : line number when the error occurred + * errorColumn : column number when the error occurred + * errorAfter : prefix that was seen before this error occurred + * curchar : the offending character + * Note: You can customize the lexical error message by modifying this method. + */ + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { + return("Lexical error at line " + + errorLine + ", column " + + errorColumn + ". Encountered: " + + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + + "after : \"" + addEscapes(errorAfter) + "\""); + } + + /** + * You can also modify the body of this method to customize your error messages. + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not + * of end-users concern, so you can return something like : + * + * "Internal Error : Please file a bug report .... " + * + * from this method for such cases in the release version of your parser. + */ + public String getMessage() { + return super.getMessage(); + } + + /* + * Constructors of various flavors follow. + */ + + /** No arg constructor. */ + public TokenMgrError() { + } + + /** Constructor with message and reason. */ + public TokenMgrError(String message, int reason) { + super(message); + errorCode = reason; + } + + /** Full Constructor. */ + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); + } +} +/* JavaCC - OriginalChecksum=e56f34a3810aefee801894d03cfcfd89 (do not edit this line) */ -- 2.47.1