private SectionPropertiesRaw ParseProperties() { SectionPropertiesRaw ast = new SectionPropertiesRaw(); List <PropertyASTRaw> list = new List <PropertyASTRaw>(); LexToken headFistToken = tape.Current.FirstToken; ast.KeyToken = (LexTokenText)headFistToken; List <LexToken> sourceTokens = tape.Current.GetSubs(2); ParsePropertyBody(list, sourceTokens); tape.MoveNext(); while (tape.HasCurrent) { //SkipSpaceLine(); if (IsSectionHead(tape.Current)) { break; } sourceTokens = tape.Current.ToList(); ParsePropertyBody(list, sourceTokens); tape.MoveNext(); } ast.Properties.AddRange(list); return(ast); }
public SectionPropertiesClass(ClassAST classAST, SectionPropertiesRaw raw) { ASTClass = classAST; Raw = raw; PropertiesContext = new ContextMethod(ASTClass.ClassContext); for (int i = 0; i < Raw.Properties.Count; i++) { PropertyASTRaw item = Raw.Properties[i]; ClassPropertyAST p = new ClassPropertyAST(this, item); Propertys.Add(p); } }
public SectionPropertiesDim(DimAST dimAST, SectionPropertiesRaw raw) { this.dimAST = dimAST; Raw = raw; for (int i = 0; i < Raw.Properties.Count; i++) { PropertyASTRaw propertyRaw = Raw.Properties[i]; PropertyAST propertyAST = new PropertyAST(propertyRaw, this); PropertyASTList.Add(propertyAST); } }
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 ClassAST(FileAST astFile, SectionNameRaw nameSection, SectionExtendsRaw extendsSection , SectionPropertiesRaw propertiesSection) : base(astFile) { this.ClassContext = new ContextClass(this.FileContext); ClassNameSection = new SectionClassName(nameSection); Constructors = new List <ProcConstructorBase>(); Methods = new List <ProcMethod>(); Extends = new SectionExtendsClass(this, extendsSection); if (propertiesSection != null) { Properties = new SectionPropertiesClass(this, propertiesSection); } }
public DimAST(FileAST astFile, SectionNameRaw nameSection, SectionExtendsRaw extendsSection, SectionPropertiesRaw propertiesSection) : base(astFile)//, nameSection) { DimNameSection = new SectionDimName(nameSection); Extends = new SectionExtendsDim(extendsSection); Properties = new SectionPropertiesDim(this, propertiesSection); }
public SectionPropertiesEnum(EnumAST astEnum, SectionPropertiesRaw raw) { ASTEnum = astEnum; Raw = raw; }