Examples of ANTLRInputStream


Examples of org.antlr.runtime.ANTLRInputStream

    private Tree parse(String expression)
    {
        InputStream is = new ByteArrayInputStream(expression.getBytes());

        ANTLRInputStream ais;

        try
        {
            ais = new ANTLRInputStream(is);
        } catch (IOException ex)
        {
            throw new RuntimeException(ex);
        }
View Full Code Here

Examples of org.antlr.runtime.ANTLRInputStream

        }
    }

    public static DRLLexer buildLexer( final InputStream is, final String encoding, LanguageLevelOption languageLevel ) {
        try {
            return getDRLLexer(encoding != null ? new ANTLRInputStream(is, encoding) : new ANTLRInputStream(is), languageLevel);
        } catch ( final Exception e ) {
            throw new RuntimeException( "Unable to parser Reader", e );
        }
    }
View Full Code Here

Examples of org.antlr.runtime.ANTLRInputStream

        }
    }

    public static DRLParser buildParser( final InputStream is, final String encoding, LanguageLevelOption languageLevel ) {
        try {
            return buildParser(encoding != null ? new ANTLRInputStream(is, encoding) : new ANTLRInputStream(is), languageLevel);
        } catch ( final Exception e ) {
            throw new RuntimeException( "Unable to parser Reader", e );
        }
    }
View Full Code Here

Examples of org.antlr.runtime3_3_0.ANTLRInputStream

  public Generator(InputStream is)  {
    tp = new TokenProcessor(docType, tabSize, latexSpaceSize, numberLines);
   
    CharStream input;
    try {
      input = new ANTLRInputStream(is);
     
      DISPEL lexer = new DISPEL(input);
      Token token;
       
        while ((token = lexer.nextToken()).getType() !=
View Full Code Here

Examples of org.antlr.v4.runtime.ANTLRInputStream

    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

Examples of org.antlr.v4.runtime.ANTLRInputStream

  @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

Examples of org.antlr.v4.runtime.ANTLRInputStream

  void testInterp(LexerGrammar lg, Grammar g,
          String startRule, String input,
          String parseTree)
  {
    LexerInterpreter lexEngine = lg.createLexerInterpreter(new ANTLRInputStream(input));
    CommonTokenStream tokens = new CommonTokenStream(lexEngine);
    ParserInterpreter parser = g.createParserInterpreter(tokens);
    ParseTree t = parser.parse(g.rules.get(startRule).index);
    System.out.println("parse tree: "+t.toStringTree(parser));
    assertEquals(parseTree, t.toStringTree(parser));
View Full Code Here

Examples of org.antlr.v4.runtime.ANTLRInputStream

    ParserInterpreter parser = g.createParserInterpreter(null);
    parser.setProfile(true);
    for (String s : input) {
      lexEngine.reset();
      parser.reset();
      lexEngine.setInputStream(new ANTLRInputStream(s));
      CommonTokenStream tokens = new CommonTokenStream(lexEngine);
      parser.setInputStream(tokens);
      Rule r = g.rules.get(startRule);
      if ( r==null ) {
        return parser.getParseInfo().getDecisionInfo();
View Full Code Here

Examples of org.antlr.v4.runtime.ANTLRInputStream

    }
  }

  protected void process(Lexer lexer, Class<? extends Parser> parserClass, Parser parser, InputStream is, Reader r) throws IOException, IllegalAccessException, InvocationTargetException, PrintException {
    try {
      ANTLRInputStream input = new ANTLRInputStream(r);
      lexer.setInputStream(input);
      CommonTokenStream tokens = new CommonTokenStream(lexer);

      tokens.fill();
View Full Code Here

Examples of org.antlr.v4.runtime.ANTLRInputStream

    public CloneableANTLRFileStream(String fileName, String encoding) throws IOException {
      super(fileName, encoding);
    }

    public ANTLRInputStream createCopy() {
      ANTLRInputStream stream = new ANTLRInputStream(this.data, this.n);
      stream.name = this.getSourceName();
      return stream;
    }
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.