Skip to content

Commit 36aeaae

Browse files
committed
fix special 'power' case
1 parent aae0057 commit 36aeaae

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/components/operators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ function parse_unary(ps::ParseState, op)
151151
K,dot = op.kind, op.dot
152152
if is_colon(op)
153153
return parse_unary_colon(ps, op)
154-
elseif (is_plus(op) || is_minus(op)) && (ps.nt.kind == Tokens.INTEGER || ps.nt.kind == Tokens.FLOAT) && isemptyws(ps.ws)
154+
elseif (is_plus(op) || is_minus(op)) && (ps.nt.kind == Tokens.INTEGER || ps.nt.kind == Tokens.FLOAT) && isemptyws(ps.ws) && ps.nnt.kind!=Tokens.CIRCUMFLEX_ACCENT
155155
arg = LITERAL(next(ps))
156156
return LITERAL(op.fullspan + arg.fullspan, first(arg.span):(last(arg.span) + length(op.span)), string(is_plus(op) ? "+" : "-" , val(ps.t, ps)), ps.t.kind)
157157
return arg

test/parser.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,12 +688,12 @@ end
688688
m = first(methods(f))
689689
@test DSE.keywords(f, m) == [:a, :b]
690690
end""" |> test_expr
691+
@test "-1^a" |> test_expr_broken
691692
end
692693

693694
@testset "Broken things" begin
694695
@test_broken "\$(a) * -\$(b)" |> test_expr_broken
695696
@test_broken "function(f, args...; kw...) end" |> test_expr_broken
696-
@test_broken "-1^a" |> test_expr_broken
697697
end
698698

699699
# test_fsig_decl(str) = (x->x.id).(CSTParser._get_fsig(CSTParser.parse(str)).defs)

0 commit comments

Comments
 (0)