Skip to content

Commit 1e83ffc

Browse files
committed
fix: allow ticks' in type and polyvar identifiers
1 parent ccd4af2 commit 1e83ffc

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

grammar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ module.exports = grammar({
13251325
polyvar_identifier: $ => seq(
13261326
'#',
13271327
choice(
1328-
/[a-zA-Z0-9_]+/,
1328+
/[a-zA-Z0-9_']+/,
13291329
seq(
13301330
optional('\\'),
13311331
alias($.string, $.polyvar_string),
@@ -1334,7 +1334,7 @@ module.exports = grammar({
13341334
),
13351335

13361336
type_identifier: $ => choice(
1337-
/[a-z_'][a-zA-Z0-9_]*/,
1337+
/[a-z_'][a-zA-Z0-9_']*/,
13381338
$._escape_identifier,
13391339
),
13401340

test/corpus/type_declarations.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ Opaque
33
===========================================
44

55
type t
6+
type t'
67
type \"type"
78

89
---
910

1011
(source_file
12+
(type_declaration (type_identifier))
1113
(type_declaration (type_identifier))
1214
(type_declaration (type_identifier)))
1315

@@ -212,6 +214,7 @@ Polyvar
212214

213215
type t = [>
214216
| #AAA
217+
| #AAA'
215218
| #bbb(anotherType)
216219
| #"cc-cc"
217220
| #\"cc-cc"
@@ -230,6 +233,7 @@ type t<'w> = [M.t<'w>]
230233
(type_declaration
231234
(type_identifier)
232235
(polyvar_type
236+
(polyvar_declaration (polyvar_identifier))
233237
(polyvar_declaration (polyvar_identifier))
234238
(polyvar_declaration
235239
(polyvar_identifier) (polyvar_parameters (type_identifier)))

0 commit comments

Comments
 (0)