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

Error parsing valid charset class #195

Closed
mingodad opened this issue May 3, 2022 · 3 comments
Closed

Error parsing valid charset class #195

mingodad opened this issue May 3, 2022 · 3 comments

Comments

@mingodad
Copy link
Contributor

mingodad commented May 3, 2022

Trying to parse a valid peg grammar with cpp-peglib I found that it doesn't accept the charset class shown bellow:

plusorless  <-  [+-]

Playgound output:

1:21 syntax error

Changing Range to the one shown bellow fix the issue:

Range <-  (Char  '-'  ! ']' Char) /  Char

Hardcoded fix in peglib.h:

g["Range"] <= cho(seq(g["Char"], chr('-'), npd(chr(']')), g["Char"]), g["Char"]);
@yhirose
Copy link
Owner

yhirose commented May 3, 2022

@mingodad, thank you for the feedback. I tried to make the cpp-httplib PEG parser syntax as faithful as the one described on the 2nd page in the original Bryan Ford paper, but the enhancement that you suggests looks reasonable. I'll consider to take the suggestion. Thank you.

image

@mingodad
Copy link
Contributor Author

mingodad commented May 3, 2022

Another missing feature are some escape sequences like \v, \f, ...

Char		<- '\\' [abefnrtv'"[\]\\^]

@yhirose
Copy link
Owner

yhirose commented May 5, 2022

\v, \f are same as #87.

@yhirose yhirose closed this as completed in 23436e1 May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants