Beispiel #1
0
        public DeclarationList parseEString(String code)
        {
            context = Context.newGlobalsContext();
            ECleverParser parser = new ECleverParser(code);

            parser.ErrorHandler = new FatalErrorStrategy();
            return(parser.parse_declaration_list());
        }
Beispiel #2
0
        public DeclarationList parseEResource(String resourceName)
        {
            context = Context.newGlobalsContext();
            Stream input = OpenResource(resourceName);

            try {
                ECleverParser parser = new ECleverParser(input);
                return(parser.parse_declaration_list());
            } finally {
                input.Close();
            }
        }
Beispiel #3
0
        JavaStatement parse_java_statement(String code)
        {
            ECleverParser   parser = new ECleverParser(code);
            ITokenStream    stream = (ITokenStream)parser.InputStream;
            EIndentingLexer lexer  = (EIndentingLexer)stream.TokenSource;

            lexer.AddLF = false;
            IParseTree      tree    = parser.java_statement();
            EPromptoBuilder builder = new EPromptoBuilder(parser);
            ParseTreeWalker walker  = new ParseTreeWalker();

            walker.Walk(builder, tree);
            return(builder.GetNodeValue <JavaStatement>(tree));
        }