Examples of CharStream


Examples of org.antlr.runtime.CharStream

    }

    public void testNotContains() throws Exception {
        final String text = "City( $city : city )\nCountry( cities not contains $city )\n";
        final AndDescr descrs = new AndDescr();
        final CharStream charStream = new ANTLRStringStream( text );
        final DRLLexer lexer = new DRLLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final DRLParser parser = new DRLParser( tokenStream );
        parser.setLineOffset( descrs.getLine() );
        parser.normal_lhs_block( descrs );
View Full Code Here

Examples of org.antlr.runtime.CharStream

    }

    public void testNotMatches() throws Exception {
        final String text = "Message( text not matches '[abc]*' )\n";
        final AndDescr descrs = new AndDescr();
        final CharStream charStream = new ANTLRStringStream( text );
        final DRLLexer lexer = new DRLLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final DRLParser parser = new DRLParser( tokenStream );
        parser.setLineOffset( descrs.getLine() );
        parser.normal_lhs_block( descrs );
View Full Code Here

Examples of org.antlr.runtime.CharStream

    }

    public void testAccessorPaths() throws Exception {
        final String text = "org   .   drools/*comment*/\t  .Message( text not matches $c#comment\n. property )\n";
        final AndDescr descrs = new AndDescr();
        final CharStream charStream = new ANTLRStringStream( text );
        final DRLLexer lexer = new DRLLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final DRLParser parser = new DRLParser( tokenStream );
        parser.setLineOffset( descrs.getLine() );
        parser.normal_lhs_block( descrs );
View Full Code Here

Examples of org.antlr.runtime.CharStream

    }

    public void testRuleParseLhs2() throws Exception {
        final String text = "Message( Message.HELLO )\n";
        final AndDescr descrs = new AndDescr();
        final CharStream charStream = new ANTLRStringStream( text );
        final DRLLexer lexer = new DRLLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final DRLParser parser = new DRLParser( tokenStream );
        parser.setLineOffset( descrs.getLine() );
        parser.normal_lhs_block( descrs );
View Full Code Here

Examples of org.antlr.runtime.CharStream

        assertTrue( parser.hasErrors() );
    }

    public void testRuleSingleLine() throws Exception {
        final String text = "rule \"another test\" salience 10 when eval( true ) then System.out.println(1); end";
        final CharStream charStream = new ANTLRStringStream( text );
        final DRLLexer lexer = new DRLLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final DRLParser parser = new DRLParser( tokenStream );
        parser.setLineOffset( 10 );
        RuleDescr rule = parser.rule();
View Full Code Here

Examples of org.antlr.runtime.CharStream

                      rule.getConsequence() );
    }

    public void testRuleTwoLines() throws Exception {
        final String text = "rule \"another test\" salience 10 when eval( true ) then System.out.println(1);\n end";
        final CharStream charStream = new ANTLRStringStream( text );
        final DRLLexer lexer = new DRLLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final DRLParser parser = new DRLParser( tokenStream );
        parser.setLineOffset( 10 );
        RuleDescr rule = parser.rule();
View Full Code Here

Examples of org.antlr.runtime.CharStream

    }

    public void testRuleParseLhs3() throws Exception {
        final String text = "(or\nnot Person()\n(and Cheese()\nMeat()\nWine()))";
        final AndDescr descrs = new AndDescr();
        final CharStream charStream = new ANTLRStringStream( text );
        final DRLLexer lexer = new DRLLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final DRLParser parser = new DRLParser( tokenStream );
        parser.setLineOffset( descrs.getLine() );
        parser.normal_lhs_block( descrs );
View Full Code Here

Examples of org.antlr.runtime.CharStream

    }

    public void testRuleParseLhs4() throws Exception {
        final String text = "not((and Cheese() Meat() Wine()))";
        final AndDescr descrs = new AndDescr();
        final CharStream charStream = new ANTLRStringStream( text );
        final DRLLexer lexer = new DRLLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final DRLParser parser = new DRLParser( tokenStream );
        parser.setLineOffset( descrs.getLine() );
        parser.normal_lhs_block( descrs );
View Full Code Here

Examples of org.antlr.runtime.CharStream

  }

  @Test
  public void compostieModel() throws org.antlr.runtime.RecognitionException,
      IOException {
    CharStream input = new ANTLRFileStream(
        "src/main/java/samples/CompositeModel.java");
    ModelLexer lex = new ModelLexer(input);
    CommonTokenStream tokens = new CommonTokenStream(lex);
    ModelParser p = new ModelParser(tokens);
    p.compilationUnit();
View Full Code Here

Examples of org.antlr.runtime.CharStream

    public abstract void onTextWord(String word);
    public abstract void onTextPhrase(String phrase);

    // convenience method because everybody needs this piece of code
    public static CmisQueryWalker getWalker(String statement) throws UnsupportedEncodingException, IOException, RecognitionException {
        CharStream input = new ANTLRInputStream(new ByteArrayInputStream(statement.getBytes("UTF-8")));
        TokenSource lexer = new CmisQlStrictLexer(input);
        TokenStream tokens = new CommonTokenStream(lexer);
        CmisQlStrictParser parser = new CmisQlStrictParser(tokens);
        CommonTree parserTree; // the ANTLR tree after parsing phase
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.