Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
YetAnotherMinion opened this issue Oct 29, 2017 · 1 comment

Comments

@YetAnotherMinion
Copy link

YetAnotherMinion commented Oct 29, 2017

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

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.

@wende
Copy link
Collaborator

wende commented Oct 29, 2017

Good find. I'll make a PR in some spare time, but feel free to do it yourself!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants