Allow 'panic' as a function application

This matches the same syntax as 'todo'.

Closes #82
pull/844/head
Michael Davis 2024-03-18 17:52:22 +07:00
parent 2012f294ba
commit ed9d717629
No known key found for this signature in database
2 changed files with 26 additions and 1 deletions

@ -357,7 +357,15 @@ module.exports = grammar({
)
),
panic: ($) =>
seq("panic", optional(seq("as", field("message", $._expression)))),
seq(
"panic",
optional(
choice(
seq("(", field("message", $.string), ")"),
seq("as", field("message", $._expression))
)
)
),
tuple: ($) => seq("#", "(", optional(series_of($._expression, ",")), ")"),
list: ($) =>
seq(

@ -146,6 +146,23 @@ panic as { "Hello, " <> "world!" }
(string
(quoted_content))))))
================================================================================
Todo and panic in function application style
================================================================================
todo("don't panic")
panic("aaaah!")
--------------------------------------------------------------------------------
(source_file
(todo
(string
(quoted_content)))
(panic
(string
(quoted_content))))
================================================================================
Nested field access
================================================================================