Skip to content

Fix parsing for identifiers containing "'"#65

Merged
cdepillabout merged 2 commits intocdepillabout:masterfrom
georgefst:master
Jun 4, 2020
Merged

Fix parsing for identifiers containing "'"#65
cdepillabout merged 2 commits intocdepillabout:masterfrom
georgefst:master

Conversation

@georgefst
Copy link
Copy Markdown
Collaborator

Closes #63.

This works by simply using the same logic for ' that we use for digits w.r.t. appearing in identifiers. Obviously they're not entirely equivalent in general because ' can only appear at the end of an identifier, but I don't believe there's any situation here where that difference is important.

@sjakobi
Copy link
Copy Markdown
Contributor

sjakobi commented Jun 1, 2020

Thanks a lot for fixing the bug I caused! :)

' can only appear at the end of an identifier

That's actually not true: Don't is a valid constructor name!

Could you add a test for that?

@georgefst
Copy link
Copy Markdown
Collaborator Author

Don't is a valid constructor name!

Well I never... I must be thinking of a different language.

That actually makes me more confident this is correct, although more tests could never hurt.

@cdepillabout
Copy link
Copy Markdown
Owner

@georgefst Thanks for fixing this, and @sjakobi thanks for doing a review here!

I'd be happy to merge this in once @georgefst adds one small test for constructors like Don't as suggested by @sjakobi.

@georgefst
Copy link
Copy Markdown
Collaborator Author

@cdepillabout Tests added.

Just realised you might not have got a notification for that.

@cdepillabout
Copy link
Copy Markdown
Owner

cdepillabout commented Jun 4, 2020

Looks good, thanks a lot for fixing this!

> data Dont' = Don't' deriving Show
> pPrint ([Right (Just Don't'), Right Nothing, Left 'a' ])
[ Right ( Just Don't' )
, Right Nothing
, Left 'a'
]

@cdepillabout cdepillabout merged commit 0173139 into cdepillabout:master Jun 4, 2020
@cdepillabout
Copy link
Copy Markdown
Owner

Released as 3.2.3.0 on hackage:

https://hackage.haskell.org/package/pretty-simple-3.2.3.0

@georgefst
Copy link
Copy Markdown
Collaborator Author

Woo! Thanks for the credit.

PS. looks like you missed out the --doc upload.

@cdepillabout
Copy link
Copy Markdown
Owner

@georgefst pretty-simple doesn't have many dependencies, so Hackage is usually able to upload the documentation.

However, if you notice it doesn't appear within a couple hours, feel free to ping me and I'll upload it!

@georgefst
Copy link
Copy Markdown
Collaborator Author

Oh cool, I had no idea Hackage did that.

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

Successfully merging this pull request may close these issues.

Parsing data constructors with quotes

3 participants