You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A more detailed description of the different options can be found in the [peggy documentation](https://peggyjs.org/documentation.html#generating-a-parser-command-line).
143
+
144
+
## Using the Parser
113
145
114
146
1) Save parser generated by `peggy.generate` to a file
115
147
@@ -160,21 +192,21 @@ maintain compatibility with PCRE versions that are missing Unicode support
160
192
array (one array element per UTF-8 character) and pass this array into
161
193
`$parser->parse()` instead of the string input.
162
194
163
-
Grammar Syntax and Semantics
164
-
----------------------------
195
+
## Grammar Syntax and Semantics
165
196
166
197
See [documentation of Peggy](https://peggyjs.org/documentation.html) with following differences:
167
198
168
199
* action and predicate blocks should be written in PHP.
169
200
* the _per-parse initializer_ code block is used to provide additional methods, properties and constants to the Parser class. A special method `function initialize()` can be provided and resembles the Peggy per-parse initializer i.e. this method is called before the generated parser starts parsing (see [examples/fizzbuzz.pegjs](examples/fizzbuzz.pegjs)). All methods have access to the input (`$this->input`) and the options (`$this->options`).
170
201
* the _global initializer_ code block can be used to add use statements, classes, functions, constants, ...
202
+
*[Importing External Rules](https://peggyjs.org/documentation.html#importing-external-rules) works only from the Command Line.
0 commit comments