2ac387e1c9
The README.md file in the root of the repository had become too large, and as a result the file became hard to maintain. This commit extracts all the documentation and moves it to separate but managable files within the docs directory, a new folder also located in the root of the repository.
13 lines
414 B
Markdown
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
|
|
}
|
|
```
|