public IList<IAstNode> Parse(IList<IInputElement> inputElements, string source) { DataSource = new InputElementDataSource(inputElements); var nodes = new List<IAstNode>(); while (!Eof) { if (CurrentInputElement.InputElementType == InputElementTypeEnum.Token && ((IToken)CurrentInputElement).TokenType == TokenTypeEnum.Keyword && CurrentInputElement.Data == Keywords.Import) { ResetBuffer(); nodes.Add(ParserHelper.Parse<ImportDeclarationParser>(DataSource)); continue; } if (CurrentInputElement.InputElementType == InputElementTypeEnum.Token && ((IToken)CurrentInputElement).TokenType == TokenTypeEnum.Keyword && CurrentInputElement.Data == Keywords.Package) { ResetBuffer(); nodes.Add(ParserHelper.Parse<PackageDeclarationParser>(DataSource)); continue; } if (CurrentInputElement.InputElementType == InputElementTypeEnum.Token && ((IToken)CurrentInputElement).TokenType == TokenTypeEnum.Keyword && CurrentInputElement.Data == Keywords.Class) { ResetBuffer(); nodes.Add(ParserHelper.Parse<ClassTypeParser>(DataSource)); continue; } Utils.Log(string.Format("Adding to buffer. Line {0}. Column {1}. Data: {2}", CurrentInputElement.Line, CurrentInputElement.Column, CurrentInputElement.Data), ConsoleColor.DarkGray); BufferSize++; MoveToNextInputElement(); } return nodes; }
public IAstNode Parse(InputElementDataSource inputElementDataSource) { DataSource = inputElementDataSource; return ImplementationSpecificParse(); }