public SymPreProcessorWorkerElseIf(SymParserWorkerContext aContext) : base(aContext) { // When the else token is reached, we must work back up the tree // looking for the previous (i.e. most recent) conditional expression // node. SymNodeConditionalExpression condExpNode = SymParserWorkerConditionalExpression.FindMostRecentConditionalExpression(aContext.Document.CurrentNode); if (condExpNode == null) { throw new Exception("Unable to locate most recent condition expression during ELSE IF handling"); } // There must always be a positive condition node and some kind of condition if (condExpNode.ChildTypeExists(typeof(SymNodeCondition)) == false) { throw new Exception("No child condition node found during ELSE IF handling"); } // Make the conditional expression the current node aContext.Document.CurrentNode = condExpNode; // Make a new condition worker. The condition worker creates a new condition node // which becomes the new current node. SymParserWorkerContext context = new SymParserWorkerContext(aContext.Document.Context, this); SymParserWorkerCondition conditionWorker = new SymParserWorkerCondition(context, new SymNodePreProcessorCondition(aContext.CurrentToken.Value)); AddChild(conditionWorker); }
public SymPreProcessorWorkerIfndef(SymParserWorkerContext aContext) : base(aContext) { // The base class will make a new conditional expression node at the current document position. // It will change the parent node to be this new node. We must make a new condition worker // that will handle reading the condition arguments. SymParserWorkerContext context = new SymParserWorkerContext(WorkerContext.Document.Context, this); SymParserWorkerCondition conditionWorker = new SymParserWorkerCondition(context, new SymNodePreProcessorCondition(aContext.CurrentToken.Value)); AddChild(conditionWorker); }