Do not indent backtick quoted strings in code blocks (#492)

* Do not indent backtick quoted strings in initializer or rule action code blocks
* Use const instead of var for ESLint happiness
* Fix ESLint issues for double quotes and indent6
master
Alan Mimms 7 years ago committed by Futago-za Ryuu
parent 57bb28414e
commit 4cdc6d6353

@ -6,9 +6,10 @@ let op = require("../opcodes");
// Generates parser JavaScript code. // Generates parser JavaScript code.
function generateJS(ast, options) { function generateJS(ast, options) {
// These only indent non-empty lines to avoid trailing whitespace. /* These only indent non-empty lines to avoid trailing whitespace. */
function indent2(code) { return code.replace(/^(.+)$/gm, " $1"); } const lineMatchRE = /^([^`\r\n]+?(?:`[^`]*?`[^\r\n]*?)?)$/gm;
function indent10(code) { return code.replace(/^(.+)$/gm, " $1"); } function indent2(code) { return code.replace(lineMatchRE, " $1"); }
function indent10(code) { return code.replace(lineMatchRE, " $1"); }
function generateTables() { function generateTables() {
if (options.optimize === "size") { if (options.optimize === "size") {

Loading…
Cancel
Save