Package org.antlr.runtime

Examples of org.antlr.runtime.ANTLRInputStream




  public static CommonTokenStream prepareParsing(InputStream is)
      throws IOException {
    ANTLRInputStream input = new ANTLRInputStream(is);
    COOLTreeBuilderLexer lexer = new COOLTreeBuilderLexer(input);
   
    CommonTokenStream tokenStream = new CommonTokenStream(lexer);
   
    return tokenStream;
View Full Code Here


import org.antlr.runtime.CommonTokenStream;
import org.antlr.runtime.RecognitionException;
public class Main {
  public static void main(String args[]){
    try {
      ANTLRInputStream input = new ANTLRInputStream(System.in);
      aromaLexer lexer = new aromaLexer(input);
      CommonTokenStream tokens = new CommonTokenStream (lexer);
      aromaParser parser = new aromaParser(tokens);
      Program p=parser.prog();
      p.print();
View Full Code Here

        NodeTestDSLParser parser = new NodeTestDSLParser( new CommonTokenStream( lexer ) );
        return parser;
    }

    private static NodeTestDSLParser getParser(final InputStream is) throws IOException {
        NodeTestDSLLexer lexer = new NodeTestDSLLexer( new ANTLRInputStream( is ) );
        NodeTestDSLParser parser = new NodeTestDSLParser( new CommonTokenStream( lexer ) );
        return parser;
    }
View Full Code Here

    abstract public void onInTree(Tree node, Tree colNode, Tree paramNode);
    abstract public void onScore(Tree node);

    // convenience method because everybody needs this piece of code
    static public CmisQueryWalker getWalker(String statement) throws UnsupportedEncodingException, IOException, RecognitionException {
        CharStream input = new ANTLRInputStream(new ByteArrayInputStream(statement.getBytes("UTF-8")));
        TokenSource lexer = new CmisQlStrictLexer(input);
        TokenStream tokens = new CommonTokenStream(lexer);
        CmisQlStrictParser parser = new CmisQlStrictParser(tokens);
        CommonTree parserTree; // the ANTLR tree after parsing phase
View Full Code Here

        NodeTestDSLParser parser = new NodeTestDSLParser( new CommonTokenStream( lexer ) );
        return parser;
    }

    private static NodeTestDSLParser getParser(final InputStream is) throws IOException {
        NodeTestDSLLexer lexer = new NodeTestDSLLexer( new ANTLRInputStream( is ) );
        NodeTestDSLParser parser = new NodeTestDSLParser( new CommonTokenStream( lexer ) );
        return parser;
    }
View Full Code Here

        String code = control.getSourceCode();
        try
        {
            //TODO fix depricated method
            InputStream iStream = new StringBufferInputStream(code);
            ANTLRInputStream input = new ANTLRInputStream(iStream);
            JavaBranchLexer lexer = new JavaBranchLexer(input);
            CommonTokenStream tokens = new CommonTokenStream(lexer);
            JavaBranchParser jParser = new JavaBranchParser(tokens, this);
            jParser.compilationUnit();
View Full Code Here

public class ExpressionTree {
    private final CommonTree tree;

    public ExpressionTree(String input) throws Exception {
        ANTLRInputStream fs = new ANTLRInputStream(new ByteArrayInputStream(
                input.getBytes()));
        MathsExprLexer lex = new MathsExprLexer(fs);
        TokenRewriteStream tokens = new TokenRewriteStream(lex);
        MathsExprParser grammar = new MathsExprParser(tokens);
        MathsExprParser.statement_return ret = grammar.statement();
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

        NodeTestDSLParser parser = new NodeTestDSLParser( new CommonTokenStream( lexer ) );
        return parser;
    }

    private static NodeTestDSLParser getParser(final InputStream is) throws IOException {
        NodeTestDSLLexer lexer = new NodeTestDSLLexer( new ANTLRInputStream( is ) );
        NodeTestDSLParser parser = new NodeTestDSLParser( new CommonTokenStream( lexer ) );
        return parser;
    }
View Full Code Here

   */
  public static FIS load(InputStream inputStream, boolean verbose) {
    // Parse file (lexer first, then parser)
    FclLexer lexer;
    try {
      lexer = new FclLexer(new ANTLRInputStream(inputStream));
    } catch(IOException e1) {
      System.err.println("Error reading inputStream'" + inputStream + "'");
      return null;
    }

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.