Skip to content

Improve indentation example to reject malformed indent#961

Open
JohnathanFL wants to merge 1 commit intozesterer:mainfrom
JohnathanFL:main
Open

Improve indentation example to reject malformed indent#961
JohnathanFL wants to merge 1 commit intozesterer:mainfrom
JohnathanFL:main

Conversation

@JohnathanFL
Copy link

Previously, it would accept same-dent/de-dent when a block was expected, which is particulary troublesome if you want to optionally parse a block (as in my language).

Also adds an example of it failing to the example, as well as a bunch of comments explaining more of how it's working for others to replicate.

As an aside, fantastic work with Chumsky! I've tried a bunch of parser libraries for my own language (which uses indentation extensively, including exotic things like strings that are determined by minimum indent while keeping lines' extra indent) and Chumsky has by far been the easiest to work with, though it makes the LSP scream in agony.

Previously, it would accept same-dent/de-dent when a block was expected,
which is particulary troublesome if you want to optionally parse a block
(as in my language).

Also adds an example of it failing to the example, as well as a bunch of
comments explaining more of how it's working for others to replicate.
@JohnathanFL
Copy link
Author

Actually, hold up on this one; I think I found some issues with my logic here while working on my own language. I'll get my own language properly tested so I know for sure it handles the right edge cases, then update this PR again. I don't anticipate the example code getting very complex; just a matter of finding the right logic.

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.

1 participant