@@ -57,20 +57,23 @@ def advance
5757 @scanner . skip ( IDENTIFIER_REGEXP )
5858 :IDENTIFIER
5959 when ByteFor ::NUMBER
60- @scanner . skip ( NUMERIC_REGEXP )
60+ if len = @scanner . skip ( NUMERIC_REGEXP )
6161
62- if GraphQL . reject_numbers_followed_by_names
63- new_pos = @scanner . pos
64- peek_byte = @string . getbyte ( new_pos )
65- next_first_byte = FIRST_BYTES [ peek_byte ]
66- if next_first_byte == ByteFor ::NAME || next_first_byte == ByteFor ::IDENTIFIER
67- number_part = token_value
68- name_part = @scanner . scan ( IDENTIFIER_REGEXP )
69- raise_parse_error ( "Name after number is not allowed (in `#{ number_part } #{ name_part } `)" )
62+ if GraphQL . reject_numbers_followed_by_names
63+ new_pos = @scanner . pos
64+ peek_byte = @string . getbyte ( new_pos )
65+ next_first_byte = FIRST_BYTES [ peek_byte ]
66+ if next_first_byte == ByteFor ::NAME || next_first_byte == ByteFor ::IDENTIFIER
67+ number_part = token_value
68+ name_part = @scanner . scan ( IDENTIFIER_REGEXP )
69+ raise_parse_error ( "Name after number is not allowed (in `#{ number_part } #{ name_part } `)" )
70+ end
7071 end
72+ # Check for a matched decimal:
73+ @scanner [ 1 ] ? :FLOAT : :INT
74+ else
75+ raise_parse_error ( "Expected a number, but it was malformed (#{ @string [ @pos ] . inspect } )" )
7176 end
72- # Check for a matched decimal:
73- @scanner [ 1 ] ? :FLOAT : :INT
7477 when ByteFor ::ELLIPSIS
7578 if @string . getbyte ( @pos + 1 ) != 46 || @string . getbyte ( @pos + 2 ) != 46
7679 raise_parse_error ( "Expected `...`, actual: #{ @string [ @pos ..@pos + 2 ] . inspect } " )
0 commit comments