From 5a02bca34d62ed9924a1237dff2a9976e143d7e2 Mon Sep 17 00:00:00 2001 From: David Majda Date: Sun, 20 Apr 2014 13:40:24 +0200 Subject: [PATCH] Clarify initializer documentation Make it clear that there is only one initializer in the whole grammar. The previous formulation could have been understood to mean that there can be an initializer for every rule in the grammar. Fixes #82. --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 61f3aa1..ce9b7d1 100644 --- a/README.md +++ b/README.md @@ -182,14 +182,14 @@ written as a JavaScript string between the name and separating equality sign. Rules need to be separated only by whitespace (their beginning is easily recognizable), but a semicolon (“;”) after the parsing expression is allowed. -Rules can be preceded by an *initializer* — a piece of JavaScript code in curly -braces (“{” and “}”). This code is executed before the generated parser starts -parsing. All variables and functions defined in the initializer are accessible -in rule actions and semantic predicates. The code inside the initializer can -access the parser object using the `parser` variable and options passed to the -parser using the `options` variable. Curly braces in the initializer code must -be balanced. Let's look at the example grammar from above using a simple -initializer. +The first rule can be preceded by an *initializer* — a piece of JavaScript code +in curly braces (“{” and “}”). This code is executed before the generated parser +starts parsing. All variables and functions defined in the initializer are +accessible in rule actions and semantic predicates. The code inside the +initializer can access the parser object using the `parser` variable and options +passed to the parser using the `options` variable. Curly braces in the +initializer code must be balanced. Let's look at the example grammar from above +using a simple initializer. { function makeInteger(o) {