Example #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;
        }
        public virtual bool visit(Text text)
        {
            var value = new TextValue(text.value);
            evaluation.Push(value);

            return true;
        }
Example #3
0
 public bool visit(Text text)
 {
     return true;
 }