Some cosmetic changes
- Remove unused '__slice' variable - Nicely indent a map/concat chain - 'forEach' instead of 'map' in emitted code
This commit is contained in:
parent
f5b323b401
commit
75a4101622
|
@ -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" ) );
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
const __hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const __slice = Array.prototype.slice;
|
||||
|
||||
const objects = {
|
||||
|
||||
|
|
Loading…
Reference in a new issue