Skip to content

Commit

Permalink
Merge pull request #157 from aspeddro/decorated-call-function
Browse files Browse the repository at this point in the history
feat: support decorated expressions
  • Loading branch information
nkrkv authored Nov 14, 2022
2 parents f8d93e4 + 8d8680a commit 41f0b28
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 4 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ module.exports = grammar({

_decorated_statement: $ => seq(
repeat1($.decorator),
$.declaration,
choice(
$.declaration,
$.expression_statement
)
),

decorator_statement: $ => seq(
Expand Down
11 changes: 10 additions & 1 deletion test/corpus/decorators.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ let foo = @doesNotRaise String.make(12, ' ')

let onResult = () => @doesNotRaise Belt.Array.getExn([], 0)

@local
call()

---

(source_file
Expand Down Expand Up @@ -72,7 +75,13 @@ let onResult = () => @doesNotRaise Belt.Array.getExn([], 0)
(value_identifier))
(arguments
(array)
(number))))))
(number)))))

(decorated
(decorator (decorator_identifier))
(expression_statement
(call_expression
(value_identifier) (arguments)))))

============================================
Decorator before type `and`
Expand Down

0 comments on commit 41f0b28

Please sign in to comment.