Skip to content

Commit

Permalink
Merge pull request #9 from nickel-lang/identifier-extend
Browse files Browse the repository at this point in the history
Add ' to valid identifier characters
  • Loading branch information
ErinvanderVeen authored Jun 21, 2022
2 parents c4dd142 + 29a8dbe commit 9a502ea
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 58 deletions.
32 changes: 32 additions & 0 deletions corpus/basic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,38 @@ a-b

--------------------------------------------------------------------------------

(term
(uni_term
(infix_expr
(applicative
(record_operand
(atom
(ident)))))))

================================================================================
identifier with '
================================================================================

a'

--------------------------------------------------------------------------------

(term
(uni_term
(infix_expr
(applicative
(record_operand
(atom
(ident)))))))

================================================================================
identifier with _
================================================================================

_a_''''_'_

--------------------------------------------------------------------------------

(term
(uni_term
(infix_expr
Expand Down
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = grammar({

num_literal: _ => /[0-9]*\.?[0-9]+/,

ident: _ => /_?[a-zA-Z][_a-zA-Z0-9-]*/,
ident: _ => /_?[a-zA-Z][_a-zA-Z0-9-']*/,

////////////////////////////
// PARSER RULES (grammar.lalrpop)
Expand Down
2 changes: 1 addition & 1 deletion src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"ident": {
"type": "PATTERN",
"value": "_?[a-zA-Z][_a-zA-Z0-9-]*"
"value": "_?[a-zA-Z][_a-zA-Z0-9-']*"
},
"annot_atom": {
"type": "CHOICE",
Expand Down
Loading

0 comments on commit 9a502ea

Please sign in to comment.