Skip to content

Bug when matching brackets #992

Closed Answered by tomtau
margual56 asked this question in Q&A
Mar 12, 2024 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

PEGs are eager: https://pest.rs/book/grammars/peg.html#eagerness
so ASCII* will also match ], and the whole expression will fail to match.

You can try ASCII_ALPHANUMERIC (https://pest.rs/book/grammars/built-ins.html#ascii-rules) instead:

properties = { "[" ~ ASCII_ALPHANUMERIC* ~ "]" }

or you can define your own rule of allowed characters that can be inside brackets

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@margual56
Comment options

@margual56
Comment options

@tomtau
Comment options

@margual56
Comment options

Answer selected by tomtau
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #991 on March 12, 2024 10:10.