Package antlr

Examples of antlr.TokenStreamRewriteEngine


    lexer.setFilename(this.getFileName());
    // use the rewrite engine because we want to buffer up all tokens
    // in case they have a merged lexer/parser, send lexer rules to
    // new grammar.
    lexer.setTokenObjectClass("antlr.TokenWithIndex");
    tokenBuffer = new TokenStreamRewriteEngine(lexer);
    tokenBuffer.discard(ANTLRParser.WS);
    tokenBuffer.discard(ANTLRParser.ML_COMMENT);
    tokenBuffer.discard(ANTLRParser.COMMENT);
    tokenBuffer.discard(ANTLRParser.SL_COMMENT);
    ANTLRParser parser = new ANTLRParser(tokenBuffer);
View Full Code Here


    }
    //System.out.println("tokens rule: "+matchTokenRuleST.toString());

    ANTLRLexer lexer = new ANTLRLexer(new StringReader(matchTokenRuleST.toString()));
    lexer.setTokenObjectClass("antlr.TokenWithIndex");
    TokenStreamRewriteEngine tokbuf =
      new TokenStreamRewriteEngine(lexer);
    tokbuf.discard(ANTLRParser.WS);
    tokbuf.discard(ANTLRParser.ML_COMMENT);
    tokbuf.discard(ANTLRParser.COMMENT);
    tokbuf.discard(ANTLRParser.SL_COMMENT);
    ANTLRParser parser = new ANTLRParser(tokbuf);
    parser.setGrammar(this);
    parser.setGtype(ANTLRParser.LEXER_GRAMMAR);
    parser.setASTNodeClass("org.antlr.tool.GrammarAST");
    try {
View Full Code Here

    // first, parse with antlr.g
    //System.out.println("translate template: "+templateActionText);
    org.antlr.grammar.v2.ANTLRLexer lexer = new org.antlr.grammar.v2.ANTLRLexer(new StringReader(templateActionText));
    lexer.setFilename(grammar.getFileName());
    lexer.setTokenObjectClass("antlr.TokenWithIndex");
    TokenStreamRewriteEngine tokenBuffer = new TokenStreamRewriteEngine(lexer);
    tokenBuffer.discard(ANTLRParser.WS);
    tokenBuffer.discard(ANTLRParser.ML_COMMENT);
    tokenBuffer.discard(ANTLRParser.COMMENT);
    tokenBuffer.discard(ANTLRParser.SL_COMMENT);
    ANTLRParser parser = new ANTLRParser(tokenBuffer);
    parser.setFilename(grammar.getFileName());
    parser.setASTNodeClass("org.antlr.tool.GrammarAST");
    try {
      parser.rewrite_template();
View Full Code Here

    lexer.setFilename(this.getFileName());
    // use the rewrite engine because we want to buffer up all tokens
    // in case they have a merged lexer/parser, send lexer rules to
    // new grammar.
    lexer.setTokenObjectClass("antlr.TokenWithIndex");
    tokenBuffer = new TokenStreamRewriteEngine(lexer);
    tokenBuffer.discard(ANTLRParser.WS);
    tokenBuffer.discard(ANTLRParser.ML_COMMENT);
    tokenBuffer.discard(ANTLRParser.COMMENT);
    tokenBuffer.discard(ANTLRParser.SL_COMMENT);
    ANTLRParser parser = new ANTLRParser(tokenBuffer);
View Full Code Here

    }
    //System.out.println("tokens rule: "+matchTokenRuleST.toString());

        ANTLRLexer lexer = new ANTLRLexer(new StringReader(matchTokenRuleST.toString()));
    lexer.setTokenObjectClass("antlr.TokenWithIndex");
    TokenStreamRewriteEngine tokbuf =
      new TokenStreamRewriteEngine(lexer);
    tokbuf.discard(ANTLRParser.WS);
    tokbuf.discard(ANTLRParser.ML_COMMENT);
    tokbuf.discard(ANTLRParser.COMMENT);
    tokbuf.discard(ANTLRParser.SL_COMMENT);
        ANTLRParser parser = new ANTLRParser(tokbuf);
    parser.grammar = this;
    parser.gtype = ANTLRParser.LEXER_GRAMMAR;
        parser.setASTNodeClass("org.antlr.tool.GrammarAST");
        try {
View Full Code Here

    // first, parse with antlr.g
    //System.out.println("translate template: "+templateActionText);
    ANTLRLexer lexer = new ANTLRLexer(new StringReader(templateActionText));
    lexer.setFilename(grammar.getFileName());
    lexer.setTokenObjectClass("antlr.TokenWithIndex");
    TokenStreamRewriteEngine tokenBuffer = new TokenStreamRewriteEngine(lexer);
    tokenBuffer.discard(ANTLRParser.WS);
    tokenBuffer.discard(ANTLRParser.ML_COMMENT);
    tokenBuffer.discard(ANTLRParser.COMMENT);
    tokenBuffer.discard(ANTLRParser.SL_COMMENT);
    ANTLRParser parser = new ANTLRParser(tokenBuffer);
    parser.setFilename(grammar.getFileName());
    parser.setASTNodeClass("org.antlr.tool.GrammarAST");
    try {
      parser.rewrite_template();
View Full Code Here

    // first, parse with antlr.g
    //System.out.println("translate template: "+templateActionText);
    ANTLRLexer lexer = new ANTLRLexer(new StringReader(templateActionText));
    lexer.setFilename(grammar.getFileName());
    lexer.setTokenObjectClass("antlr.TokenWithIndex");
    TokenStreamRewriteEngine tokenBuffer = new TokenStreamRewriteEngine(lexer);
    tokenBuffer.discard(ANTLRParser.WS);
    tokenBuffer.discard(ANTLRParser.ML_COMMENT);
    tokenBuffer.discard(ANTLRParser.COMMENT);
    tokenBuffer.discard(ANTLRParser.SL_COMMENT);
    ANTLRParser parser = new ANTLRParser(tokenBuffer);
    parser.setFilename(grammar.getFileName());
    parser.setASTNodeClass("org.antlr.tool.GrammarAST");
    try {
      parser.rewrite_template();
View Full Code Here

    // first, parse with antlr.g
    //System.out.println("translate template: "+templateActionText);
    ANTLRLexer lexer = new ANTLRLexer(new StringReader(templateActionText));
    lexer.setFilename(grammar.getFileName());
    lexer.setTokenObjectClass("antlr.TokenWithIndex");
    TokenStreamRewriteEngine tokenBuffer = new TokenStreamRewriteEngine(lexer);
    tokenBuffer.discard(ANTLRParser.WS);
    tokenBuffer.discard(ANTLRParser.ML_COMMENT);
    tokenBuffer.discard(ANTLRParser.COMMENT);
    tokenBuffer.discard(ANTLRParser.SL_COMMENT);
    ANTLRParser parser = new ANTLRParser(tokenBuffer);
    parser.setFilename(grammar.getFileName());
    parser.setASTNodeClass("org.antlr.tool.GrammarAST");
    try {
      parser.rewrite_template();
View Full Code Here

TOP

Related Classes of antlr.TokenStreamRewriteEngine

Copyright © 2018 www.massapicom. 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.