private SectionImportRaw ParseImport() { SectionImportRaw ast = new SectionImportRaw(); ast.KeyToken = (LexTokenText)tape.Current.FirstToken; List <SectionImportRaw.PackageRaw> packages = new List <SectionImportRaw.PackageRaw>(); /*分析'导入包:'后面的包名称 */ List <LexToken> packagesTokens; // = new List<LexToken>(); packagesTokens = tape.Current.GetSubs(2); // new List<LexToken>(); ParseImportPackages(packages, packagesTokens); tape.MoveNext(); while (tape.HasCurrent) { if (IsSectionHead(tape.Current)) { break; } packagesTokens = tape.Current.ToList(); ParseImportPackages(packages, packagesTokens); tape.MoveNext(); } ast.Packages = packages; return(ast); }
private SectionRaw ParseSection() { string headText = tape.Current.FirstToken.Text; bool secondIsColon = tape.Current.SecondToken.IsKind(TokenKindSymbol.Colon); if (false) { //<<重新编写分析,同行换行都可以>> } else if (secondIsColon && headText == "导入包") { SectionImportRaw section = ParseImport(); return(section); } else if (secondIsColon && headText == "导入类") { SectionUseRaw section = ParseUse(); return(section); } //else if (secondIsColon && headText == "约定") //{ // SectionEnum section = ParseEnum(); // return section; //} else if (secondIsColon && headText == "名称") { SectionNameRaw section = ParseClassName(); return(section); } else if (secondIsColon && headText == "属于") { SectionExtendsRaw section = ParseExtends(); return(section); } //else if (secondIsColon && headText == "声明" ) //{ // SectionDim section = ParseDim(); // return section; //} else if (secondIsColon && headText == "属性") { SectionPropertiesRaw section = ParseProperties(); return(section); } else { SectionProcRaw section = ParseProc(); return(section); } }
public SectionImport(FileAST fileAST, SectionImportRaw sectionImportRaw) { ASTFile = fileAST; Raw = sectionImportRaw; }