Package org.antlr.runtime

Examples of org.antlr.runtime.ANTLRInputStream


        PushbackInputStream stream = new PushbackInputStream(contentStream, BOM_MAX_LENGTH);
        Charset encoding = getEncoding(stream);
        if (encoding != null)
        {
            HaxeLexer lexer =
                    new HaxeLexer(new ANTLRInputStream(contentStream, encoding.toString()));
            return parseFileContents(lexer);          
        }
        HaxeLexer lexer = new HaxeLexer(new ANTLRInputStream(stream));
        return parseFileContents(lexer);
    }
View Full Code Here


    assertEquals(0, parser.getNumberOfSyntaxErrors());
    return (HaxeTree) parserResult.getTree();
  }

  public static HaxeParser createHaxeParser(final InputStream input) throws RecognitionException {
    ANTLRInputStream charStream = null;
    try {
      charStream = new ANTLRInputStream(input);
    } catch (IOException e) {
      e.printStackTrace();
      Assert.fail("Exception on reading input");
    }   
    HaxeLexer lexer = new HaxeLexer(charStream);
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

    private CmisQueryWalker walker;
   
    // convenience method because everybody needs this piece of code
    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

            try
            {
                input = SWCReader.getInputStream(zipFile, cssFileName);
                if (input != null)
                {
                    final ANTLRInputStream in = new ANTLRInputStream(input);
                    in.name = String.format("%s:%s", swc.getSWCFile().getName(), cssFileName);
                    final List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
                    result = CSSDocument.parse(in, problems);
                    if (!problems.isEmpty())
                        throw new ProblemParsingCSSRuntimeException(problems);
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

    protected void tearDown() throws Exception {
    }

    protected 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);

        query_return parsedStatement = parser.query();
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

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

    // convenience method because everybody needs this piece of code
    public static 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

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

    // 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

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.