@@ -544,7 +544,7 @@ function parse_assignment_with_initial_ex(ps::ParseState, mark, down::T) where {
544544 if k == K " ~"
545545 if ps. space_sensitive && ! preceding_whitespace (peek_token (ps, 2 ))
546546 # Unary ~ in space sensitive context is not assignment precedence
547- # [a ~b] ==> (hcat a (call ~ b))
547+ # [a ~b] ==> (hcat a (call-pre ~ b))
548548 return
549549 end
550550 # ~ is the only non-syntactic assignment-precedence operator.
@@ -885,8 +885,8 @@ function parse_with_chains(ps::ParseState, down, is_op, chain_ops)
885885 is_both_unary_and_binary (t) &&
886886 ! preceding_whitespace (peek_token (ps, 2 ))
887887 # The following is two elements of a hcat
888- # [x +y] ==> (hcat x (call + y))
889- # [x+y +z] ==> (hcat (call-i x + y) (call + z))
888+ # [x +y] ==> (hcat x (call-pre + y))
889+ # [x+y +z] ==> (hcat (call-i x + y) (call-pre + z))
890890 # Conversely the following are infix calls
891891 # [x +₁y] ==> (vect (call-i x +₁ y))
892892 # [x+y+z] ==> (vect (call-i x + y z))
@@ -914,7 +914,7 @@ function parse_chain(ps::ParseState, down, op_kind)
914914 if ps. space_sensitive && preceding_whitespace (t) &&
915915 is_both_unary_and_binary (t) &&
916916 ! preceding_whitespace (peek_token (ps, 2 ))
917- # [x +y] ==> (hcat x (call + y))
917+ # [x +y] ==> (hcat x (call-pre + y))
918918 break
919919 end
920920 bump (ps, TRIVIA_FLAG)
@@ -948,16 +948,16 @@ function parse_unary_subtype(ps::ParseState)
948948 elseif k2 in KSet " { ("
949949 # parse <:{T}(x::T) or <:(x::T) like other unary operators
950950 # <:{T}(x::T) ==> (call (curly <: T) (:: x T))
951- # <:(x::T) ==> (<: (:: x T))
951+ # <:(x::T) ==> (<:-pre (:: x T))
952952 parse_where (ps, parse_juxtapose)
953953 else
954- # <: A where B ==> (<: (where A B))
954+ # <: A where B ==> (<:-pre (where A B))
955955 mark = position (ps)
956956 bump (ps, TRIVIA_FLAG)
957957 parse_where (ps, parse_juxtapose)
958958 # Flisp parser handled this, but I don't know how it can happen...
959959 @check peek_behind (ps). kind != K " tuple"
960- emit (ps, mark, k)
960+ emit (ps, mark, k, PREFIX_OP_FLAG )
961961 end
962962 else
963963 parse_where (ps, parse_juxtapose)
@@ -1015,7 +1015,7 @@ function is_juxtapose(ps, prev_k, t)
10151015 # Not juxtaposition - parse_juxtapose will consume only the first token.
10161016 # x.3 ==> x
10171017 # sqrt(2)2 ==> (call sqrt 2)
1018- # x' y ==> x
1018+ # x' y ==> (call-post x ')
10191019 # x 'y ==> x
10201020
10211021 return ! preceding_whitespace (t) &&
@@ -1039,7 +1039,7 @@ end
10391039# 2(x) ==> (call-i 2 * x)
10401040# (2)(3)x ==> (call-i 2 * 3 x)
10411041# (x-1)y ==> (call-i (call-i x - 1) * y)
1042- # x'y ==> x
1042+ # x'y ==> (call-i (call-post x ') * y)
10431043#
10441044# flisp: parse-juxtapose
10451045function parse_juxtapose (ps:: ParseState )
@@ -1098,11 +1098,11 @@ function parse_unary(ps::ParseState)
10981098 if is_prec_power (k3) || k3 in KSet " [ {"
10991099 # `[`, `{` (issue #18851) and `^` have higher precedence than
11001100 # unary negation
1101- # -2^x ==> (call - (call-i 2 ^ x))
1102- # -2[1, 3] ==> (call - (ref 2 1 3))
1101+ # -2^x ==> (call-pre - (call-i 2 ^ x))
1102+ # -2[1, 3] ==> (call-pre - (ref 2 1 3))
11031103 bump (ps)
11041104 parse_factor (ps)
1105- emit (ps, mark, K " call" )
1105+ emit (ps, mark, K " call" , PREFIX_OP_FLAG )
11061106 else
11071107 # We have a signed numeric literal. Glue the operator to the
11081108 # next token to create a signed literal:
@@ -1115,17 +1115,17 @@ function parse_unary(ps::ParseState)
11151115 end
11161116 end
11171117 # Things which are not quite negative literals result in a unary call instead
1118- # -0x1 ==> (call - 0x01)
1119- # - 2 ==> (call - 2)
1120- # .-2 ==> (call .- 2)
1118+ # -0x1 ==> (call-pre - 0x01)
1119+ # - 2 ==> (call-pre - 2)
1120+ # .-2 ==> (call-pre .- 2)
11211121 parse_unary_call (ps)
11221122end
11231123
11241124# Parse calls to unary operators and prefix calls involving arbitrary operators
11251125# with bracketed arglists (as opposed to infix notation)
11261126#
1127- # +a ==> (call + a)
1128- # +(a,b) ==> (call + a b)
1127+ # +a ==> (call-pre + a)
1128+ # +(a,b) ==> (call-pre + a b)
11291129#
11301130# flisp: parse-unary-call
11311131function parse_unary_call (ps:: ParseState )
@@ -1208,33 +1208,33 @@ function parse_unary_call(ps::ParseState)
12081208 else
12091209 # Unary function calls with brackets as grouping, not an arglist
12101210 if opts. is_block
1211- # +(a;b) ==> (call + (block a b))
1211+ # +(a;b) ==> (call-pre + (block a b))
12121212 emit (ps, mark_before_paren, K " block" )
12131213 end
12141214 # Not a prefix operator call but a block; `=` is not `kw`
1215- # +(a=1) ==> (call + (= a 1))
1215+ # +(a=1) ==> (call-pre + (= a 1))
12161216 # Unary operators have lower precedence than ^
1217- # +(a)^2 ==> (call + (call-i a ^ 2))
1218- # +(a)(x,y)^2 ==> (call + (call-i (call a x y) ^ 2))
1217+ # +(a)^2 ==> (call-pre + (call-i a ^ 2))
1218+ # +(a)(x,y)^2 ==> (call-pre + (call-i (call a x y) ^ 2))
12191219 parse_call_chain (ps, mark_before_paren)
12201220 parse_factor_with_initial_ex (ps, mark_before_paren)
1221- emit (ps, mark, op_node_kind)
1221+ emit (ps, mark, op_node_kind, PREFIX_OP_FLAG )
12221222 end
12231223 else
12241224 if is_unary_op (op_t)
12251225 # Normal unary calls
1226- # +x ==> (call + x)
1227- # √x ==> (call √ x)
1228- # ±x ==> (call ± x)
1226+ # +x ==> (call-pre + x)
1227+ # √x ==> (call-pre √ x)
1228+ # ±x ==> (call-pre ± x)
12291229 bump (ps, op_tok_flags)
12301230 else
1231- # /x ==> (call (error /) x)
1232- # +₁ x ==> (call (error +₁) x)
1233- # .<: x ==> (call (error .<:) x)
1231+ # /x ==> (call-pre (error /) x)
1232+ # +₁ x ==> (call-pre (error +₁) x)
1233+ # .<: x ==> (call-pre (error .<:) x)
12341234 bump (ps, error= " not a unary operator" )
12351235 end
12361236 parse_unary (ps)
1237- emit (ps, mark, op_node_kind)
1237+ emit (ps, mark, op_node_kind, PREFIX_OP_FLAG )
12381238 end
12391239end
12401240
@@ -1433,6 +1433,8 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
14331433 finish_macroname (ps, mark, valid_macroname, macro_name_position)
14341434 end
14351435 # f(a,b) ==> (call f a b)
1436+ # f(a; b=1) ==> (call f a (parameters (b 1)))
1437+ # (a=1)() ==> (call (= a 1))
14361438 # f (a) ==> (call f (error-t) a b)
14371439 bump_disallowed_space (ps)
14381440 bump (ps, TRIVIA_FLAG)
@@ -1457,6 +1459,7 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
14571459 K " ]" , ps. end_symbol)
14581460 # a[i] ==> (ref a i)
14591461 # a[i,j] ==> (ref a i j)
1462+ # (a=1)[] ==> (ref (= a 1))
14601463 # T[x y] ==> (typed_hcat T x y)
14611464 # T[x ; y] ==> (typed_vcat T x y)
14621465 # T[a b; c d] ==> (typed_vcat T (row a b) (row c d))
@@ -1562,15 +1565,10 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
15621565 this_iter_valid_macroname = true
15631566 end
15641567 elseif k == K " '" && ! preceding_whitespace (t)
1565- if ! is_suffixed (t)
1566- # f' ==> (' f)
1567- bump (ps, TRIVIA_FLAG)
1568- emit (ps, mark, k)
1569- else
1570- # f'ᵀ ==> (call 'ᵀ f)
1571- bump (ps)
1572- emit (ps, mark, K " call" , INFIX_FLAG)
1573- end
1568+ # f' ==> (call-post f ')
1569+ # f'ᵀ ==> (call-post f 'ᵀ)
1570+ bump (ps)
1571+ emit (ps, mark, K " call" , POSTFIX_OP_FLAG)
15741572 elseif k == K " {"
15751573 # Type parameter curlies and macro calls
15761574 if is_macrocall
0 commit comments