public static BaseTree Parse(List <IElement> sourceTokens, ScriptFile sf, ScriptInfo scriptInfo) { BaseTree tree = new BaseTree(sourceTokens); tree._sf = sf; MoveInfo parser = new MoveInfo(tree, SearchTree.ChildrenBlock, 0, sf); ParsingInfo parsingInfo = new ParsingInfo(sf); // parse all groups MoveInfo groupInfo = new MoveInfo(tree, SearchTree.ContentTree, 0, sf); IElement cur = groupInfo.Find(SearchDirection.LeftToRight, SearchVisibility.Visible); while (cur != null) { Group.Check(groupInfo, parsingInfo, scriptInfo); cur = groupInfo.FindNextBlack(SearchDirection.LeftToRight); } // parse delegate call [[delegate]] MoveInfo delegateInfo = new MoveInfo(tree, SearchTree.ContentTree, 0, sf); cur = delegateInfo.Find(SearchDirection.LeftToRight, SearchVisibility.Visible); while (cur != null) { DelegateCallGroup.Check(delegateInfo, parsingInfo, scriptInfo); cur = delegateInfo.FindNextBlack(SearchDirection.LeftToRight); } // create parse tree MoveInfo contentInfo = new MoveInfo(parser); cur = contentInfo.Current; while (cur != null) { if (!cur.Visible) { XMLBlock.Check(contentInfo, parsingInfo, scriptInfo); cur = contentInfo.Move(SearchDirection.LeftToRight); } else { if (DevCode.Check(contentInfo, parsingInfo, scriptInfo) || PreProcessorInclude.Check(contentInfo, parsingInfo, scriptInfo) || PreProcessorRegion.Check(contentInfo, parsingInfo, scriptInfo) || AccessModifier.Check(contentInfo, parsingInfo, scriptInfo) || SealedModifier.Check(contentInfo, parsingInfo, scriptInfo) || UsingDef.Check(contentInfo, parsingInfo, scriptInfo) || OverwriteConstDef.Check(contentInfo, parsingInfo, scriptInfo) || FuncDef.Check(contentInfo, parsingInfo, scriptInfo) || ConstDef.Check(contentInfo, parsingInfo, scriptInfo) ) { cur = contentInfo.Move(SearchDirection.LeftToRight); } else { throw new SyntaxException("Unknown token", contentInfo.GetErrorInfo()); } } } tree.IncludeDefList = parsingInfo.IncludeDefList; tree.FuncDefList = parsingInfo.FuncDefList; tree.ConstDefList = parsingInfo.ConstDefList; tree.UsingDefList = parsingInfo.UsingDefList; tree.OverwriteConstDefList = parsingInfo.OverwriteConstDefList; return(tree); }