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

Indentation fixes: dedent consumption from #465 and ignore blank lines #481

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ianb
Copy link

@ianb ianb commented Jun 3, 2024

The first commit (39c932d) in this PR applies @simonwo's patches from #465 (comment)

I suppose this is a PR for discussion, because I don't personally understand @simonwo's changes but I did find them necessary when writing a whitespace-sensitive grammar.

The second commit (454746e) ignores blank lines when calculating indents and dedents, fixing a case like this:

if a:
  b

  c

Previously this would make a stream like if a:\n <indent>b\n<dedent>\n <indent>c\n but after it makes a stream if a:\n <indent>b\n\n c\n

ianb added 2 commits May 31, 2024 13:03
See ohmjs#465 (comment)

This changes memoization some so it can consume dedents
… as an indent or dedent

This is a case like:

if foo:
  bar()

  baz()
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