Package ptolemy.data.expr

Examples of ptolemy.data.expr.ParseTreeEvaluator


    // being scheduled, resolving "::" scoping syntax inside the
    // model.
    private Token _evaluateExpressionInModelScope(ASTPtRootNode node)
            throws IllegalActionException {
        if (_parseTreeEvaluator == null) {
            _parseTreeEvaluator = new ParseTreeEvaluator();
        }

        if (_parserScope == null) {
            _parserScope = new ScheduleScope();
        }
View Full Code Here


        if (_destinationsListVersion != workspace().getVersion()) {
            _updateDestinations();
        }

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

     *  of {@link ParseTreeEvaluator} is returned. The derived classes may need
     *  to override this method to return different parse tree evaluators.
     *  @return ParseTreeEvaluator used to evaluate guard expressions.
     */
    public ParseTreeEvaluator getParseTreeEvaluator() {
        return new ParseTreeEvaluator();
    }
View Full Code Here

            if (director != null) {
                _parseTreeEvaluator = director.getParseTreeEvaluator();
            } else {
                // When this transition is used inside an FSMActor.
                if (_parseTreeEvaluator == null) {
                    _parseTreeEvaluator = new ParseTreeEvaluator();
                }
            }
            _parseTreeEvaluatorVersion = workspace().getVersion();
        }
        return _parseTreeEvaluator;
View Full Code Here

     *  some event has been detected due to crossing some level.
     *  @return True if the transition is enabled and some event is detected.
     *  @exception IllegalActionException If thrown when evaluating the guard.
     */
    public boolean isEnabled() throws IllegalActionException {
        ParseTreeEvaluator parseTreeEvaluator = getParseTreeEvaluator();
        FSMActor fsmActor = (FSMActor) getContainer();
        if (_guardParseTree == null) {
            String expr = getGuardExpression();
            // Parse the guard expression.
            PtParser parser = new PtParser();
            try {
                _guardParseTree = parser.generateParseTree(expr);
            } catch (IllegalActionException ex) {
                throw new IllegalActionException(this, ex,
                        "Failed to parse guard expression \"" + expr + "\"");
            }
        }
        Token token = parseTreeEvaluator.evaluateParseTree(_guardParseTree,
                fsmActor.getPortScope());
        if (token == null) {
            // FIXME: when could this happen??
            return false;
        }
View Full Code Here

     */
    public RecordToken(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 RecordToken) {
            RecordToken recordToken = (RecordToken) token;
            Object[] labelObjects = recordToken.labelSet().toArray();
            String[] labels = new String[labelObjects.length];
View Full Code Here

     */
    public UnionToken(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 UnionToken) {
            UnionToken unionToken = (UnionToken) token;
            _label = unionToken.label();
            _value = unionToken.value();
View Full Code Here

            throws IllegalActionException, NameDuplicationException {
        super(container, name);
        frame = new ExpressionShellFrame(this);
        setFrame(frame);
        frame.setTableau(this);
        _evaluator = new ParseTreeEvaluator();
    }
View Full Code Here

     *   not contain a parsable 2-D fix matrix.
     */
    public FixMatrixToken(String init) throws IllegalActionException {
        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        Token token = (new ParseTreeEvaluator()).evaluateParseTree(tree);

        if (token instanceof FixMatrixToken) {
            FixPoint[][] value = ((FixMatrixToken) token).fixMatrix();
            _initialize(value, null);
        } else {
View Full Code Here

        PtParser parser = new PtParser();
        ASTPtRootNode tree = parser.generateParseTree(init);
        ParseTreeTypeInference inference = new ParseTreeTypeInference();
        inference.inferTypes(tree);

        Token token = (new ParseTreeEvaluator()).evaluateParseTree(tree);

        if (token instanceof FunctionToken) {
            _function = ((FunctionToken) token)._function;
            _type = ((FunctionToken) token)._type;
        } else {
View Full Code Here

TOP

Related Classes of ptolemy.data.expr.ParseTreeEvaluator

Copyright © 2018 www.massapicom. 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.