Beispiel #1
0
        private TypeNode ValueType()
        {
            TypeNode           itsAST;
            SourceCodePosition itsPos = _currentToken.SourcePosition;

            if (_currentToken.Type == Token.TokenType.Int)
            {
                itsAST = new IntTypeNode(itsPos);
                Accept(Token.TokenType.Int);
            }
            else if (_currentToken.Type == Token.TokenType.Real)
            {
                itsAST = new RealTypeNode(itsPos);
                Accept(Token.TokenType.Real);
            }
            else if (_currentToken.Type == Token.TokenType.String)
            {
                itsAST = new StringTypeNode(itsPos);
                Accept(Token.TokenType.String);
            }
            else
            {
                itsAST = new BooleanTypeNode(itsPos);
                Accept(Token.TokenType.Boolean);
            }
            return(itsAST);
        }
        public SumExpressionNode(ExpressionNode leftExpression,
                                 ExpressionNode multExpression, Token token) : base(leftExpression, multExpression, token)
        {
            var s = new StringTypeNode();

            rules[Utils.Char + "," + Utils.String]   = s;
            rules[Utils.String + "," + Utils.Char]   = s;
            rules[Utils.String + "," + Utils.String] = s;
            rules[Utils.String + "," + Utils.Int]    = s;
            rules[Utils.Int + "," + Utils.String]    = s;
            rules[Utils.String + "," + Utils.Float]  = s;
            rules[Utils.Float + "," + Utils.String]  = s;
        }
Beispiel #3
0
 public object Visit(StringTypeNode n, object o)
 {
     return(null);
 }
Beispiel #4
0
 public object Visit(StringTypeNode n, object o)
 {
     Append("string");
     return(null);
 }