511511
512512_is_number(c:: Char ) = isdigit(c) || c in (' .' , ' e' , ' E' , ' +' , ' -' )
513513
514+ function _is_negative_digit(state, c)
515+ # The type annotation is needed for JET.
516+ return c == ' -' && isdigit(peek(state, Char):: Char )
517+ end
518+
514519function _peek_inner(state:: _LexerState )
515520 while (c = peek(state, Char)) != = nothing
516521 pos = position(state. io)
@@ -523,7 +528,7 @@ function _peek_inner(state::_LexerState)
523528 while (c = peek(state, Char)) != = nothing && c != ' \n '
524529 _ = read(state, Char)
525530 end
526- elseif isdigit(c) || (c == ' - ' && isdigit(peek( state, Char) :: Char ) ) # Number
531+ elseif isdigit(c) || _is_negative_digit( state, c ) # Number
527532 buf = IOBuffer()
528533 while (c = peek(state, Char)) != = nothing && _is_number(c)
529534 write(buf, c)
@@ -826,6 +831,7 @@ function _parse_term(
826831 # <quadratic-expression>
827832 return _parse_quadratic_expression(state, cache, prefix)
828833 end
834+ # The type annotation is needed for JET.
829835 token = peek(state, _Token):: _Token
830836 return _throw_parse_error(
831837 state,
@@ -1050,6 +1056,7 @@ function _parse_constraint_sos(
10501056 f, w = MOI. VectorOfVariables(MOI. VariableIndex[]), T[]
10511057 while true
10521058 if _next_token_is(state, _TOKEN_NEWLINE)
1059+ # The type annotation is needed for JET.
10531060 t = peek(state, _Token):: _Token
10541061 _throw_parse_error(
10551062 state,
@@ -1096,6 +1103,7 @@ function _parse_constraint_indicator(
10961103 end
10971104 _ = read(state, _Token, _TOKEN_IMPLIES)
10981105 f = _parse_expression(state, cache)
1106+ # The type annotation is needed for JET.
10991107 set = _parse_set_suffix(state, cache):: MOI.AbstractScalarSet
11001108 return MOI. add_constraint(
11011109 cache. model,
@@ -1117,6 +1125,7 @@ function _parse_constraint(state::_LexerState, cache::_ReadCache)
11171125 _parse_constraint_indicator(state, cache)
11181126 else
11191127 f = _parse_expression(state, cache)
1128+ # The type annotation is needed for JET.
11201129 set = _parse_set_suffix(state, cache):: MOI.AbstractScalarSet
11211130 MOI. add_constraint(cache. model, f, set)
11221131 end
0 commit comments