Package org.antlr.runtime.tree

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


     * .child( tuple(var("deco", kind("SINK")), var("child", wild())));
     */
    PatternMatch psink = tuple(kind("SINK"), var("name", wild()), var("sink",
        kind("STRING")));
    PatternMatch pp = or(psink, pdeco);
    LOG.info(sink.toStringTree());

    Map<String, CommonTree> m = pp.match(sink);
    assertNotNull(m);
    assertTrue(m.containsKey("deco"));
    dumpMatches(m);
View Full Code Here


        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"))
        .toString();
    LOG.info("LogicalName " + lname);
View Full Code Here

    String lname = FlumeBuilder.buildSimpleArg(m.get("LogicalNodeName"))
        .toString();
    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

            if (nodeTypes != null) {
                int numNodeTypes = 0;
                // Walk each of the nodes underneath the NODE_TYPES parent node ...
                for (int i = 0; i != nodeTypes.getChildCount(); ++i) {
                    CommonTree nodeType = (CommonTree)nodeTypes.getChild(i);
                    if (this.debug) System.out.println(nodeType.toStringTree());
                    Path nodeTypePath = context.createNodeType(nodeType, parentPath);
                    if (nodeTypePath == null) continue;
                    ++numNodeTypes;

                    CommonTree propertyDefinitions = (CommonTree)nodeType.getFirstChildWithType(CndLexer.PROPERTY_DEFINITION);
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.