Beispiel #1
0
        internal PrefSQLModel GetPrefSqlModelFromPreferenceSql(string preferenceSql)
        {
            PrefSQLParser parser = new PrefSQLParser(new CommonTokenStream(new PrefSQLLexer(new AntlrInputStream(preferenceSql))));

            // An error listener helps to return detailed parser syntax errors
            ErrorListener listener = new ErrorListener();

            parser.AddErrorListener(listener);

            IParseTree tree = parser.parse();

            // PrefSQLModel is built during the visit of the parse tree
            SQLVisitor visitor = new SQLVisitor {
                IsNative = _skylineType.IsNative()
            };

            visitor.Visit(tree);
            PrefSQLModel prefSql = visitor.Model;

            if (prefSql != null)
            {
                prefSql.OriginalPreferenceSql = preferenceSql;
            }

            return(prefSql);
        }
Beispiel #2
0
        internal PrefSQLModel GetPrefSqlModelFromPreferenceSql(string preferenceSql)
        {
            PrefSQLParser parser = new PrefSQLParser(new CommonTokenStream(new PrefSQLLexer(new AntlrInputStream(preferenceSql))));

            // An error listener helps to return detailed parser syntax errors
            ErrorListener listener = new ErrorListener();
            parser.AddErrorListener(listener);

            IParseTree tree = parser.parse();

            // PrefSQLModel is built during the visit of the parse tree
            SQLVisitor visitor = new SQLVisitor {IsNative = _skylineType.IsNative()};
            visitor.Visit(tree);
            PrefSQLModel prefSql = visitor.Model;
            if (prefSql != null)
            {
                prefSql.OriginalPreferenceSql = preferenceSql;
            }

            return prefSql;
        }