@@ -382,22 +382,22 @@ function parse_LtoR(ps::ParseState, down, is_op)
382
382
down (ps)
383
383
while is_op (peek (ps))
384
384
t = peek_token (ps)
385
- bump_dotsplit (ps)
385
+ bump_dotsplit (ps, remap_kind = K " Identifier " )
386
386
down (ps)
387
387
emit (ps, mark, is_dotted (t) ? K " dotcall" : K " call" , INFIX_FLAG)
388
388
end
389
389
end
390
390
391
391
# parse right-to-left binary operator
392
- # produces structures like (= a (= b (= c d)))
392
+ # produces structures like (=> a (=> b (=> c d)))
393
393
#
394
394
# flisp: parse-RtoL
395
395
function parse_RtoL (ps:: ParseState , down, is_op, self)
396
396
mark = position (ps)
397
397
down (ps)
398
398
t = peek_token (ps)
399
399
if is_op (kind (t))
400
- bump_dotsplit (ps)
400
+ bump_dotsplit (ps, remap_kind = K " Identifier " )
401
401
self (ps)
402
402
emit (ps, mark, is_dotted (t) ? K " dotcall" : K " call" , INFIX_FLAG)
403
403
end
@@ -624,7 +624,7 @@ function parse_assignment_with_initial_ex(ps::ParseState, mark, down::T) where {
624
624
# a .~ b ==> (dotcall-i a ~ b)
625
625
# [a ~ b c] ==> (hcat (call-i a ~ b) c)
626
626
# [a~b] ==> (vect (call-i a ~ b))
627
- bump_dotsplit (ps)
627
+ bump_dotsplit (ps, remap_kind = K " Identifier " )
628
628
bump_trivia (ps)
629
629
parse_assignment (ps, down)
630
630
emit (ps, mark, is_dotted (t) ? K " dotcall" : K " call" , INFIX_FLAG)
@@ -759,7 +759,7 @@ function parse_arrow(ps::ParseState)
759
759
# x <--> y ==> (call-i x <--> y)
760
760
# x .--> y ==> (dotcall-i x --> y)
761
761
# x -->₁ y ==> (call-i x -->₁ y)
762
- bump_dotsplit (ps)
762
+ bump_dotsplit (ps, remap_kind = K " Identifier " )
763
763
parse_arrow (ps)
764
764
emit (ps, mark, is_dotted (t) ? K " dotcall" : K " call" , INFIX_FLAG)
765
765
end
@@ -821,7 +821,7 @@ function parse_comparison(ps::ParseState, subtype_comparison=false)
821
821
while (t = peek_token (ps); is_prec_comparison (t))
822
822
n_comparisons += 1
823
823
op_dotted = is_dotted (t)
824
- op_pos = bump_dotsplit (ps, emit_dot_node= true )
824
+ op_pos = bump_dotsplit (ps, emit_dot_node= true , remap_kind = K " Identifier " )
825
825
parse_pipe_lt (ps)
826
826
end
827
827
if n_comparisons == 1
@@ -881,7 +881,7 @@ function parse_range(ps::ParseState)
881
881
# a..b ==> (call-i a .. b)
882
882
# a … b ==> (call-i a … b)
883
883
# a .… b ==> (dotcall-i a … b)
884
- bump_dotsplit (ps)
884
+ bump_dotsplit (ps, remap_kind = K " Identifier " )
885
885
parse_invalid_ops (ps)
886
886
emit (ps, mark, is_dotted (initial_tok) ? K " dotcall" : K " call" , INFIX_FLAG)
887
887
elseif initial_kind == K " :" && ps. range_colon_enabled
@@ -904,17 +904,17 @@ function parse_range(ps::ParseState)
904
904
# a :> b ==> (call-i a (error : >) b)
905
905
bump_trivia (ps, skip_newlines= false )
906
906
emark = position (ps)
907
- bump (ps) # K":"
907
+ bump (ps, remap_kind = K " Identifier " ) # K":"
908
908
ks = untokenize (peek (ps))
909
- bump (ps) # K"<" or K">"
909
+ bump (ps, remap_kind = K " Identifier " ) # K"<" or K">"
910
910
emit (ps, emark, K " error" ,
911
911
error= " Invalid `:$ks ` found, maybe replace with `$ks :`" )
912
912
parse_invalid_ops (ps)
913
913
emit (ps, mark, K " call" , INFIX_FLAG)
914
914
break
915
915
end
916
916
n_colons += 1
917
- bump (ps, n_colons == 1 ? EMPTY_FLAGS : TRIVIA_FLAG)
917
+ bump (ps, n_colons == 1 ? EMPTY_FLAGS : TRIVIA_FLAG; remap_kind = K " Identifier " )
918
918
had_newline = peek (ps) == K " NewlineWs"
919
919
t = peek_token (ps)
920
920
if is_closing_token (ps, kind (t))
@@ -1008,7 +1008,7 @@ function parse_with_chains(ps::ParseState, down, is_op, chain_ops)
1008
1008
# [x+y + z] ==> (vect (call-i x + y z))
1009
1009
break
1010
1010
end
1011
- bump_dotsplit (ps)
1011
+ bump_dotsplit (ps, remap_kind = K " Identifier " )
1012
1012
down (ps)
1013
1013
if kind (t) in chain_ops && ! is_decorated (t)
1014
1014
# a + b + c ==> (call-i a + b c)
@@ -1217,7 +1217,7 @@ function parse_unary(ps::ParseState)
1217
1217
# unary negation
1218
1218
# -2^x ==> (call-pre - (call-i 2 ^ x))
1219
1219
# -2[1, 3] ==> (call-pre - (ref 2 1 3))
1220
- bump (ps)
1220
+ bump (ps, remap_kind = K " Identifier " )
1221
1221
parse_factor (ps)
1222
1222
emit (ps, mark, K " call" , PREFIX_OP_FLAG)
1223
1223
else
@@ -1256,7 +1256,7 @@ function parse_unary(ps::ParseState)
1256
1256
#
1257
1257
# (The flisp parser only considers commas before `;` and thus gets this
1258
1258
# last case wrong)
1259
- op_pos = bump_dotsplit (ps, emit_dot_node= true )
1259
+ op_pos = bump_dotsplit (ps, emit_dot_node= true , remap_kind = K " Identifier " )
1260
1260
1261
1261
space_before_paren = preceding_whitespace (t2)
1262
1262
if space_before_paren
@@ -1303,7 +1303,7 @@ function parse_unary(ps::ParseState)
1303
1303
if is_type_operator (op_t)
1304
1304
# <:(a,) ==> (<: a)
1305
1305
emit (ps, mark, op_k, opts. delim_flags)
1306
- reset_node! (ps, op_pos, flags= TRIVIA_FLAG)
1306
+ reset_node! (ps, op_pos, flags= TRIVIA_FLAG, kind = op_k )
1307
1307
else
1308
1308
emit (ps, mark, K " call" , opts. delim_flags)
1309
1309
end
@@ -1329,7 +1329,7 @@ function parse_unary(ps::ParseState)
1329
1329
if is_type_operator (op_t)
1330
1330
# <:(a) ==> (<:-pre (parens a))
1331
1331
emit (ps, mark, op_k, PREFIX_OP_FLAG)
1332
- reset_node! (ps, op_pos, flags= TRIVIA_FLAG)
1332
+ reset_node! (ps, op_pos, flags= TRIVIA_FLAG, kind = op_k )
1333
1333
else
1334
1334
if is_dotted (op_t)
1335
1335
emit (ps, mark, K " dotcall" , PREFIX_OP_FLAG)
@@ -1349,12 +1349,12 @@ function parse_unary(ps::ParseState)
1349
1349
# -0x1 ==> (call-pre - 0x01)
1350
1350
# - 2 ==> (call-pre - 2)
1351
1351
# .-2 ==> (dotcall-pre - 2)
1352
- op_pos = bump_dotsplit (ps, EMPTY_FLAGS)
1352
+ op_pos = bump_dotsplit (ps, EMPTY_FLAGS, remap_kind = K " Identifier " )
1353
1353
else
1354
1354
# /x ==> (call-pre (error /) x)
1355
1355
# +₁ x ==> (call-pre (error +₁) x)
1356
1356
# .<: x ==> (dotcall-pre (error (. <:)) x)
1357
- bump_dotsplit (ps, EMPTY_FLAGS, emit_dot_node= true )
1357
+ bump_dotsplit (ps, EMPTY_FLAGS, emit_dot_node= true , remap_kind = K " Identifier " )
1358
1358
op_pos = emit (ps, mark, K " error" , error= " not a unary operator" )
1359
1359
end
1360
1360
parse_unary (ps)
@@ -1385,7 +1385,7 @@ end
1385
1385
function parse_factor_with_initial_ex (ps:: ParseState , mark)
1386
1386
parse_decl_with_initial_ex (ps, mark)
1387
1387
if (t = peek_token (ps); is_prec_power (kind (t)))
1388
- bump_dotsplit (ps)
1388
+ bump_dotsplit (ps, remap_kind = K " Identifier " )
1389
1389
parse_factor_after (ps)
1390
1390
emit (ps, mark, is_dotted (t) ? K " dotcall" : K " call" , INFIX_FLAG)
1391
1391
end
@@ -1687,11 +1687,12 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
1687
1687
macro_atname_range = (m, position (ps))
1688
1688
emit (ps, mark, K " ." )
1689
1689
elseif k == K " '"
1690
+ # f.' => f (error-t (. '))
1691
+ bump_dotsplit (ps, remap_kind= K " Identifier" )
1690
1692
# TODO : Reclaim dotted postfix operators :-)
1691
- # f.' => f (error-t ')
1692
- bump (ps)
1693
- emit (ps, emark, K " error" , TRIVIA_FLAG,
1693
+ emit (ps, emark, K " error" ,
1694
1694
error= " the .' operator for transpose is discontinued" )
1695
+ emit (ps, mark, K " dotcall" , POSTFIX_OP_FLAG)
1695
1696
else
1696
1697
# Field/property syntax
1697
1698
# f.x.y ==> (. (. f x) y)
@@ -1703,7 +1704,7 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
1703
1704
elseif k == K " '" && ! preceding_whitespace (t)
1704
1705
# f' ==> (call-post f ')
1705
1706
# f'ᵀ ==> (call-post f 'ᵀ)
1706
- bump (ps)
1707
+ bump (ps, remap_kind = K " Identifier " )
1707
1708
emit (ps, mark, K " call" , POSTFIX_OP_FLAG)
1708
1709
elseif k == K " {"
1709
1710
# Type parameter curlies and macro calls
@@ -3554,11 +3555,8 @@ function parse_atom(ps::ParseState, check_identifiers=true)
3554
3555
# + ==> +
3555
3556
# .+ ==> (. +)
3556
3557
# .= ==> (. =)
3557
- if is_dotted (peek_token (ps))
3558
- bump_dotsplit (ps, emit_dot_node= true )
3559
- else
3560
- bump (ps, remap_kind= K " Identifier" )
3561
- end
3558
+ bump_dotsplit (ps, emit_dot_node= true , remap_kind=
3559
+ is_syntactic_operator (leading_kind) ? leading_kind : K " Identifier" )
3562
3560
if check_identifiers && ! is_valid_identifier (leading_kind)
3563
3561
# += ==> (error +=)
3564
3562
# ? ==> (error ?)
0 commit comments