public override DoubleLinkedList Compile(ref LinkedListNode<Token> currentToken) { Token leftHandValue = currentToken.Previous.Value; Token rightHandValue = currentToken.Next.Value; Token operatorCharacter = currentToken.Value; AddNodesForToken (ref leftHandValue); AddNodesForToken (ref rightHandValue); FunctionCall operatorFunction; switch (operatorCharacter.Type) { case TokenEnumeration.Equals: operatorFunction = new FunctionCall ("Equals", new List<Token> (){ leftHandValue, rightHandValue }); break; case TokenEnumeration.GreaterThan: operatorFunction = new FunctionCall ("GreatherThan", new List<Token> (){ leftHandValue, rightHandValue }); break; case TokenEnumeration.GreaterOrEquals: operatorFunction = new FunctionCall ("GreatherThanOrEqualTo", new List<Token> (){ leftHandValue, rightHandValue }); break; case TokenEnumeration.LesserThan: operatorFunction = new FunctionCall ("LesserThan", new List<Token> (){ leftHandValue, rightHandValue }); break; case TokenEnumeration.LesserOrEquals: operatorFunction = new FunctionCall ("LesserThanOrEqualTo", new List<Token> (){ leftHandValue, rightHandValue }); break; case TokenEnumeration.NotEquals: operatorFunction = new FunctionCall ("NotEquals", new List<Token> (){ leftHandValue, rightHandValue }); break; default: operatorFunction = null; break; } compiledStatement.AddLast (operatorFunction); currentToken = currentToken.Next; return compiledStatement; }
public void Visit(FunctionCall node) { NextNode = node.Next; }