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

Reimplement offset() and add range(). #528

Merged
merged 2 commits into from Sep 4, 2017
Merged

Conversation

felix9
Copy link
Contributor

@felix9 felix9 commented Sep 3, 2017

offsetEnd() is new.

offset() existed prior to 0.10, and the existing name is why I'm not
calling it offsetStart().

Fixes #526

offsetEnd() is new.

offset() existed prior to 0.10, and the existing name is why I'm not
calling it offsetStart().

Fixes pegjs#526
@jaubourg
Copy link

jaubourg commented Sep 3, 2017

You could name it offsetStart and alias it as offset for backward compatibility. Best of both worlds.

@felix9
Copy link
Contributor Author

felix9 commented Sep 3, 2017

Sure, but I lean slightly in favor of avoiding unnecessary redundancy. I'll add the alias if anyone feels strongly about it

@futagoza
Copy link
Member

futagoza commented Sep 4, 2017

@felix9 I was planning on adding range() instead of offsetEnd() as the reason most people look for the ending offset is when making a range:

function range() {
    return [peg$savedPos, peg$currPos];
}

Any particular reason (and/or use case) you chose to use offsetEnd() instead?

@felix9
Copy link
Contributor Author

felix9 commented Sep 4, 2017

No reason. Range is probably better, yeah.

@felix9 felix9 changed the title Reimplement offset() and add offsetEnd(). Reimplement offset() and add range(). Sep 4, 2017
@futagoza futagoza merged commit 958e158 into pegjs:master Sep 4, 2017
@felix9 felix9 deleted the offset branch September 15, 2017 04:38
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