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

Parser bug with record assignment #33

Closed
rtfeldman opened this Issue Dec 7, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@rtfeldman
Member

rtfeldman commented Dec 7, 2014

Take a look at https://github.com/rtfeldman/dreamwriter/blob/75651371541a88a1d85504e70c7e41afd914eaae/Dreamwriter/Model.elm

Notice that emptyState at the bottom awkwardly has an extra level of indentation compared to the type alias above. It turns out this extra indentation is currently mandatory for record assignment.

If you attempt to do the "commas at the end of the line" style like this, the parser will let you do indentation "normally" in the case of type alias (as you can see earlier in the file), but if you try to use this style with record assignment (as with emptyState) and use "normal" indentation instead of awkward extra indentation, you get the following syntax error:

>> Error when compiling Dreamwriter.Model:
>> 
>> Parse error at (line 41, column 1):
>> unexpected "}"
>> expecting a newline or whitespace
Warning: Error when compiling Dreamwriter.Model:

Parse error at (line 41, column 1):
unexpected "}"
expecting a newline or whitespace
@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Dec 7, 2014

Member

Please open this on the elm-compiler repo. I know about this, but have never gotten around to fixing it because it is trickier than it sounds. Currently, "whitespace" means "a bunch of spacey things that do not end with a newline" so things need to be a bit tricky to make this work given how the parser is set up.

Definitely deserves an issue though!

Member

evancz commented Dec 7, 2014

Please open this on the elm-compiler repo. I know about this, but have never gotten around to fixing it because it is trickier than it sounds. Currently, "whitespace" means "a bunch of spacey things that do not end with a newline" so things need to be a bit tricky to make this work given how the parser is set up.

Definitely deserves an issue though!

@evancz evancz closed this Dec 7, 2014

@rtfeldman

This comment has been minimized.

Show comment
Hide comment
@rtfeldman

rtfeldman Dec 7, 2014

Member

Whoops! Created elm/compiler#842 instead.

Member

rtfeldman commented Dec 7, 2014

Whoops! Created elm/compiler#842 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment