Skip to content

Commit

Permalink
Handle greek letters in identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunsfeld committed Nov 9, 2018
1 parent 06f1d02 commit c766d69
Show file tree
Hide file tree
Showing 4 changed files with 6,225 additions and 6,121 deletions.
13 changes: 13 additions & 0 deletions corpus/expressions.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
=====================================
Identifiers with Greek letters
=====================================

ψ1 = β_γ + Ψ_5

---

(module
(expression_statement (assignment
(expression_list (identifier))
(expression_list (binary_operator (identifier) (identifier))))))

=====================================
Subscript expressions
=====================================
Expand Down
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ module.exports = grammar({
)
),

identifier: $ => /[a-zA-Z_]\w*/,
identifier: $ => /[a-zA-Zα-ωΑ-Ω_][a-zA-Zα-ωΑ-Ω_0-9]*/,

keyword_identifier: $ => alias(choice('print', 'exec'), $.identifier),

Expand Down
2 changes: 1 addition & 1 deletion src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3927,7 +3927,7 @@
},
"identifier": {
"type": "PATTERN",
"value": "[a-zA-Z_]\\w*"
"value": "[a-zA-Zα-ωΑ-Ω_][a-zA-Zα-ωΑ-Ω_0-9]*"
},
"keyword_identifier": {
"type": "ALIAS",
Expand Down
Loading

0 comments on commit c766d69

Please sign in to comment.