private Expr parseConditionExpression ( EnclosingScope scope , boolean terminated ) { int start = index ; Token lookahead ; // First, attempt to parse quantifiers (e.g. some, all, no, etc) if ( ( lookahead = tryAndMatch ( terminated , Some , All ) ) != null ) { return parseQuantifierExpression ( lookahead , scope , terminated ) ; } Expr lhs = parseShiftExpression ( scope , terminated ) ; lookahead = tryAndMatch ( terminated , LessEquals , LeftAngle , GreaterEquals , RightAngle , EqualsEquals , NotEquals , Is , Subset , SubsetEquals , Superset , SupersetEquals ) ; if ( lookahead != null && lookahead . kind == Is ) { Type type = parseType ( scope ) ; lhs = annotateSourceLocation ( new Expr . Is ( lhs , type ) , start ) ; } else if ( lookahead != null ) { Expr rhs = parseShiftExpression ( scope , terminated ) ; // switch ( lookahead . kind ) { case LessEquals : lhs = new Expr . IntegerLessThanOrEqual ( lhs , rhs ) ; break ; case LeftAngle : lhs = new Expr . IntegerLessThan ( lhs , rhs ) ; break ; case GreaterEquals : lhs = new Expr . IntegerGreaterThanOrEqual ( lhs , rhs ) ; break ; case RightAngle : lhs = new Expr . IntegerGreaterThan ( lhs , rhs ) ; break ; case EqualsEquals : lhs = new Expr . Equal ( lhs , rhs ) ; break ; case NotEquals : lhs = new Expr . NotEqual ( lhs , rhs ) ; break ; default : throw new RuntimeException ( "deadcode" ) ; // dead-code } lhs = annotateSourceLocation ( lhs , start ) ; } return lhs ; }
Parse a condition expression .