|
|
|
@ -127,15 +127,18 @@ function generateJS( ast, options ) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ast.literals.map(
|
|
|
|
|
( c, i ) => "var " + l( i ) + " = " + buildLiteral( c ) + ";"
|
|
|
|
|
).concat( "", ast.classes.map(
|
|
|
|
|
( c, i ) => "var " + r( i ) + " = " + buildRegexp( c ) + ";" )
|
|
|
|
|
).concat( "", ast.expectations.map(
|
|
|
|
|
( c, i ) => "var " + e( i ) + " = " + buildExpectation( c ) + ";" )
|
|
|
|
|
).concat( "", ast.functions.map(
|
|
|
|
|
( c, i ) => "var " + f( i ) + " = " + buildFunc( c ) + ";"
|
|
|
|
|
) ).join( "\n" );
|
|
|
|
|
return ast.literals
|
|
|
|
|
.map( ( c, i ) => "var " + l( i ) + " = " + buildLiteral( c ) + ";" )
|
|
|
|
|
.concat( "", ast.classes.map(
|
|
|
|
|
( c, i ) => "var " + r( i ) + " = " + buildRegexp( c ) + ";"
|
|
|
|
|
) )
|
|
|
|
|
.concat( "", ast.expectations.map(
|
|
|
|
|
( c, i ) => "var " + e( i ) + " = " + buildExpectation( c ) + ";"
|
|
|
|
|
) )
|
|
|
|
|
.concat( "", ast.functions.map(
|
|
|
|
|
( c, i ) => "var " + f( i ) + " = " + buildFunc( c ) + ";"
|
|
|
|
|
) )
|
|
|
|
|
.join( "\n" );
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -179,7 +182,7 @@ function generateJS( ast, options ) {
|
|
|
|
|
"",
|
|
|
|
|
" rule$expectations = cached.expectations;",
|
|
|
|
|
" if (peg$silentFails === 0) {",
|
|
|
|
|
" rule$expectations.map(peg$expect);",
|
|
|
|
|
" rule$expectations.forEach(peg$expect);",
|
|
|
|
|
" }",
|
|
|
|
|
""
|
|
|
|
|
].join( "\n" ) );
|
|
|
|
|