@ -1139,44 +1139,44 @@ function generateJS(ast, options) {
}
function generateWrapper ( toplevelCode ) {
var parts = [ ] ;
parts . push ( [
'(function() {' ,
' "use strict";' ,
'' ,
' /*' ,
' * Generated by PEG.js 0.9.0.' ,
' *' ,
' * http://pegjs.org/' ,
' */' ,
''
] . join ( '\n' ) ) ;
parts . push ( indent2 ( toplevelCode ) ) ;
parts . push ( [
'' ,
' return {'
] . join ( '\n' ) ) ;
function generateIntro ( ) {
return [
'"use strict";' ,
'' ,
'/*' ,
' * Generated by PEG.js 0.9.0.' ,
' *' ,
' * http://pegjs.org/' ,
' */'
] . join ( '\n' ) ;
}
if ( options . trace ) {
parts . push ( [
' SyntaxError: peg$SyntaxError,' ,
' DefaultTracer: peg$DefaultTracer,' ,
' parse: peg$parse'
] . join ( '\n' ) ) ;
} else {
parts . push ( [
' SyntaxError: peg$SyntaxError,' ,
' parse: peg$parse'
] . join ( '\n' ) ) ;
function generateParserObject ( ) {
return options . trace
? [
'{' ,
' SyntaxError: peg$SyntaxError,' ,
' DefaultTracer: peg$DefaultTracer,' ,
' parse: peg$parse' ,
'}'
] . join ( '\n' )
: [
'{' ,
' SyntaxError: peg$SyntaxError,' ,
' parse: peg$parse' ,
'}'
] . join ( '\n' ) ;
}
parts . push ( [
' };' ,
'})()'
] . join ( '\n' ) ) ;
var parts = [ ] ;
parts . push ( '(function() {' ) ;
parts . push ( indent2 ( generateIntro ( ) ) ) ;
parts . push ( '' ) ;
parts . push ( indent2 ( toplevelCode ) ) ;
parts . push ( '' ) ;
parts . push ( indent2 ( 'return ' + generateParserObject ( ) + ';' ) ) ;
parts . push ( '})()' ) ;
return parts . join ( '\n' ) ;
}