Package ptolemy.data.expr

Examples of ptolemy.data.expr.ParseTreeWriter


     @param name The name of an expression.
     *  @return The expression referred to by the given name.
     *  @see #setExpression
     */
    public String getExpression(String name) {
        ParseTreeWriter writer = new ParseTreeWriter();
        return writer.printParseTree((ASTPtRootNode) _parseTrees
                .get(_destinationNames.indexOf(name)));
    }
View Full Code Here


                                }
                            }
                            ParseTreeSpecializer specializer = new ParseTreeSpecializer();
                            parseTree = specializer.specialize(parseTree,
                                    excludedVariables, _scope);
                            ParseTreeWriter writer = new ParseTreeWriter();
                            String outputExpression = writer
                                    .printParseTree(parseTree);
                            parameter.setExpression(outputExpression);
                        }
                    } catch (ClassCastException ex) {
                        Settable parameter = (Settable) actor
                                .getAttribute(parameterName);
                        ParseTreeFreeVariableCollector collector = new ParseTreeFreeVariableCollector();
                        Set expressionVariables = collector
                                .collectFreeVariables(parseTree);
                        Set scopeVariables = _scope.identifierSet();
                        List<String> excludedVariables = new LinkedList<String>();
                        for (Object variable : expressionVariables) {
                            if (variable instanceof String) {
                                if (!scopeVariables.contains(variable)) {
                                    excludedVariables.add((String) variable);
                                }
                            }
                        }
                        ParseTreeSpecializer specializer = new ParseTreeSpecializer();
                        parseTree = specializer.specialize(parseTree,
                                excludedVariables, _scope);
                        ParseTreeWriter writer = new ParseTreeWriter();
                        String outputExpression = writer
                                .printParseTree(parseTree);
                        parameter.setExpression(outputExpression);
                    }
                }
            } catch (Exception ex) {
View Full Code Here

            }

            buffer.append(") ");

            // FIXME: really this should include runtime references to f and g.
            ParseTreeWriter writer = new ParseTreeWriter();
            String string = writer.printParseTree(node.getExpressionTree());
            buffer.append(string);
            buffer.append(")");

            body.getUnits().add(
                    Jimple.v().newReturnStmt(
View Full Code Here

TOP

Related Classes of ptolemy.data.expr.ParseTreeWriter

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.