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

Question about pegjs way of writing some lpeg rules #635

Open
brynne8 opened this issue Jan 4, 2020 · 1 comment
Open

Question about pegjs way of writing some lpeg rules #635

brynne8 opened this issue Jan 4, 2020 · 1 comment

Comments

@brynne8
Copy link

brynne8 commented Jan 4, 2020

Issue type

  • Question

Description

I am a LPeg.re user and I'm used to these features provided by LPeg

Syntax Description
p^num exactly n repetitions
p^+num at least n repetitions
p^-num at most n repetitions
p => name match-time capture equivalent to lpeg.Cmt(p, defs[name])

PEG.js is great but when I want to migrate these rules, I don't know how to get the same functionality. The first three are about specifying the number of repetitions of a pattern. The last one is about a function that could decide if the match is success, or change the offset of the end of match, with information of the input, current position and captures.

Software

  • PEG.js: 0.10.0 online version
@StoneCypher
Copy link

@futagoza - This issue is 30 days old and you haven't answered it yet.

@AlexanderMisel - peg doesn't have those. You would have to implement them in regular expressions or javascript

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