private ITree GetAntlrComputedExpressionTree()
        {
            ICharStream       input  = new ANTLRStringStream(sourceText);
            JavascriptLexer   lexer  = new JavascriptLexer(input);
            CommonTokenStream tokens = new CommonTokenStream(lexer);
            JavascriptParser  parser = new JavascriptParser(tokens);

            try
            {
                return(parser.Expression().Tree);
            }
            catch (RecognitionException re)
            {
                throw new ArgumentException(re.Message, re);
            }
        }
Beispiel #2
0
        private ITree GetAntlrComputedExpressionTree()
        {
            ICharStream       input  = new ANTLRStringStream(sourceText);
            JavascriptLexer   lexer  = new JavascriptLexer(input);
            CommonTokenStream tokens = new CommonTokenStream(lexer);
            JavascriptParser  parser = new JavascriptParser(tokens);

            try
            {
                return(parser.Expression().Tree);
            }
            catch (RecognitionException re)
            {
                throw new ArgumentException(re.Message, re);
            }
            // LUCENENET: Antlr 3.5.1 doesn't ever wrap ParseException, so the other catch block
            // for RuntimeException that wraps ParseException would have
            // been completely unnecesary in Java and is also unnecessary here.
        }
 private ITree GetAntlrComputedExpressionTree()
 {
     ICharStream input = new ANTLRStringStream(sourceText);
     JavascriptLexer lexer = new JavascriptLexer(input);
     CommonTokenStream tokens = new CommonTokenStream(lexer);
     JavascriptParser parser = new JavascriptParser(tokens);
     try
     {
         return parser.Expression().Tree;
     }
     catch (RecognitionException re)
     {
         throw new ArgumentException(re.Message, re);
     }
 }