예제 #1
0
        public void TestGetPropertyNameEscaped()
        {
            String PROPERTY = "a\\.b\\.c";
            Pair <ITree, CommonTokenStream> parsed = SupportParserHelper.ParseEventProperty(PROPERTY);
            ITree propertyNameExprNode             = parsed.First.GetChild(0);

            ASTUtil.DumpAST(propertyNameExprNode);
            String propertyName = ((IRuleNode)propertyNameExprNode).GetText();

            Assert.AreEqual(PROPERTY, propertyName);
        }
예제 #2
0
        public void TestGetPropertyName()
        {
            String PROPERTY = "a('aa').b[1].c";

            // Should parse and result in the exact same property name
            Pair <ITree, CommonTokenStream> parsed = SupportParserHelper.ParseEventProperty(PROPERTY);
            ITree propertyNameExprNode             = parsed.First.GetChild(0);

            ASTUtil.DumpAST(propertyNameExprNode);
            String propertyName = ((IRuleNode)propertyNameExprNode).GetText();

            Assert.AreEqual(PROPERTY, propertyName);

            // Try AST with tokens separated, same property name
            parsed = SupportParserHelper.ParseEventProperty("a(    'aa'   ). b [ 1 ] . c");
            propertyNameExprNode = parsed.First.GetChild(0);
            propertyName         = ((IRuleNode)propertyNameExprNode).GetText();
            Assert.AreEqual(PROPERTY, propertyName);
        }