Skip to content

Commit

Permalink
Merge pull request Wilfred#20 from postsolar/fix-identifiers
Browse files Browse the repository at this point in the history
Bring identifiers regex pattern in accordance with PS spec
  • Loading branch information
Maskhjarna committed Oct 2, 2023
2 parents 26ad803 + a6a3105 commit 0ec5985
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 2 additions & 5 deletions grammar/id.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ module.exports = {
// var
// ------------------------------------------------------------------------

// https://www.haskell.org/onlinereport/lexemes.html
//
// varid: "small { small | large | digit | ' }" per the report,
// where small: ascSmall | uniSmall | _ (and uniSmall is a superset of ascSmall)
// Then, uniSmall is implemented as the unicode class "Ll": letter lowercase
// https://github.com/purescript/documentation/blob/09859e0d53d2b08ee7e63686a083c1a45423005f/language/Syntax.md#function-and-value-names
// https://github.com/natefaubion/purescript-language-cst-parser/blob/main/src/PureScript/CST/Lexer.purs#L500
_varid: _ => varid_pattern,
_immediate_varid: _ => token.immediate(varid_pattern),
label: _ => /#[_\p{Ll}](\w|')*/u,
Expand Down
3 changes: 2 additions & 1 deletion grammar/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ where = ($, rule) => seq(
optional(layouted($, rule)),
)

varid_pattern = /[_\p{Ll}](\w|')*#?/u
// see the documentation references in `./id.js`
varid_pattern = /[\p{Ll}_][\p{L}0-9_']*/u

module.exports = {
parens,
Expand Down

0 comments on commit 0ec5985

Please sign in to comment.