Skip to content

How can you detect indentation and dedentation? #128

Answered by renggli
DeepBhat asked this question in Q&A
Discussion options

You must be logged in to vote

This is non-trivial, see the corresponding discussions on Stack Overflow: https://stackoverflow.com/questions/4205442/peg-for-python-style-indentation, https://stackoverflow.com/questions/11659095/parse-indentation-level-with-peg-js

I have not tried to do it myself with PetitParser, but know that other people have successfully written grammars for Markdown, Python and the like: http://scg.unibe.ch/research/indentParsing (the examples given here are for the Smalltalk version of this library).

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by DeepBhat
Comment options

You must be logged in to vote
1 reply
@gmpassos
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants