Exemplo n.º 1
0
        public void TestDisplayAST()
        {
            string expression = "A -> [10] B until C -> D";

            Log.Debug(".testDisplayAST parsing: " + expression);
            Pair <ITree, CommonTokenStream> ast = Parse(expression);

            SupportParserHelper.DisplayAST(ast.First);
        }
Exemplo n.º 2
0
        private void AssertIsValid(string text)
        {
            Log.Debug(".assertIsValid Trying text=" + text);
            var ast = Parse(text);

            Log.Debug(".assertIsValid success, tree walking...");

            SupportParserHelper.DisplayAST(ast.First);
            Log.Debug(".assertIsValid done");
        }
Exemplo n.º 3
0
        public void TestParserNodeGeneration()
        {
            string expression = "a(m=1) -> not b() or every c() and d() where a:b (5) and timer:interval(10)";

            Log.Debug(".testParserNodeGeneration parsing: " + expression);
            Pair <ITree, CommonTokenStream> parsed = Parse(expression);
            ITree ast = parsed.First;

            SupportParserHelper.DisplayAST(ast);
        }
Exemplo n.º 4
0
        private void AssertEquivalent(
            string expressionOne,
            string expressionTwo)
        {
            EPLTreeWalkerListener l1 = SupportParserHelper.ParseAndWalkEPL(container, "select * from pattern[" + expressionOne + "]");
            EPLTreeWalkerListener l2 = SupportParserHelper.ParseAndWalkEPL(container, "select * from pattern[" + expressionTwo + "]");

            string t1 = ToPatternText(l1);
            string t2 = ToPatternText(l2);

            Assert.AreEqual(t1, t2);
        }
Exemplo n.º 5
0
        public static EPLTreeWalkerListener ParseAndWalkEPL(
            IContainer container,
            string expression)
        {
            Log.Debug(".parseAndWalk Trying text=" + expression);
            var ast = ParseEPL(expression);

            Log.Debug(".parseAndWalk success, tree walking...");
            SupportParserHelper.DisplayAST(ast.First);
            var listener = SupportEPLTreeWalkerFactory.MakeWalker(ast.Second, SupportClasspathImport.GetInstance(container));
            var walker   = new ParseTreeWalker();           // create standard walker

            walker.Walk(listener, (IParseTree)ast.First);   // initiate walk of tree with listener
            return(listener);
        }
Exemplo n.º 6
0
        public void TestDisplayAST()
        {
            var expression = "select * from A where exp > ANY (select a from B)";

            Log.Debug(".testDisplayAST parsing: " + expression);
            var ast = Parse(expression);

            SupportParserHelper.DisplayAST(ast.First);

            Log.Debug(".testDisplayAST walking...");
            var listener = SupportEPLTreeWalkerFactory.MakeWalker(container, ast.Second);

            var walker = new ParseTreeWalker();             // create standard walker

            walker.Walk(listener, (IParseTree)ast.First);   // initiate walk of tree with listener
        }
Exemplo n.º 7
0
 private Pair <ITree, CommonTokenStream> ParseJson(string expression)
 {
     return(SupportParserHelper.ParseJson(expression));
 }
Exemplo n.º 8
0
 private Pair <ITree, CommonTokenStream> Parse(string expression)
 {
     return(SupportParserHelper.ParseEPL("select * from pattern[" + expression + "]"));
 }