Package org.antlr.runtime

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


        }
    }

    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

    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

      System.exit(1);
    }
    try {
      // Set up lexer and parser to read the file passed on the command line
      FileInputStream fis = new FileInputStream(args[0]);
      ANTLRInputStream input = new ANTLRInputStream(fis);
      LCPLTreeBuilderLexer lexer = new LCPLTreeBuilderLexer(input);     
      CommonTokenStream tokenStream = new CommonTokenStream(lexer);
      LCPLTreeBuilderParser parser = new LCPLTreeBuilderParser(tokenStream);
      // Parse the file and generate a tree
      LCPLTreeBuilderParser.program_return retVal = parser.program();   
View Full Code Here

   * @param value
   * @return
   */
  private DateParser buildParser(String value) throws Exception {
    // lex
    ANTLRInputStream input = new ANTLRNoCaseInputStream(
        new ByteArrayInputStream(value.getBytes()));
    DateLexer lexer = new DateLexer(input);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
     
    // parse
View Full Code Here

   * @return
   */
  public List<DateGroup> parse(String value) {
   
    // lex the input value to obtain our global token stream
    ANTLRInputStream input = null;
    try {
      input = new ANTLRNoCaseInputStream(new ByteArrayInputStream(value.trim().getBytes()));
     
    } catch (IOException e) {
      _logger.log(Level.SEVERE, "could not lex input", e);
View Full Code Here

  }

  private RutaModule loadScriptIS(String scriptLocation, TypeSystemDescription localTSD)
          throws IOException, RecognitionException {
    InputStream scriptInputStream = getClass().getClassLoader().getResourceAsStream(scriptLocation);
    CharStream st = new ANTLRInputStream(scriptInputStream, scriptEncoding);
    RutaLexer lexer = new RutaLexer(st);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    RutaParser parser = new RutaParser(tokens);
    parser.setLocalTSD(localTSD);
    parser.setExternalFactory(factory);
View Full Code Here

        }
    }

    private DRLParser getParser( final InputStream is ) {
        try {
            lexer = new DRLLexer( new ANTLRInputStream( is ) );
            DRLParser parser = new DRLParser( new CommonTokenStream( lexer ) );
            return parser;
        } catch ( final Exception e ) {
            throw new RuntimeException( "Unable to parser Reader",
                                        e );
View Full Code Here

        }
    }

    private DRLParser getParser(final InputStream is) {
        try {
            lexer = new DRLLexer( new ANTLRInputStream( is ) );
            DRLParser parser = new DRLParser( new CommonTokenStream( lexer ) );
            parser.setTreeAdaptor( new DroolsTreeAdaptor() );
            return parser;
        } catch ( final Exception e ) {
            throw new RuntimeException( "Unable to parser Reader",
View Full Code Here

      try
      {
         if (is != null)
         {
            /** Lexing input stream */
            CNDLexer lex = new CNDLexer(new ANTLRInputStream(is));
            CommonTokenStream tokens = new CommonTokenStream(lex);
            /** Parsing input stream */
            CNDParser parser = new CNDParser(tokens);
            CNDParser.cnd_return r;
            /** Throw exception if any lex errors found */
 
View Full Code Here

TOP

Related Classes of org.antlr.runtime.ANTLRInputStream

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.