Examples of ANTLRStringStream


Examples of org.antlr.runtime.ANTLRStringStream

        NodeTestDSLParser parser = new NodeTestDSLParser( new CommonTokenStream( lexer ) );
        return parser;
    }

    private static NodeTestDSLParser getParser(final String source) throws IOException {
        NodeTestDSLLexer lexer = new NodeTestDSLLexer( new ANTLRStringStream( source ) );
        NodeTestDSLParser parser = new NodeTestDSLParser( new CommonTokenStream( lexer ) );
        return parser;
    }
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

        return parse( name,
                      text.toString() );
    }

    private CharStream newCharStream(final String text) {
        return new ANTLRStringStream( text );
    }
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

    }

    @Test
    public void testChunkWithoutParens() throws Exception {
        String input = "( foo )";
        createParser( new ANTLRStringStream( input ) );
        String returnData = parser.chunk( DRLLexer.LEFT_PAREN,
                                          DRLLexer.RIGHT_PAREN,
                                          -1 );

        assertEquals( "foo",
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

    }

    @Test
    public void testChunkWithParens() throws Exception {
        String input = "(fnord())";
        createParser( new ANTLRStringStream( input ) );
        String returnData = parser.chunk( DRLLexer.LEFT_PAREN,
                                          DRLLexer.RIGHT_PAREN,
                                          -1 );

        assertEquals( "fnord()",
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

    }

    @Test
    public void testChunkWithParensAndQuotedString() throws Exception {
        String input = "( fnord( \"cheese\" ) )";
        createParser( new ANTLRStringStream( input ) );
        String returnData = parser.chunk( DRLLexer.LEFT_PAREN,
                                          DRLLexer.RIGHT_PAREN,
                                          -1 );

        assertEquals( "fnord( \"cheese\" )",
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

    }

    @Test
    public void testChunkWithRandomCharac5ters() throws Exception {
        String input = "( %*9dkj)";
        createParser( new ANTLRStringStream( input ) );
        String returnData = parser.chunk( DRLLexer.LEFT_PAREN,
                                          DRLLexer.RIGHT_PAREN,
                                          -1 );

        assertEquals( "%*9dkj",
 
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

    }

    private Object parse( final String parserRuleName,
                          final String text ) throws Exception {
        return execParser( parserRuleName,
                           new ANTLRStringStream( text ) );
    }
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

        NodeTestDSLParser parser = new NodeTestDSLParser( new CommonTokenStream( lexer ) );
        return parser;
    }

    private static NodeTestDSLParser getParser(final String source) throws IOException {
        NodeTestDSLLexer lexer = new NodeTestDSLLexer( new ANTLRStringStream( source ) );
        NodeTestDSLParser parser = new NodeTestDSLParser( new CommonTokenStream( lexer ) );
        return parser;
    }
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

                                                              "Unable to find @positional field " + descr.getPosition() + " for class " + tDecl.getTypeName() + "\n" ) );
                return;
            }

            // TODO: WTH is this??????
            DRLLexer lex = new DRLLexer( new ANTLRStringStream( descr.getExpression() ) );
            boolean isSimpleIdentifier = false;
            try {
                lex.mID();
                isSimpleIdentifier = lex.getCharIndex() >= descr.getExpression().length();
            } catch ( RecognitionException e ) {
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

    //return (GrammarAST)parser.getAST();
    return r;
  }

  public GrammarAST parseArtificialRule(String ruleText) {
    ANTLRLexer lexer = new ANTLRLexer(new ANTLRStringStream(ruleText));
    ANTLRParser parser = ANTLRParser.createParser(new CommonTokenStream(lexer));
    parser.setGrammar(this);
    parser.setGrammarType(this.type);
    try {
      ANTLRParser.rule_return result = parser.rule();
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.