Package org.antlr.v4.runtime

Examples of org.antlr.v4.runtime.LexerInterpreter


                       "lexer grammar T;\n"+
                       "A : 'a';\n" +
                       "B : 'b';\n" +
                       "C : 'c';\n");
    String input = "abc";
    LexerInterpreter lexEngine = g.createLexerInterpreter(new ANTLRInputStream(input));
    CommonTokenStream stream = new CommonTokenStream(lexEngine);
    stream.fill();
    TokenStreamRewriter tokens = new TokenStreamRewriter(stream);
    tokens.insertBefore(2, "y");
    tokens.replace(2, "x");
View Full Code Here


                       "lexer grammar T;\n"+
                       "A : 'a';\n" +
                       "B : 'b';\n" +
                       "C : 'c';\n");
    String input = "abc";
    LexerInterpreter lexEngine = g.createLexerInterpreter(new ANTLRInputStream(input));
    CommonTokenStream stream = new CommonTokenStream(lexEngine);
    stream.fill();
    TokenStreamRewriter tokens = new TokenStreamRewriter(stream);
    tokens.replace(2, "x");
    tokens.insertAfter(2, "y");
View Full Code Here

                       "lexer grammar T;\n"+
                       "A : 'a';\n" +
                       "B : 'b';\n" +
                       "C : 'c';\n");
    String input = "abcccba";
    LexerInterpreter lexEngine = g.createLexerInterpreter(new ANTLRInputStream(input));
    CommonTokenStream stream = new CommonTokenStream(lexEngine);
    stream.fill();
    TokenStreamRewriter tokens = new TokenStreamRewriter(stream);
    tokens.replace(2, 4, "x");
    tokens.insertBefore(2, "y");
View Full Code Here

                       "lexer grammar T;\n"+
                       "A : 'a';\n" +
                       "B : 'b';\n" +
                       "C : 'c';\n");
    String input = "abcccba";
    LexerInterpreter lexEngine = g.createLexerInterpreter(new ANTLRInputStream(input));
    CommonTokenStream stream = new CommonTokenStream(lexEngine);
    stream.fill();
    TokenStreamRewriter tokens = new TokenStreamRewriter(stream);
    tokens.replace(2, 4, "x");
    tokens.insertBefore(4, "y");
View Full Code Here

                       "lexer grammar T;\n"+
                       "A : 'a';\n" +
                       "B : 'b';\n" +
                       "C : 'c';\n");
    String input = "abcccba";
    LexerInterpreter lexEngine = g.createLexerInterpreter(new ANTLRInputStream(input));
    CommonTokenStream stream = new CommonTokenStream(lexEngine);
    stream.fill();
    TokenStreamRewriter tokens = new TokenStreamRewriter(stream);
    tokens.replace(2, 4, "x");
    tokens.insertAfter(4, "y");
View Full Code Here

                       "lexer grammar T;\n"+
                       "A : 'a';\n" +
                       "B : 'b';\n" +
                       "C : 'c';\n");
    String input = "abcccba";
    LexerInterpreter lexEngine = g.createLexerInterpreter(new ANTLRInputStream(input));
    CommonTokenStream stream = new CommonTokenStream(lexEngine);
    stream.fill();
    TokenStreamRewriter tokens = new TokenStreamRewriter(stream);
    tokens.replace(0, 6, "x");
    String result = tokens.getText();
View Full Code Here

                       "lexer grammar T;\n"+
                       "A : 'a';\n" +
                       "B : 'b';\n" +
                       "C : 'c';\n");
    String input = "abcccba";
    LexerInterpreter lexEngine = g.createLexerInterpreter(new ANTLRInputStream(input));
    CommonTokenStream stream = new CommonTokenStream(lexEngine);
    stream.fill();
    TokenStreamRewriter tokens = new TokenStreamRewriter(stream);
    tokens.replace(2, 4, "xyz");
    String result = tokens.getText(Interval.of(0, 6));
View Full Code Here

                       "lexer grammar T;\n"+
                       "A : 'a';\n" +
                       "B : 'b';\n" +
                       "C : 'c';\n");
    String input = "abcccba";
    LexerInterpreter lexEngine = g.createLexerInterpreter(new ANTLRInputStream(input));
    CommonTokenStream stream = new CommonTokenStream(lexEngine);
    stream.fill();
    TokenStreamRewriter tokens = new TokenStreamRewriter(stream);
    tokens.replace(2, 4, "xyz");
    tokens.replace(3, 5, "foo");
View Full Code Here

                       "lexer grammar T;\n"+
                       "A : 'a';\n" +
                       "B : 'b';\n" +
                       "C : 'c';\n");
    String input = "abcccba";
    LexerInterpreter lexEngine = g.createLexerInterpreter(new ANTLRInputStream(input));
    CommonTokenStream stream = new CommonTokenStream(lexEngine);
    stream.fill();
    TokenStreamRewriter tokens = new TokenStreamRewriter(stream);
    tokens.replace(2, 4, "xyz");
    tokens.replace(1, 3, "foo");
View Full Code Here

                       "lexer grammar T;\n"+
                       "A : 'a';\n" +
                       "B : 'b';\n" +
                       "C : 'c';\n");
    String input = "abcba";
    LexerInterpreter lexEngine = g.createLexerInterpreter(new ANTLRInputStream(input));
    CommonTokenStream stream = new CommonTokenStream(lexEngine);
    stream.fill();
    TokenStreamRewriter tokens = new TokenStreamRewriter(stream);
    tokens.replace(2, 2, "xyz");
    tokens.replace(0, 3, "foo");
View Full Code Here

TOP

Related Classes of org.antlr.v4.runtime.LexerInterpreter

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.