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)) ) # 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,7 +831,8 @@ function _parse_term(
826831 # <quadratic-expression>
827832 return _parse_quadratic_expression (state, cache, prefix)
828833 end
829- token = peek (state, _Token)
834+ # The type annotation is needed for JET.
835+ token = peek (state, _Token):: _Token
830836 return _throw_parse_error (
831837 state,
832838 token,
@@ -1050,7 +1056,8 @@ function _parse_constraint_sos(
10501056 f, w = MOI. VectorOfVariables (MOI. VariableIndex[]), T[]
10511057 while true
10521058 if _next_token_is (state, _TOKEN_NEWLINE)
1053- t = peek (state, _Token)
1059+ # The type annotation is needed for JET.
1060+ t = peek (state, _Token):: _Token
10541061 _throw_parse_error (
10551062 state,
10561063 t,
@@ -1096,7 +1103,8 @@ function _parse_constraint_indicator(
10961103 end
10971104 _ = read (state, _Token, _TOKEN_IMPLIES)
10981105 f = _parse_expression (state, cache)
1099- set = _parse_set_suffix (state, cache)
1106+ # The type annotation is needed for JET.
1107+ set = _parse_set_suffix (state, cache):: MOI.AbstractScalarSet
11001108 return MOI. add_constraint (
11011109 cache. model,
11021110 MOI. Utilities. operate (vcat, T, z, f),
@@ -1117,7 +1125,8 @@ function _parse_constraint(state::_LexerState, cache::_ReadCache)
11171125 _parse_constraint_indicator (state, cache)
11181126 else
11191127 f = _parse_expression (state, cache)
1120- set = _parse_set_suffix (state, cache)
1128+ # The type annotation is needed for JET.
1129+ set = _parse_set_suffix (state, cache):: MOI.AbstractScalarSet
11211130 MOI. add_constraint (cache. model, f, set)
11221131 end
11231132 if name != = nothing
0 commit comments