@ -12,13 +12,13 @@
* The grammar must be a string in the format described by the metagramar in the
* metagrammar . pegjs file .
*
* Throws | PEG . grammarP arser. SyntaxError | if the grammar contains a syntax error
* or | PEG . GrammarError | if it contains a semantic error . Note that not all
* errors are detected during the generation and some may protrude to the
* generated parser and cause its malfunction .
* Throws | PEG . p arser. SyntaxError | if the grammar contains a syntax error or
* | PEG . GrammarError | if it contains a semantic error . Note that not all errors
* are detected during the generation and some may protrude to the generated
* parser and cause its malfunction .
* /
PEG . buildParser = function ( grammar ) {
return PEG . Compiler. compileParser ( PEG . grammarP arser. parse ( grammar ) ) ;
return PEG . compiler. compileParser ( PEG . p arser. parse ( grammar ) ) ;
} ;
/* ===== PEG.GrammarError ===== */
@ -127,9 +127,9 @@ PEG.RegExpUtils = {
}
} ;
/* ===== PEG. C ompiler ===== */
/* ===== PEG. c ompiler ===== */
PEG . C ompiler = {
PEG . c ompiler = {
/ *
* Generates a parser from a specified grammar AST . Throws | PEG . GrammarError |
* if the AST contains a semantic error . Note that not all errors are detected
@ -160,7 +160,7 @@ PEG.Compiler = {
* | PEG . GrammarError | . The checks are run in sequence in order of their
* definition .
* /
PEG . C ompiler. checks = [
PEG . c ompiler. checks = [
/* Checks that all referenced rules exist. */
function ( ast ) {
function nop ( ) { }
@ -287,7 +287,7 @@ PEG.Compiler.checks = [
* modified in - place by the pass . The passes are run in sequence in order of
* their definition .
* /
PEG . C ompiler. passes = [
PEG . c ompiler. passes = [
/ *
* Removes proxy rules -- that is , rules that only delegate to other rule .
* /
@ -366,7 +366,7 @@ PEG.Compiler.passes = [
] ;
/* Emits the generated code for the AST. */
PEG . C ompiler. emitter = function ( ast ) {
PEG . c ompiler. emitter = function ( ast ) {
/ *
* Takes parts of code , interpolates variables inside them and joins them with
* a newline .
@ -477,7 +477,7 @@ PEG.Compiler.emitter = function(ast) {
" * Parses the input with a generated parser. If the parsing is successfull," ,
" * returns a value explicitly or implicitly specified by the grammar from" ,
" * which the parser was generated (see |PEG.buildParser|). If the parsing is" ,
" * unsuccessful, throws |PEG. grammarP arser.SyntaxError| describing the error.",
" * unsuccessful, throws |PEG. p arser.SyntaxError| describing the error.",
" */" ,
" parse: function(input) {" ,
" var pos = 0;" ,