Examples of PtParser


Examples of ptolemy.data.expr.PtParser

         *  the corresponding parameter.
         */
        public void assignNonPtalonParameters(ComponentEntity actor)
                throws PtalonRuntimeException {
            try {
                PtParser parser = new PtParser();
                ParseTreeEvaluator _parseTreeEvaluator = new ParseTreeEvaluator();
                for (String parameterName : _parameters.keySet()) {
                    String expression = _parameters.get(parameterName);
                    if (expression == null) {
                        throw new PtalonRuntimeException(
                                "Unable to find expression label for "
                                        + "parameter " + parameterName);
                    }
                    ASTPtRootNode parseTree = parser
                            .generateParseTree(expression);
                    try {
                        Parameter parameter = (Parameter) actor
                                .getAttribute(parameterName);
                        if (parameter == null) {
View Full Code Here

Examples of ptolemy.data.expr.PtParser

            // below.
            if (_parseTree == null) {
                // Note that the parser is NOT retained, since in most
                // cases the expression doesn't change, and the parser
                // requires a large amount of memory.
                PtParser parser = new PtParser();
                _parseTree = parser.generateParseTree(expression
                        .getExpression());
            }

            if (_parseTreeEvaluator == null) {
                _parseTreeEvaluator = new ParseTreeEvaluator();
View Full Code Here

Examples of ptolemy.data.expr.PtParser

                // code above.
                if (_parseTree == null) {
                    // Note that the parser is NOT retained, since in most
                    // cases the expression doesn't change, and the parser
                    // requires a large amount of memory.
                    PtParser parser = new PtParser();
                    _parseTree = parser.generateParseTree(expression
                            .getExpression());
                }

                if (_scope == null) {
                    _scope = new VariableScope();
View Full Code Here

Examples of ptolemy.data.expr.PtParser

            // Return an array that contains type terms for all of the
            // inputs and all of the parameters that are free variables for
            // the expression.
            try {
                if (_parseTree == null) {
                    PtParser parser = new PtParser();
                    _parseTree = parser.generateParseTree(expression
                            .getExpression());
                }

                if (_scope == null) {
                    _scope = new VariableScope();
View Full Code Here

Examples of ptolemy.data.expr.PtParser

            Transition transition = (Transition) transitions.next();

            // generate code for guard expression
            String guard = transition.getGuardExpression();
            PtParser parser = new PtParser();
            ASTPtRootNode guardParseTree = parser.generateParseTree(guard);
            ParseTreeCodeGenerator parseTreeCodeGenerator = controllerHelper
                    .getParseTreeCodeGenerator();
            parseTreeCodeGenerator.evaluateParseTree(guardParseTree,
                    controllerHelper._scope);
            codeBuffer.append(parseTreeCodeGenerator.generateFireCode());
View Full Code Here

Examples of ptolemy.data.expr.PtParser

     *  <code>1.0+2.0i</code>.
     *  @exception IllegalActionException If the string does not represent
     *   a parsable complex number.
     */
    public ComplexToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        Token token = (new ParseTreeEvaluator()).evaluateParseTree(tree);

        if (token instanceof ComplexToken) {
            _value = ((ComplexToken) token).complexValue();
        } else {
View Full Code Here

Examples of ptolemy.data.expr.PtParser

        // container are not free variables of this container.
        set.removeAll(variableNames);

        // Iterate over all the variables of this container, and add in
        // any free variables they reference.
        PtParser parser = new PtParser();
        ParseTreeFreeVariableCollector collector = new ParseTreeFreeVariableCollector();

        for (Iterator variables = model.attributeList(Variable.class)
                .iterator(); variables.hasNext();) {
            Variable variable = (Variable) variables.next();
            String expression = variable.getExpression();
            ASTPtRootNode root;

            if (variable.isStringMode()) {
                root = parser.generateStringParseTree(expression);
            } else {
                root = parser.generateParseTree(expression);
            }

            Set freeIdentifiers = new HashSet(collector
                    .collectFreeVariables(root));
View Full Code Here

Examples of ptolemy.data.expr.PtParser

                                    .escapeForTargetLanguage(variable
                                            .getExpression()) + "\"", castType,
                            "String");
                }

                PtParser parser = new PtParser();
                ASTPtRootNode parseTree = null;
                try {
                    parseTree = parser.generateParseTree(variable
                            .getExpression());
                } catch (Throwable throwable) {
                    throw new IllegalActionException(variable, throwable,
                            "Failed to generate parse tree for \"" + name
                                    + "\". in \"" + container + "\"");
View Full Code Here

Examples of ptolemy.data.expr.PtParser

     @param init A string expression of an array.
     *  @exception IllegalActionException If the string does
     *   not contain a parsable array.
     */
    public ArrayToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        ParseTreeEvaluator evaluator = new ParseTreeEvaluator();
        Token token = evaluator.evaluateParseTree(tree);

        if (token instanceof ArrayToken) {
            _value = ((ArrayToken) token)._value;
View Full Code Here

Examples of ptolemy.data.expr.PtParser

     @param init A string expression of a boolean matrix.
     *  @exception IllegalActionException If the string does
     *   not contain a parsable boolean matrix.
     */
    public BooleanMatrixToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        Token token = (new ParseTreeEvaluator()).evaluateParseTree(tree);

        if (token instanceof BooleanMatrixToken) {
            boolean[][] value = ((BooleanMatrixToken) token).booleanMatrix();
            _initialize(value);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.