You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pegjs/docs/grammar/balanced-braces.md

13 lines
414 B
Markdown

### Balanced Braces
Code fragments such as actions and predicates must have balanced curly braces, because PEG.js doesn't parse the contents. It only looks at balanced braces to find the end of the code fragment.
If your code fragment needs an unbalanced brace in a string literal, you can balance it in a comment. For example:
```pegjs
brace = [{}] {
return text() === "{" ? 1 : -1;
// } for balance
}
```