//private bool IsImportPackageNamePart(LexToken token) //{ // return token.IsKind(TokenKindKeyword.Ident) // || token.IsKind(TokenKindSymbol.DIV) // || token.IsKind(TokenKindSymbol.Comma); //} private SectionImportRaw.PackageRaw ParsePackageName(TokenTape tape) { SectionImportRaw.PackageRaw pname = new SectionImportRaw.PackageRaw(); if (tape.HasCurrent) { if (tape.Current.IsKind(TokenKindKeyword.Ident)) { pname.Parts.Add((LexTokenText)tape.Current); tape.MoveNext(); if (tape.HasCurrent) { if (tape.Current.IsKind(TokenKindSymbol.DIV)) { ParsePackageNameBackPart(tape, pname); } } } else { tape.error(string.Format("'{0}'不是正确的开发包名称", tape.Current.Text)); return(null); } } else { tape.error(string.Format("'{0}'没有开发包名称", tape.Current.Text)); return(null); } return(pname); }
public Exp Parse(List <LexToken> tokens, ContextExp expContext) { this.expContext = expContext; tape = new TokenTape(tokens, expContext.FileContext); Exp exp = ParseAssign(); //exp.SetContextExp(expContext,false); return(exp); }
public List <SectionImportRaw.PackageRaw> Parse(IEnumerable <LexToken> tokens, ContextFile fileContext) { this.fileContext = fileContext; List <LexToken> tokens2 = new List <LexToken>(tokens); tape = new TokenTape(tokens2.ToArray(), fileContext); List <SectionImportRaw.PackageRaw> asts = ParsePackageList(); return(asts); }
private bool BuildCurrentLineTape() { if (tape.HasCurrent) { var currLineTokens = SegToken(tape.Current.ToList()); currLineTokenTape = new TokenTape(currLineTokens, this.context.ClassContext.FileContext); return(true); } return(false); }
public List <PropertyASTRaw> Parse(IEnumerable <LexToken> tokens, ContextFile fileContext) { this.fileContext = fileContext; List <LexToken> tokens2 = new List <LexToken>(tokens); tape = new TokenTape(tokens2, fileContext); List <PropertyASTRaw> asts = ParseDimList(); return(asts); }
public SectionProcRaw Parse(IEnumerable <LexToken> tokens, ContextFile fileContext, SectionProcRaw procAST) { this.fileContext = fileContext; this.ast = procAST; List <LexToken> tokens2 = new List <LexToken>(tokens); tape = new TokenTape(tokens2.ToArray(), fileContext); ast.NamePart = ParseProcName(); tape.Match(TokenKindSymbol.Colon); ast.RetToken = ParseRetProc(); return(ast); }
private void ParsePackageNameBackPart(TokenTape tape, SectionImportRaw.PackageRaw pname) { while (tape.HasCurrent && tape.Current.IsKind(TokenKindSymbol.DIV)) { tape.MoveNext(); if (tape.Current.IsKind(TokenKindKeyword.Ident)) { pname.Parts.Add((LexTokenText)tape.Current); tape.MoveNext(); } else { tape.error(string.Format("'{0}'没有开发包名称", tape.Current.Text)); } } }