Skip to content

Commit ccd4af2

Browse files
committed
fix: allow Ticks' in module and variant identifiers
1 parent 0e76ceb commit ccd4af2

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

grammar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ module.exports = grammar({
13201320
$.block,
13211321
),
13221322

1323-
variant_identifier: $ => /[A-Z][a-zA-Z0-9_]*/,
1323+
variant_identifier: $ => /[A-Z][a-zA-Z0-9_']*/,
13241324

13251325
polyvar_identifier: $ => seq(
13261326
'#',
@@ -1346,7 +1346,7 @@ module.exports = grammar({
13461346

13471347
_escape_identifier: $ => token(seq('\\"', /[^"]+/ , '"')),
13481348

1349-
module_identifier: $ => /[A-Z][a-zA-Z0-9_]*/,
1349+
module_identifier: $ => /[A-Z][a-zA-Z0-9_']*/,
13501350

13511351
decorator_identifier: $ => /[a-zA-Z0-9_\.]+/,
13521352

test/corpus/modules.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ Alias
268268
===========================================
269269

270270
module Q = Foo.Bar.Qux
271+
module Foo' = Foo
271272

272273
---
273274

@@ -278,7 +279,10 @@ module Q = Foo.Bar.Qux
278279
(module_identifier_path
279280
(module_identifier)
280281
(module_identifier))
281-
(module_identifier))))
282+
(module_identifier)))
283+
(module_declaration
284+
(module_identifier)
285+
(module_identifier)))
282286

283287
===========================================
284288
Recursive

test/corpus/type_declarations.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ Variant
151151

152152
type t =
153153
| A
154+
| A'
154155
| @live("t.D") D
155156
| B(anotherType)
156157
| C({foo: int, bar: string})
@@ -163,6 +164,7 @@ type t =
163164
(type_declaration
164165
(type_identifier)
165166
(variant_type
167+
(variant_declaration (variant_identifier))
166168
(variant_declaration (variant_identifier))
167169
(variant_declaration
168170
(decorator (decorator_identifier) (decorator_arguments (string (string_fragment))))

0 commit comments

Comments
 (0)