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(Bool boolean) { var value = new BooleanValue(boolean.value); evaluation.Push(value); return true; }
public bool visit(Bool boolean) { return true; }