public void SimpleTest5() { string expr = ExpressionsForTest.Expr5; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List <Token <TokenType> > tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is OperatorNode); }
public void SimpleTest1() { string expr = ExpressionsForTest.Expr1; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List<Token<TokenType>> tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is MethodNode); MethodNode mNode = ast.Root as MethodNode; Assert.IsTrue(mNode.Variable is SimpleNode); }
public void SimpleTest11() { string expr = ExpressionsForTest.Expr11; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List<Token<TokenType>> tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is OperatorNode); OperatorNode opNode = ast.Root as OperatorNode; Assert.IsTrue(opNode.Lhs is UnaryNode); Assert.IsTrue(opNode.Rhs is SimpleNode); }
public void TernaryTest1() { string expr = "a?(b?c:d):e"; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List <Token <TokenType> > tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); TernaryNode tNode = ast.Root as TernaryNode; Assert.IsTrue(tNode.TrueValue is TernaryNode); }
public void SimpleTest1() { string expr = ExpressionsForTest.Expr1; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List <Token <TokenType> > tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is MethodNode); MethodNode mNode = ast.Root as MethodNode; Assert.IsTrue(mNode.Variable is SimpleNode); }
public void SimpleTest3() { string expr = ExpressionsForTest.Expr3; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List <Token <TokenType> > tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is IndexerNode); IndexerNode iNode = ast.Root as IndexerNode; Assert.IsTrue(iNode.Variable is SimpleNode); Assert.IsTrue((iNode.Args as ParamListNode).Values.Count == 1); }
public void SimpleTest13() { string expr = ExpressionsForTest.Expr13; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List <Token <TokenType> > tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is PropertyNode); PropertyNode pNode = ast.Root as PropertyNode; pNode = pNode.Variable as PropertyNode; Assert.IsTrue(pNode.Variable is IndexerNode); }
public void SimpleTest11() { string expr = ExpressionsForTest.Expr11; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List <Token <TokenType> > tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is OperatorNode); OperatorNode opNode = ast.Root as OperatorNode; Assert.IsTrue(opNode.Lhs is UnaryNode); Assert.IsTrue(opNode.Rhs is SimpleNode); }
public void SimpleTest6() { string expr = ExpressionsForTest.Expr6; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List <Token <TokenType> > tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is MethodNode); MethodNode mNode = ast.Root as MethodNode; ParamListNode plNode = mNode.Args as ParamListNode; Assert.IsTrue(plNode.Values.Count == 2); }
public void SimpleTest8() { string expr = ExpressionsForTest.Expr8; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List <Token <TokenType> > tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is TernaryNode); TernaryNode tNode = ast.Root as TernaryNode; Assert.IsTrue(tNode.Condition is OperatorNode); Assert.IsTrue(tNode.TrueValue is IndexerNode); Assert.IsTrue(tNode.FalseValue is SimpleNode); }
public void SimpleTest13() { string expr = ExpressionsForTest.Expr13; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List<Token<TokenType>> tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is PropertyNode); PropertyNode pNode = ast.Root as PropertyNode; pNode = pNode.Variable as PropertyNode; Assert.IsTrue(pNode.Variable is IndexerNode); }
public void TernaryTest1() { string expr = "a?(b?c:d):e"; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List<Token<TokenType>> tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); TernaryNode tNode = ast.Root as TernaryNode; Assert.IsTrue(tNode.TrueValue is TernaryNode); }
public void SimpleTest8() { string expr = ExpressionsForTest.Expr8; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List<Token<TokenType>> tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is TernaryNode); TernaryNode tNode = ast.Root as TernaryNode; Assert.IsTrue(tNode.Condition is OperatorNode); Assert.IsTrue(tNode.TrueValue is IndexerNode); Assert.IsTrue(tNode.FalseValue is SimpleNode); }
public void SimpleTest6() { string expr = ExpressionsForTest.Expr6; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List<Token<TokenType>> tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is MethodNode); MethodNode mNode = ast.Root as MethodNode; ParamListNode plNode = mNode.Args as ParamListNode; Assert.IsTrue(plNode.Values.Count == 2); }
public void SimpleTest5() { string expr = ExpressionsForTest.Expr5; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List<Token<TokenType>> tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is OperatorNode); }
public void SimpleTest3() { string expr = ExpressionsForTest.Expr3; LexicalParser lp = new LexicalParser(); lp.SetParseContent(expr); List<Token<TokenType>> tokens = lp.Parse(); SymanticParser sp = new SymanticParser(); sp.SetParseContent(tokens); ExpressionLanguageAST ast = sp.Parse(); Assert.IsTrue(ast.Root is IndexerNode); IndexerNode iNode = ast.Root as IndexerNode; Assert.IsTrue(iNode.Variable is SimpleNode); Assert.IsTrue((iNode.Args as ParamListNode).Values.Count == 1); }