Package org.antlr.v4.runtime

Examples of org.antlr.v4.runtime.CharStream


  public Map<Integer, ASSOC> altAssociativity = new HashMap<Integer, ASSOC>();

  public LeftRecursiveRuleAnalyzer(GrammarAST ruleAST,
                   Tool tool, String ruleName, String language)
  {
    super(new CommonTreeNodeStream(new GrammarASTAdaptor(ruleAST.token.getInputStream()), ruleAST));
    this.tool = tool;
    this.ruleName = ruleName;
    this.language = language;
    this.tokenStream = ruleAST.g.tokenStream;
    if (this.tokenStream == null) {
View Full Code Here


    ClassUtils cu = new ClassUtils();
    setup(cu);
    registry.clearForType(JavaCompletionTypes.CUSTOM_TYPE);
    registry.clearForType(JavaCompletionTypes.FIELD);
    registry.clearForType(JavaCompletionTypes.NAME);
    Lexer lexer = new JavaLexer(new ANTLRInputStream(txt));
    CommonTokenStream tokens = new CommonTokenStream(lexer);

    // Create a parser that reads from the scanner
    JavaParser parser = new JavaParser(tokens);
    parser.removeErrorListeners();
View Full Code Here

  @Test
  public void Process() throws IOException {
    InputStream is = CheckSymbols.class.getResource("/Mson.js")
        .openStream();
    ANTLRInputStream input = new ANTLRInputStream(is);
    MsonLexer lexer = new MsonLexer(input);
//    SymbolASTFactory factory = new SymbolASTFactory();
//    lexer.setTokenFactory(factory);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
   
View Full Code Here

import static org.junit.Assert.assertEquals;

public class TestUnbufferedCharStream extends BaseTest {
  @Test public void testNoChar() throws Exception {
    CharStream input = createStream("");
    assertEquals(IntStream.EOF, input.LA(1));
    assertEquals(IntStream.EOF, input.LA(2));
  }
View Full Code Here

   * EOF symbol is consumed, but {@link UnbufferedCharStream} handles this
   * particular case by throwing an {@link IllegalStateException}.
   */
  @Test(expected = IllegalStateException.class)
  public void testConsumeEOF() throws Exception {
    CharStream input = createStream("");
    assertEquals(IntStream.EOF, input.LA(1));
    input.consume();
    input.consume();
  }
View Full Code Here

    input.consume();
  }

  @Test(expected = IllegalArgumentException.class)
  public void testNegativeSeek() {
    CharStream input = createStream("");
    input.seek(-1);
  }
View Full Code Here

    input.seek(-1);
  }

  @Test
  public void testSeekPastEOF() {
    CharStream input = createStream("");
    assertEquals(0, input.index());
    input.seek(1);
    assertEquals(0, input.index());
  }
View Full Code Here

   * {@link UnbufferedCharStream} handles this case by throwing an
   * {@link IllegalStateException}.
   */
  @Test(expected = IllegalStateException.class)
  public void testMarkReleaseOutOfOrder() {
    CharStream input = createStream("");
    int m1 = input.mark();
    int m2 = input.mark();
    input.release(m1);
  }
View Full Code Here

   * is released twice, but {@link UnbufferedCharStream} handles this case by
   * throwing an {@link IllegalStateException}.
   */
  @Test(expected = IllegalStateException.class)
  public void testMarkReleasedTwice() {
    CharStream input = createStream("");
    int m1 = input.mark();
    input.release(m1);
    input.release(m1);
  }
View Full Code Here

   * is released twice, but {@link UnbufferedCharStream} handles this case by
   * throwing an {@link IllegalStateException}.
   */
  @Test(expected = IllegalStateException.class)
  public void testNestedMarkReleasedTwice() {
    CharStream input = createStream("");
    int m1 = input.mark();
    int m2 = input.mark();
    input.release(m2);
    input.release(m2);
  }
View Full Code Here

TOP

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

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.