Skip to content
This repository was archived by the owner on Jun 1, 2022. It is now read-only.

Commit e989047

Browse files
authored
[#46] Restrict prefix application to operators (#47)
1 parent d1994de commit e989047

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

grammar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ module.exports = grammar({
225225
')'
226226
)),
227227
prefix_application: $ => prec.right(PREC.PREFIX, seq(
228-
field('abstraction', $.identifier),
228+
field('abstraction', alias($._operator, $.identifier)),
229229
field('argument', $._simple_expression)
230230
)),
231231
infix_application: $ => choice(

test/corpus/expressions.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ a(1)(1)
113113
+(1)
114114
a(?, 1)
115115
+ 1
116-
a 1
117116
1 `a` -b(1)
118117

119118
---
@@ -128,11 +127,9 @@ a 1
128127
arguments: (arguments
129128
(argument
130129
value: (number))))
131-
(application
130+
(prefix_application
132131
abstraction: (identifier)
133-
arguments: (arguments
134-
(argument
135-
value: (number))))
132+
argument: (number))
136133
(application
137134
abstraction: (identifier)
138135
arguments: (arguments
@@ -142,9 +139,6 @@ a 1
142139
(prefix_application
143140
abstraction: (identifier)
144141
argument: (number))
145-
(prefix_application
146-
abstraction: (identifier)
147-
argument: (number))
148142
(infix_application
149143
left: (number)
150144
abstraction: (infix_application_operator)

0 commit comments

Comments
 (0)