/// <summary> /// Relation ::= Expression ("<" | ">" | "==" | "!=") Expression. /// </summary> /// <returns></returns> private RELATION parseRelation() { RELATION result = new RELATION(); result.expression1 = parseExpression(); Token token = lexer.get(); switch ( token.code ) { case TokenCode.LESS : case TokenCode.GREATER : case TokenCode.EQUAL : case TokenCode.NOT_EQUAL : result.op = token.code; lexer.forget(); result.expression2 = parseExpression(); break; default: errors.issue(token,23); lexer.skipUntil(TokenCode.SEMICOLON); break; } return result; }
private void generateRelation( ILGenerator il, RELATION relation, Label labelFalse ) { generateExpression(il,relation.expression1); generateExpression(il,relation.expression2); switch ( relation.op ) { case TokenCode.LESS: il.Emit(OpCodes.Bge, labelFalse); break; case TokenCode.GREATER: il.Emit(OpCodes.Ble, labelFalse); break; case TokenCode.EQUAL: il.Emit(OpCodes.Bne_Un,labelFalse); break; case TokenCode.NOT_EQUAL: il.Emit(OpCodes.Beq, labelFalse); break; } }