private Exp ParseDe() { ExpDe deexp = new ExpDe(this.ExpContext); deexp.KeyToken = (LexTokenText)Tape.Current; deexp.SubjectExp = PopChainsExp(); MoveNext(); if (Tape.Current is LexTokenText) { LexTokenText tok = (LexTokenText)(Tape.Current); if (tok.Kind == TokenKindKeyword.Ident || tok.Kind == TokenKindKeyword.Each) { deexp.RightToken = tok; MoveNext(); } } //deexp.SetContextExp(this.expContext); return(deexp); }
Exp parseChain() { //report("parseChain"); Exp leftExp = parseTerm(); if (leftExp == null) { return(null); } while (tape.Current.Kind != TokenKind.EOF) { if (tape.Current.Kind == TokenKind.DE) { ExpDe deExp = new ExpDe(); deExp.KeyToken = tape.Current; deExp.LeftExp = leftExp; tape.MoveNext(); Exp rightExp = parseTerm(); deExp.RightExp = rightExp; leftExp = deExp; } else if (tape.Current.Kind == TokenKind.DI) { ExpDi diExp = new ExpDi(); diExp.KeyToken = tape.Current; diExp.SubjectExp = leftExp; tape.MoveNext(); Exp rightExp = parseTerm(); diExp.ArgExp = rightExp; leftExp = diExp; } else { return(leftExp); } } return(leftExp); }