@@ -2,7 +2,7 @@ module Tokenize
2
2
3
3
export tokenize, untokenize, Tokens
4
4
5
- using .. JuliaSyntax: Kind, @K_str
5
+ using .. JuliaSyntax: JuliaSyntax, Kind, @K_str
6
6
7
7
import .. JuliaSyntax: kind,
8
8
is_literal, is_error, is_contextual_keyword, is_word_operator
@@ -370,7 +370,7 @@ function _next_token(l::Lexer, c)
370
370
return lex_identifier (l, c)
371
371
elseif isdigit (c)
372
372
return lex_digit (l, K " Integer" )
373
- elseif (k = get (UNICODE_OPS , c, K " error" )) != K " error"
373
+ elseif (k = get (_unicode_ops , c, K " error" )) != K " error"
374
374
return emit (l, k)
375
375
else
376
376
emit_error (l, K " ErrorUnknownCharacter" )
@@ -416,6 +416,7 @@ function lex_string_chunk(l)
416
416
! (pc == EOF_CHAR || is_operator_start_char (pc) || is_never_id_char (pc))
417
417
# Only allow certain characters after interpolated vars
418
418
# https://github.com/JuliaLang/julia/pull/25234
419
+ readchar (l)
419
420
return emit_error (l, K " ErrorInvalidInterpolationTerminator" )
420
421
end
421
422
if pc == EOF_CHAR
@@ -771,7 +772,7 @@ function lex_digit(l::Lexer, kind)
771
772
# If we enter the function with kind == K"Float" then a '.' has been parsed.
772
773
readchar (l)
773
774
return emit_error (l, K " ErrorInvalidNumericConstant" )
774
- elseif is_operator_start_char (ppc) && ppc != = ' : '
775
+ elseif is_dottable_operator_start_char (ppc)
775
776
readchar (l)
776
777
return emit_error (l, K " ErrorAmbiguousNumericConstant" ) # `1.+`
777
778
end
@@ -787,14 +788,14 @@ function lex_digit(l::Lexer, kind)
787
788
accept (l, " +-−" )
788
789
if accept_batch (l, isdigit)
789
790
pc,ppc = dpeekchar (l)
790
- if pc === ' .' && ! dotop2 (ppc)
791
+ if pc === ' .' && ! is_dottable_operator_start_char (ppc)
791
792
readchar (l)
792
793
return emit_error (l, K " ErrorInvalidNumericConstant" ) # `1.e1.`
793
794
end
794
795
else
795
796
return emit_error (l, K " ErrorInvalidNumericConstant" ) # `1.e`
796
797
end
797
- elseif pc == ' .' && ppc != ' .' && ! is_operator_start_char (ppc)
798
+ elseif pc == ' .' && ppc != ' .' && ! is_dottable_operator_start_char (ppc)
798
799
readchar (l)
799
800
return emit_error (l, K " ErrorInvalidNumericConstant" ) # `1.1.`
800
801
elseif ! had_fraction_digs && (is_identifier_start_char (pc) ||
@@ -808,7 +809,7 @@ function lex_digit(l::Lexer, kind)
808
809
accept (l, " +-−" )
809
810
if accept_batch (l, isdigit)
810
811
pc,ppc = dpeekchar (l)
811
- if pc === ' .' && ! dotop2 (ppc)
812
+ if pc === ' .' && ! is_dottable_operator_start_char (ppc)
812
813
accept (l, ' .' )
813
814
return emit_error (l, K " ErrorInvalidNumericConstant" ) # `1e1.`
814
815
end
@@ -948,7 +949,7 @@ function lex_dot(l::Lexer)
948
949
if accept (l, ' .' )
949
950
return emit (l, K " ..." )
950
951
else
951
- if dotop2 (peekchar (l))
952
+ if is_dottable_operator_start_char (peekchar (l))
952
953
readchar (l)
953
954
return emit_error (l, K " ErrorInvalidOperator" )
954
955
else
@@ -959,10 +960,7 @@ function lex_dot(l::Lexer)
959
960
return lex_digit (l, K " Float" )
960
961
else
961
962
pc, dpc = dpeekchar (l)
962
- if dotop1 (pc)
963
- l. dotop = true
964
- return _next_token (l, readchar (l))
965
- elseif pc == ' +'
963
+ if pc == ' +'
966
964
l. dotop = true
967
965
readchar (l)
968
966
return lex_plus (l)
@@ -1040,6 +1038,9 @@ function lex_dot(l::Lexer)
1040
1038
l. dotop = true
1041
1039
readchar (l)
1042
1040
return lex_equal (l)
1041
+ elseif is_dottable_operator_start_char (pc)
1042
+ l. dotop = true
1043
+ return _next_token (l, readchar (l))
1043
1044
end
1044
1045
return emit (l, K " ." )
1045
1046
end
0 commit comments