Skip to content

Commit

Permalink
Add support for %error hooks
Browse files Browse the repository at this point in the history
Closes #145.
  • Loading branch information
bbannier committed Oct 3, 2024
1 parent d66d5e9 commit cb9b399
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions corpus/unit.spicy
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,10 @@ on X::Y::%error {}
# Debug hooks.
on X::Y::%done %debug {}
on X::Y::%error (e: msg )%debug {}

# Error hooks.
type Test = unit {
b: b"B" %error {}
on b %error {}
};
on Test::b(msg: string) %error {}
7 changes: 7 additions & 0 deletions corpus/unit.spicy.expected
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,10 @@ on X::Y::%error {}
# Debug hooks.
on X::Y::%done %debug {}
on X::Y::%error(e: msg) %debug {}

# Error hooks.
type Test = unit {
b: b"B" %error {}
on b %error {}
};
on Test::b(msg: string) %error {}
1 change: 1 addition & 0 deletions src/query.scm
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"on"
"="
(is_debug)
(is_error)
(hook_priority)
] @append_space @prepend_space

Expand Down

0 comments on commit cb9b399

Please sign in to comment.