Java 类org.antlr.runtime.tree.DOTTreeGenerator 实例源码

项目:sparql-dqp    文件:SPARQLQueryPlanBuilder.java   
/**
 * {@inheritDoc}
 */
public Operator buildQueryPlan(String query,
        DQPResourceAccessor dqpResourceAccessor,
        RequestDetails requestDetails) throws ActivityUserException
{
    // get function repository from the context
    FunctionRepository functionRepository = (FunctionRepository) OGSADAIContext
            .getInstance().get(FunctionRepository.FUNCTION_REPOSITORY_KEY);

    CommonTree ast = parseSPARQL(query);
    if (LOG.isDebugEnabled())
    {
        LOG.debug("Parsed query");
        LOG.debug((new DOTTreeGenerator()).toDOT(ast).toString());
    }
    return buildValidatedLQP(ast, dqpResourceAccessor, requestDetails,
            functionRepository);
}
项目:pm    文件:ANTLRDemo.java   
public static void main(String[] args) throws Exception {

        StringInputStream inputStream = new StringInputStream("sum (sma(9, macd (1,2,3, close)) , close)");
        ANTLRInputStream in = new ANTLRInputStream(inputStream);
        ParameterizedOperationsLexer lexer = new ParameterizedOperationsLexer(in);
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        ParameterizedOperationsParser parser = new ParameterizedOperationsParser(tokens);
        CommonTree tree  = (CommonTree) parser.indicatorexpr().getTree();
        DOTTreeGenerator gen = new DOTTreeGenerator();
        StringTemplate st = gen.toDOT(tree);
        System.out.println(st);
    }
项目:pm    文件:FormulaParser.java   
private Operation parse(String formula) throws Exception {
    CommonTree commonTree = parameterizedBuilder.antlrParser.buildTree(new StringInputStream(formula));

    if (LOGGER.isDebugEnabled()) {
        DOTTreeGenerator gen = new DOTTreeGenerator();
        StringTemplate st = gen.toDOT(commonTree);
        LOGGER.debug(st);
    }

    Operation builtOperation = buildOperation(commonTree);
    if (builtOperation != null) builtOperation.setFormula(formula);
    return builtOperation;
}
项目:legstar-cob2xsd    文件:AbstractAntlrTester.java   
/**
 * Produce a dot source for an abstract syntax tree.
 * 
 * @param ast the abstract syntax tree
 * @return a dot source
 */
private String getGraph(final Tree ast) {
    DOTTreeGenerator gen = new DOTTreeGenerator();
    StringTemplate st = gen.toDOT(ast);
    return st.toString();
}
项目:legstar-core2    文件:AbstractAntlrTester.java   
/**
 * Produce a dot source for an abstract syntax tree.
 * 
 * @param ast the abstract syntax tree
 * @return a dot source
 */
private String getGraph(final Tree ast) {
    DOTTreeGenerator gen = new DOTTreeGenerator();
    StringTemplate st = gen.toDOT(ast);
    return st.toString();
}