Package org.antlr.runtime.tree

Examples of org.antlr.runtime.tree.CommonTree.toStringTree()


        kind("logicalNode"), var("LogicalNodeName", kind("STRING")))));
    Map<String, CommonTree> m = pp.match(sink);
    assertNotNull(m);
    dumpMatches(m);

    LOG.info(sink.toStringTree());

    CommonTree fix = m.get("logical");
    LOG.info(fix.toStringTree());

    String lname = FlumeBuilder.buildSimpleArg(m.get("LogicalNodeName"));
View Full Code Here


    dumpMatches(m);

    LOG.info(sink.toStringTree());

    CommonTree fix = m.get("logical");
    LOG.info(fix.toStringTree());

    String lname = FlumeBuilder.buildSimpleArg(m.get("LogicalNodeName"));
    LOG.info("LogicalName " + lname);

    CommonTree replace = FlumeBuilder.parseSink("rpcSink(\"foo\",12345)");
View Full Code Here

    String lname = FlumeBuilder.buildSimpleArg(m.get("LogicalNodeName"));
    LOG.info("LogicalName " + lname);

    CommonTree replace = FlumeBuilder.parseSink("rpcSink(\"foo\",12345)");
    LOG.info(replace.toStringTree());

    fix.parent.parent.replaceChildren(1, 1, replace);

    LOG.info(sink.toStringTree());
    String out = FlumeSpecGen.genEventSink(sink);
View Full Code Here

  @Test
  public void testShadow() throws RecognitionException, FlumeSpecException {
    String shadowed = "[ logicalNode(\"collector1\"), logicalNode(\"collector2\"), logicalNode(\"collector3\") ]";
    CommonTree sink = FlumeBuilder.parseSink(shadowed);
    LOG.info(sink.toStringTree());

    PatternMatch pp = recursive(kind("SINK").child(
        var("ln", kind("logicalNode"))));
    Map<String, CommonTree> m = pp.match(sink);
    assertNotNull(m);
View Full Code Here

  @Test
  public void testVarTupleShadow() throws RecognitionException,
      FlumeSpecException {
    String shadowed = "[ logicalNode(\"collector1\"), logicalNode(\"collector2\"), logicalNode(\"collector3\") ]";
    CommonTree sink = FlumeBuilder.parseSink(shadowed);
    LOG.info(sink.toStringTree());

    PatternMatch pp = recursive(var("ln", kind("SINK").child(
        var("ln", kind("logicalNode")))));
    Map<String, CommonTree> m = pp.match(sink);
    assertNotNull(m);
View Full Code Here

  @Test
  public void testVarParentShadow() throws RecognitionException,
      FlumeSpecException {
    String shadowed = "{ null0 => {  null1 => [ logicalNode(\"collector1\"), logicalNode(\"collector2\"), logicalNode(\"collector3\") ] } }";
    CommonTree sink = FlumeBuilder.parseSink(shadowed);
    LOG.info(sink.toStringTree());

    // parent wins (pattern could match null0 or null1)
    PatternMatch pp = recursive(var("ln", kind("DECO").child(
        recursive(var("ln", kind("logicalNode"))))));
    Map<String, CommonTree> m = pp.match(sink);
View Full Code Here

   */
  @Test(expected = RuntimeRecognitionException.class)
  public void testLetInWrongPlace() throws RecognitionException {
    String badsink = "{ deco1 => { let letvar := test in deco2 =>   [ < sink1 ? sink2> , sink3, { deco3 => sink4}  ]  } } ";
    CommonTree parse = FlumeBuilder.parseSink(badsink);
    LOG.info(parse.toStringTree());
  }

  /**
   * Verify basic functionality - contains basic sink/source/decorator
   */
 
View Full Code Here

  public static Pair<EventSource, EventSink> buildNode(Context context, File f)
      throws IOException, RecognitionException, FlumeSpecException {
    CommonTree t = parseNodeFile(f.getCanonicalPath());
    if (t.getText() != "NODE") {
      throw new FlumeSpecException("fail, expected node but had "
          + t.toStringTree());
    }
    // String host = t.getChild(0).getText();
    CommonTree tsrc = (CommonTree) t.getChild(0);
    CommonTree tsnk = (CommonTree) t.getChild(1);
View Full Code Here

                    Method[] methods = _return.getDeclaredMethods();
                    for(Method method : methods) {
                        if ( method.getName().equals("getTree") ) {
                            Method returnName = _return.getMethod("getTree");
                            CommonTree tree = (CommonTree) returnName.invoke(ruleReturn);
                            result = tree.toStringTree();
                        }
                        else if ( method.getName().equals("getTemplate") ) {
                            Method returnName = _return.getMethod("getTemplate");
                            StringTemplate st = (StringTemplate) returnName.invoke(ruleReturn);
                            result = st.toString();
View Full Code Here

    CommonTokenStream tokens = new CommonTokenStream( lexer );
    HQLParser parser = new HQLParser( tokens );
    statement_return statement = parser.statement();
    System.out.println( tokens.getTokens() );
    CommonTree tree = (CommonTree) statement.getTree();
    System.out.println( tree.toStringTree() );
  }

}
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.