protected override ResultOfProcess ProcessToken(Lexer.Token token) { if (IsTerminateCondition(token)) { this.Context.Recovery(token); return ResultOfProcess.Stop; } this.Context.Recovery(token); var tmpOperatorLeaf = new OperatorLeaf(this.Context, this); var tmpRez = tmpOperatorLeaf.Run(); mRootNode = tmpOperatorLeaf.RootNode; return tmpRez; }
public void AddAdditionalItem(OpNode item) { AdditionalItems.Add(item); }
private void UpInLowPriority(StillOneScriptCore.Parser.Lexer.Token token) { var tmpTargetNode = mCurrNode; var tmpNextNode = tmpTargetNode.Parent; while (true) { if (tmpNextNode.Priority < TokenPriority(token.TokenType)) { if (tmpNextNode.Parent == null) { break; } if (tmpNextNode.TokenType == StillOneScriptCore.Parser.Lexer.TokenKind.ROUND_GROUP) { break; } if (tmpNextNode.TokenType == StillOneScriptCore.Parser.Lexer.TokenKind.FUNCTION_ARGUMENTS) { break; } tmpTargetNode = tmpNextNode; tmpNextNode = tmpTargetNode.Parent; } else { break; } } var tmpCurrNodeParent = tmpTargetNode.Parent; var tmpCurrNodeLeft = tmpTargetNode; mCurrNode = new OpNode(); mCurrNode.Parent = tmpCurrNodeParent; tmpCurrNodeParent.Right = mCurrNode; mCurrNode.Left = tmpCurrNodeLeft; tmpCurrNodeLeft.Parent = mCurrNode; }
private void ChangeNodes(StillOneScriptCore.Parser.Lexer.Token token) { if (mCurrNode == null) { mCurrNode = new OpNode(); mRootNode = mCurrNode; } else { if (mRootNode.Priority < TokenPriority(token.TokenType)) { var tmpOldRootNode = mRootNode; mCurrNode = new OpNode(); mRootNode = mCurrNode; mRootNode.Left = tmpOldRootNode; tmpOldRootNode.Parent = mRootNode; } else { if (mCurrNode.Priority < TokenPriority(token.TokenType)) { UpInLowPriority(token); } else { if (mCurrNode.Priority > TokenPriority(token.TokenType)) { var tmpOldCurrNode = mCurrNode; mCurrNode = new OpNode(); tmpOldCurrNode.Right = mCurrNode; mCurrNode.Parent = tmpOldCurrNode; } } } } }