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

INDENT and DEDENT #49

Closed
s5bug opened this issue Mar 15, 2020 · 5 comments
Closed

INDENT and DEDENT #49

s5bug opened this issue Mar 15, 2020 · 5 comments

Comments

@s5bug
Copy link

s5bug commented Mar 15, 2020

Is there a way to match INDENT/DEDENT or make parsers take an indentation level?

func foo(a: A, b: B): C =
  theresSomeIndentRequiredHere(a, b)

func noMoreIndentMeansNoMoreFoo: D = ???
@ollef
Copy link
Owner

ollef commented Mar 16, 2020

Hey!

Good question.

There's no support built into the Earley library for indentation sensitivity, but perhaps a custom lexer could output such tokens for Earley to consume?

@s5bug
Copy link
Author

s5bug commented Mar 17, 2020

Any recommendations on how to do that effectively and efficiently?

@ollef
Copy link
Owner

ollef commented Mar 17, 2020

I'm afraid I can't help you there, but perhaps someone else can?

@s5bug
Copy link
Author

s5bug commented Mar 30, 2020

I've opened a StackOverflow question. If I get a reasonable answer, I'll post it here and close the issue.

@s5bug
Copy link
Author

s5bug commented Apr 26, 2020

I've been playing around with Megaparsec and Alex, both seem equally suited to handle this situation.

@s5bug s5bug closed this as completed Apr 26, 2020
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

No branches or pull requests

2 participants