Bogdanp / Bogdanp/elm-ast

Regex parser for name should not include '-' character for elm 0.18

Open
#87 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Elm
Stars
145
Forks
19
PR merge metrics
No merged PRs in 30d

Description

The current definition believes that minus character can be part of variable names, while the elm-repl for 0.18.0 does not aggree
https://github.com/Bogdanp/elm-ast/blob/8.0.7/src/Ast/Helpers.elm#L89
```elm
name : Parser s Char -> Parser s String
name p =
String.cons <$> p <*> regex "[a-zA-Z0-9-_]*"
```
Explanation:
```
/[a-zA-Z0-9-_]*/g
Match a single character present in the list below [a-zA-Z0-9-_]*
* Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
a-z a single character in the range between a (index 97) and z (index 122) (case sensitive)
A-Z a single character in the range between A (index 65) and Z (index 90) (case sensitive)
0-9 a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
-_ matches a single character in the list -_ (case sensitive)
```

I believe changing the regex to `"[a-zA-Z0-9_]*"` would work. This is such a small change that it could be better done straight through the web interface by a contributor.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.