Skip to content

Commit aef5531

Browse files
authored
Merge pull request #68 from nrfulton/master
Adds support for $ in identifiers.
2 parents 678ada0 + 24df635 commit aef5531

File tree

4 files changed

+39012
-38280
lines changed

4 files changed

+39012
-38280
lines changed

corpus/definitions.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,30 @@ class A {
351351
(identifier)
352352
(type_identifier)))))
353353

354+
=======================================
355+
$ in identifier names
356+
=======================================
357+
358+
class $A$B$ {
359+
val b$, c$ : Int
360+
val d$ : String
361+
}
362+
363+
---
364+
365+
(compilation_unit
366+
(class_definition
367+
(identifier)
368+
(template_body
369+
(val_declaration
370+
(identifier)
371+
(identifier)
372+
(type_identifier))
373+
(val_declaration
374+
(identifier)
375+
(type_identifier)))))
376+
377+
354378
=======================================
355379
Value declarations (Scala 3 syntax)
356380
=======================================

grammar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ module.exports = grammar({
778778
),
779779

780780
// TODO: Include operators.
781-
_plainid: $ => /[a-zA-Z_]\w*/,
781+
_plainid: $ => /[a-zA-Z_\\$][\w\\$]*/,
782782
_backquoted_id: $=> /`[^\n`]+`/,
783783
identifier: $ => choice(
784784
$._plainid,

src/grammar.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3958,7 +3958,7 @@
39583958
},
39593959
"_plainid": {
39603960
"type": "PATTERN",
3961-
"value": "[a-zA-Z_]\\w*"
3961+
"value": "[a-zA-Z_\\\\$][\\w\\\\$]*"
39623962
},
39633963
"_backquoted_id": {
39643964
"type": "PATTERN",

0 commit comments

Comments
 (0)