protected Exp parseCompareExpr() { LexTokenSymbol opToken; Exp resultExpr = parseAddSub(); while (tape.HasCurrent && IsCompareOp(tape.Current)) { opToken = (LexTokenSymbol)(tape.Current); tape.MoveNext(); Exp rightExpr = parseAddSub(); resultExpr = new ExpBinary(expContext) { LeftExp = resultExpr, OpToken = opToken, RightExp = rightExpr }; } return(resultExpr); }
public Exp parseAddSub() { LexTokenSymbol opToken; Exp resultExpr = parseMulDiv(); while (tape.HasCurrent && tape.Current.IsKind(TokenKindSymbol.ADD, TokenKindSymbol.SUB)) { opToken = (LexTokenSymbol)(tape.Current); tape.MoveNext(); Exp rightExpr = parseAddSub(); resultExpr = new ExpBinary(expContext) { LeftExp = resultExpr, OpToken = opToken, RightExp = rightExpr }; } return(resultExpr); }
public Exp parseAddSub() { Token opToken; Exp resultExpr = parseMulDiv(); while (tape.CurrentKind == TokenKind.ADD || tape.CurrentKind == TokenKind.SUB) { opToken = tape.Current; tape.MoveNext(); Exp rightExpr = parseAddSub(); resultExpr = new ExpBinary() { LeftExp = resultExpr, OpToken = opToken, RightExp = rightExpr }; } return(resultExpr); }
private Exp parseBinaryLogicExp() { Token opToken; Exp resultExpr = parseCompareExpr(); while (tape.CurrentKind == TokenKind.AND || tape.CurrentKind == TokenKind.OR) { opToken = tape.Current; tape.MoveNext(); Exp rightExpr = parseCompareExpr(); resultExpr = new ExpBinary() { LeftExp = resultExpr, OpToken = opToken, RightExp = rightExpr }; } return(resultExpr); }
Exp parseMulDiv() { //report("parseMulDiv"); LexTokenSymbol opToken; Exp resultExpr = ParseChain(); while (tape.HasCurrent && tape.Current.IsKind(TokenKindSymbol.MUL, TokenKindSymbol.DIV)) { opToken = (LexTokenSymbol)(tape.Current); tape.MoveNext(); Exp rightExpr = parseMulDiv(); resultExpr = new ExpBinary(expContext) { LeftExp = resultExpr, OpToken = opToken, RightExp = rightExpr }; } return(resultExpr); }
private Exp ParseBinaryLogicExp() { LexTokenSymbol opToken; Exp resultExpr = parseCompareExpr(); while (tape.HasCurrent && tape.Current.IsKind(TokenKindSymbol.AND, TokenKindSymbol.OR)) { opToken = (LexTokenSymbol)(tape.Current); tape.MoveNext(); Exp rightExpr = parseCompareExpr(); resultExpr = new ExpBinary(expContext) { LeftExp = resultExpr, OpToken = opToken, RightExp = rightExpr }; } //resultExpr.SetContextExp(this.expContext); return(resultExpr); }
Exp parseMulDiv() { //report("parseMulDiv"); Token opToken; Exp resultExpr = parseCall(); while (tape.Current.Kind == TokenKind.MUL || tape.Current.Kind == TokenKind.DIV) { opToken = tape.Current; tape.MoveNext(); Exp rightExpr = parseMulDiv(); resultExpr = new ExpBinary() { LeftExp = resultExpr, OpToken = opToken, RightExp = rightExpr }; } return(resultExpr); }
protected Exp parseCompareExpr() { Token opToken; Exp resultExpr = parseAddSub(); //while (CurrentToken.Kind == TokenKind.GT || CurrentToken.Kind == TokenKind.LT || CurrentToken.Kind == TokenKind.GE // || CurrentToken.Kind == TokenKind.LE || CurrentToken.Kind == TokenKind.NE || CurrentToken.Kind == TokenKind.EQ) while (TokenKindHelper.IsCompareOp(tape.CurrentKind)) { opToken = tape.Current; tape.MoveNext(); Exp rightExpr = parseAddSub(); resultExpr = new ExpBinary() { LeftExp = resultExpr, OpToken = opToken, RightExp = rightExpr }; } return(resultExpr); }