예제 #1
0
        internal static ImpalaParserInternal CreateParserInternal(string input, ImpalaDialect dialect)
        {
            var stream = new StringInputStream(input);
            var lexer  = new ImpalaLexerInternal(stream);
            var tokens = new CommonTokenStream(lexer);
            var parser = new ImpalaParserInternal(tokens);

            lexer.Dialect = dialect;

            return(parser);
        }
예제 #2
0
        // Übergebenen Sourcecode übersetzen.
        public bool Compile(string source, bool optionExplicit = true, bool allowExternal = true)
        {
            ErrorObject = new InterpreterError();


            StringInputStream sourceStream = new StringInputStream();
            // den Inputstream syntaktisch prüfen und Code erzeugen
            var parser = new SyntaxAnalyser(ErrorObject);


            code = new Collection <object>();

            parser.Parse(sourceStream.Connect(source), this, optionExplicit, allowExternal);

            if (ErrorObject.Number == 0)
            {
                return(true);
            }

            return(false);
        }