コード例 #1
0
        public void ParseSymExpressionTest()
        {
            //Create parser and parse tokens
            ExpressionParser expressionParser = new ExpressionParser(Init("'symbol"));
            SymExpression    expression       = expressionParser.ParseSymExpression();

            //Test variable identifier
            Assert.AreEqual("symbol", expression.GetSym());
        }
コード例 #2
0
        public void ParseCatExpressionTest()
        {
            //Create parser and parse tokens
            ExpressionParser expressionParser = new ExpressionParser(Init("expression+'symbol"));
            Expression       expression       = expressionParser.ParseExpression();

            //Check type of expression
            Assert.AreEqual(typeof(CatExpression), expression.GetType());
            CatExpression parsedCatExpression = (CatExpression)expression;

            //Check expressions in catexpression
            Assert.AreEqual(typeof(VarExpression), parsedCatExpression.GetLeftExpression().GetType());
            Assert.AreEqual(typeof(SymExpression), parsedCatExpression.GetRightExpression().GetType());

            VarExpression left  = (VarExpression)parsedCatExpression.GetLeftExpression();
            SymExpression right = (SymExpression)parsedCatExpression.GetRightExpression();

            Assert.AreEqual("expression", left.GetVariableIdentifier());
            Assert.AreEqual("symbol", right.GetSym());
        }
コード例 #3
0
ファイル: XHTMLVisitor.cs プロジェクト: tvdstorm/waebric
 /// <summary>
 /// Interpret SymExpression
 /// </summary>
 /// <param name="expression">SymExpression to interpret</param>
 public override void Visit(SymExpression expression)
 {
     TextValue = RewriteText(expression.GetSym());
 }