예제 #1
0
        public static Primitive produce(Queue<Token> tokens)
        {
            Token token = tokens.First();
            string content = token.content;

            Primitive primitive = null;
            if (token.tokenType == TokenType.BOOLEAN)
            {
                tokens.Dequeue();
                content = content.ToLower();
                primitive = new Bool(token, content == "true");
            }
            else if (token.tokenType == TokenType.TEXT)
            {
                tokens.Dequeue();
                primitive = new Text(token, content);
            }
            else if( token.tokenType == TokenType.NUMBER)
            {
                tokens.Dequeue();
                primitive = new Number(token, Convert.ToDouble(content));
            }
            return primitive;
        }
예제 #2
0
 public virtual bool visit(Bool boolean)
 {
     var value = new BooleanValue(boolean.value);
     evaluation.Push(value);
     return true;
 }
예제 #3
0
 public bool visit(Bool boolean)
 {
     return true;
 }