Wrap initializer code in generated parsers into |{...}|

Initializer code is usually indented and this indentation is carried
over to generated code. This resulted in a piece of indented code in the
middle of the parser.

This commit wraps initializer code in |{...}|, which makes indentation
in generated parsers look a bit more natural.
redux
David Majda 10 years ago committed by David Majda
parent 5fd41d444b
commit 46ac1bf171

@ -10,5 +10,6 @@
"noarg": true,
"noempty": true,
"nonew": true,
"trailing": true
"trailing": true,
"-W082": false
}

@ -951,7 +951,7 @@ module.exports = function(ast, options) {
}
if (ast.initializer) {
parts.push(indent4(ast.initializer.code));
parts.push(indent4("{" + ast.initializer.code + "}"));
parts.push('');
}

@ -4836,7 +4836,7 @@ module.exports = (function() {
return s0;
}
{
var OPS_TO_PREFIXED_TYPES = {
"$": "text",
"&": "simple_and",
@ -4883,7 +4883,7 @@ module.exports = (function() {
function buildList(first, rest, index) {
return [first].concat(extractList(rest, index));
}
}
peg$result = peg$startRuleFunction();

Loading…
Cancel
Save