Skip to content

Commit

Permalink
Allow some unicode for identifiers, fixes #37
Browse files Browse the repository at this point in the history
  • Loading branch information
damieng committed Sep 25, 2020
1 parent 9c7d312 commit f20ea1e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions corpus/classes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -509,3 +509,26 @@ class A {
parameters: (parameter_list)
body: (block
(return_statement (null_literal)))))))

=================================
Class and methods with Unicode identifiers
=================================

class Ωµ {
B.C d() {
return null;
}
}

---

(compilation_unit
(class_declaration
name: (identifier)
body: (declaration_list
(method_declaration
type: (qualified_name (identifier) (identifier))
name: (identifier)
parameters: (parameter_list)
body: (block
(return_statement (null_literal)))))))
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ module.exports = grammar({
)
),

identifier: $ => token(seq(optional('@'), /[a-zA-Z_][a-zA-Z_0-9]*/)), // identifier_token in Roslyn
identifier: $ => token(seq(optional('@'), /[a-zA-Zα-ωΑ-Ωµ_][a-zA-Zα-ωΑ-Ωµ_0-9]*/)), // identifier_token in Roslyn
global: $ => 'global',
_identifier_or_global: $ => choice($.global, $.identifier),

Expand Down

0 comments on commit f20ea1e

Please sign in to comment.