File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -766,15 +766,17 @@ function lex_xor(l::Lexer)
766
766
end
767
767
768
768
function accept_number (l:: Lexer , f:: F ) where {F}
769
+ lexed_number = false
769
770
while true
770
771
pc, ppc = dpeekchar (l)
771
772
if pc == ' _' && ! f (ppc)
772
- return
773
+ return lexed_number
773
774
elseif f (pc) || pc == ' _'
774
775
readchar (l)
775
776
else
776
- return
777
+ return lexed_number
777
778
end
779
+ lexed_number = true
778
780
end
779
781
end
780
782
@@ -864,7 +866,9 @@ function lex_digit(l::Lexer, kind)
864
866
if accept (l, " pP" )
865
867
kind = K " Float"
866
868
accept (l, " +-−" )
867
- accept_number (l, isdigit)
869
+ if ! accept_number (l, isdigit)
870
+ return emit_error (l, K " ErrorInvalidNumericConstant" )
871
+ end
868
872
elseif isfloat
869
873
return emit_error (l, K " ErrorInvalidNumericConstant" )
870
874
end
Original file line number Diff line number Diff line change 589
589
@test kind .(collect (tokenize (" 3.2e2.2" ))) == [K " ErrorInvalidNumericConstant" , K " Integer" , K " EndMarker" ]
590
590
@test kind .(collect (tokenize (" 3e2.2" ))) == [K " ErrorInvalidNumericConstant" , K " Integer" , K " EndMarker" ]
591
591
@test kind .(collect (tokenize (" 0b101__101" ))) == [K " BinInt" , K " Identifier" , K " EndMarker" ]
592
+ @test tok (" 0x1p" ). kind == K " ErrorInvalidNumericConstant"
592
593
end
593
594
594
595
@testset " floating points" begin
You can’t perform that action at this time.
0 commit comments