Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: failed to parse a bracketed keyword list #26

Open
mhanberg opened this issue Apr 19, 2024 · 0 comments · May be fixed by #32
Open

bug: failed to parse a bracketed keyword list #26

mhanberg opened this issue Apr 19, 2024 · 0 comments · May be fixed by #32

Comments

@mhanberg
Copy link
Contributor

Description

There was an instance where I was writing an ExUnit test, and was adding another key into a @tag. The parser raised the following exception.

[Error] ** (FunctionClauseError) no function clause matching in Spitfire.parse_kw_identifier/1
    (spitfire 0.1.0) lib/spitfire.ex:501: Spitfire.parse_kw_identifier(%{tokens: [{:kw_identifier, {60, 10, ~c"timeout"}, :timeout}, {:int, {60, 19, 120000}, ~c"120_000"}, {:eol, {60, 26, 1}}, {:identifier, {63, 5, ~c"test"}, :test}, {:bin_string, {63, 10, nil}, ["somestring"]}, {:",", {63, 91, 0}}, {:%{}, {63, 93, nil}}, {:"{", {63, 94, nil}}, {:eol, {63, 95, 1}}, {:kw_identifier, {64, 7, ~c"foo"}, :foo}, {:identifier, {64, 17, ~c"foo"}, :foo}, {:eol, {64, 25, 1}}, {:"}", {65, 5, 1}}, {:do, {65, 7, nil}}, {:eol, {65, 9, 1}}, {:identifier, {66, 7, ~c"file"}, :file}, {:match_op, {66, 12, nil}, :=}, {:bin_string, {66, 14, nil}, ["somestring", {{66, 46, nil}, {66, 56, nil}, [{:identifier, {66, 48, ~c"foo"}, :foo}]}, "somestring"]}, {:eol, {66, 70, 2}}, {:identifier, {68, 7, ~c"foo"}, :foo}, {:match_op, {68, 18, nil}, :=}, {:alias, {68, 20, ~c"foo"}, :foo}, {:., {68, 30, nil}}, {:paren_identifier, {68, 31, ~c"load"}, :load}, {:"(", {68, 35, nil}}, {:identifier, {68, 36, ~c"file"}, :file}, {:",", {68, 40, 0}}, {:atom, {68, 42, ~c"local"}, :local}, {:")", {68, 48, nil}}, {:eol, {68, 49, 2}}, {:identifier, {70, 7, ~c"bar"}, :bar}, {:match_op, {70, 19, nil}, :=}, {:paren_identifier, {70, 21, ~c"bar"}, :bar}, {:"(", {70, 32, nil}}, {:identifier, {70, 33, ~c"foo"}, :foo}, {:")", {70, 41, nil}}, {:eol, {70, 42, 1}}, {:"{", {71, 7, nil}}, {:identifier, {71, 8, ~c"messages"}, :messages}, {:",", {71, 16, 0}}, {:identifier, {71, 18, ~c"_baz"}, :_baz}, {:"}", {71, 26, nil}}, {:match_op, {71, 28, nil}, :=}, {:paren_identifier, {71, 30, ~c"alice"}, :alice}, {:"(", {71, 45, ...}}, {:identifier, {71, ...}, :foo}, {:")", {...}}, {:eol, ...}, {...}, ...], literal_encoder: #Function<0.120709541/2 in NextLS.DocumentSymbol.fetch/1>, errors: [], current_token: {:at_op, {60, 5, nil}, :@}, fuel: 150, peek_token: {:identifier, {60, 6, ~c"tag"}, :tag}, nesting: 1})
    (spitfire 0.1.0) lib/spitfire/while.ex:5: Spitfire.While2.recurse/3
    (spitfire 0.1.0) lib/spitfire.ex:533: Spitfire.parse_bracketless_kw_list/1
    (spitfire 0.1.0) lib/spitfire.ex:277: Spitfire.parse_expression/6
    (spitfire 0.1.0) lib/spitfire.ex:1871: Spitfire.parse_identifier/1
    (spitfire 0.1.0) lib/spitfire.ex:277: Spitfire.parse_expression/6
    (spitfire 0.1.0) lib/spitfire.ex:618: Spitfire.parse_prefix_expression/1
    (spitfire 0.1.0) lib/spitfire.ex:277: Spitfire.parse_expression/6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant