private SectionImport ParseImport() { SectionImport ast = new SectionImport(); ast.KeyToken = tape.Current; tape.MoveNext(); tape.Match(TokenKind.Colon); ast.Packages = ParsePackageList(); return(ast); }
private SectionBase ParseSection() { string headText = tape.Current.GetText(); if (headText.StartsWith("导入")) { SectionImport section = ParseImport(); return(section); } else if (headText.StartsWith("使用")) { SectionUse section = ParseUse(); return(section); } else if (headText.StartsWith("约定")) { SectionEnum section = ParseEnum(); return(section); } else if (headText.StartsWith("声明")) { SectionDim section = ParseDim(); return(section); } else if (headText.EndsWith("类型")) { SectionClassName section = ParseClass(); return(section); } else if (headText.EndsWith("属性")) { SectionProperties section = ParseProperties(); return(section); } else { SectionProc section = ParseProc(); if (section.NamePart.IsConstructor()) { SectionConstructor constructor = new SectionConstructor(section); return(constructor); } else { return(section); } //tape.error("错误的段落"); //tape.MoveNext(); //return null; } }