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

feat: include paren tokens around scope #37

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

wesleytodd
Copy link

Figured I would take a stab at adding some tokens for the scope parens. This fails tests, and also adds new tokens not in the grammar yet, but I figured I would see if this is how you all were thinking of solving this before I added the other parts. Let me know what you think.

Copy link
Contributor

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple notes, this looks like a great start to me though 👍

  • we might not need to add new tests, but will need to update the snapshots and make sure they have the appropriate new nodes.
  • let's perhaps update the grammar in the README to replace ( and ) with their expansion?

let s = scope(scanner)
if (s instanceof Error) {
// ... <scopeStart> <scope> <scopeEnd> ...
let ss = scopeStart(scanner)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be tempted to pull scope-start an scope-end into the scope parser, replacing the current logic that just ignores ( and ).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the same thing, and did so at first, the issue was I didn't see an example of returning multiple tokens. I can have it return an array or error, but that would be a new api in here. Is that the direction we want to go?

@@ -187,6 +209,20 @@ function scope (scanner) {
}
}

/*
* <scopeEnd> ::= ")"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to match the rest of the grammar, I'd probably make it <scope-start>/<scope-end>.

Copy link

@SSGoku369 SSGoku369 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@SSGoku369
Copy link

ok

Copy link

@SSGoku369 SSGoku369 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@bcoe
Copy link
Contributor

bcoe commented Jan 12, 2022

Don't know how this found it's way back into my inbox today 😆

Is this still something you'd like to see over finish line @wesleytodd?

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.

None yet

3 participants