From 8248ba89415809d2497ee2f279675793aef20ae2 Mon Sep 17 00:00:00 2001 From: Joshua Sullivan Date: Thu, 15 Feb 2018 07:25:44 -0800 Subject: [PATCH] pug-lexer `loc` with source endings (#2957) * Ignore VSCode files * Use `loc` on lexer tokens to store source location information * Update pug-parser and pug to use new `loc` attribute on tokens * Update parser test cases to have new `loc` attribute on tokens * New lexer snapshots * New parser snapshots * PR review changes - remove no-ops - rename `attributeName` to `attribute` - attributeName no longer takes a tok and returns a reponse object - minor cleanup --- .gitignore | 1 + packages/pug-lexer/index.js | 536 +- .../test/__snapshots__/index.test.js.snap | 43487 +++++++++++++--- packages/pug-parser/index.js | 196 +- .../test/__snapshots__/index.test.js.snap | 472 +- .../test/cases/attr-es2015.tokens.json | 18 +- .../test/cases/attrs-data.tokens.json | 66 +- .../test/cases/attrs.js.tokens.json | 156 +- .../pug-parser/test/cases/attrs.tokens.json | 360 +- .../test/cases/attrs.unescaped.tokens.json | 30 +- .../pug-parser/test/cases/basic.tokens.json | 18 +- .../pug-parser/test/cases/blanks.tokens.json | 26 +- .../test/cases/block-code.tokens.json | 56 +- .../block-expansion.shorthands.tokens.json | 22 +- .../test/cases/block-expansion.tokens.json | 42 +- .../test/cases/blockquote.tokens.json | 20 +- .../test/cases/blocks-in-blocks.tokens.json | 18 +- .../test/cases/blocks-in-if.tokens.json | 88 +- .../test/cases/case-blocks.tokens.json | 58 +- .../pug-parser/test/cases/case.tokens.json | 108 +- .../test/cases/classes-empty.tokens.json | 30 +- .../pug-parser/test/cases/classes.tokens.json | 48 +- .../test/cases/code.conditionals.tokens.json | 172 +- .../test/cases/code.escape.tokens.json | 12 +- .../test/cases/code.iteration.tokens.json | 142 +- .../pug-parser/test/cases/code.tokens.json | 80 +- .../test/cases/comments-in-case.tokens.json | 52 +- .../test/cases/comments.source.tokens.json | 36 +- .../test/cases/comments.tokens.json | 122 +- .../test/cases/doctype.custom.tokens.json | 4 +- .../test/cases/doctype.default.tokens.json | 22 +- .../test/cases/doctype.keyword.tokens.json | 4 +- .../test/cases/each.else.tokens.json | 176 +- .../test/cases/escape-chars.tokens.json | 12 +- .../test/cases/escape-test.tokens.json | 40 +- .../escaping-class-attribute.tokens.json | 62 +- .../test/cases/filter-in-include.tokens.json | 8 +- .../test/cases/filters-empty.tokens.json | 32 +- .../cases/filters.coffeescript.tokens.json | 42 +- .../test/cases/filters.custom.tokens.json | 42 +- .../cases/filters.include.custom.tokens.json | 34 +- .../test/cases/filters.include.tokens.json | 60 +- .../test/cases/filters.inline.tokens.json | 16 +- .../test/cases/filters.less.tokens.json | 46 +- .../test/cases/filters.markdown.tokens.json | 26 +- .../test/cases/filters.nested.tokens.json | 52 +- .../test/cases/filters.stylus.tokens.json | 40 +- .../test/cases/filters.verbatim.tokens.json | 13 + .../pug-parser/test/cases/html.tokens.json | 52 +- .../pug-parser/test/cases/html5.tokens.json | 40 +- .../include-extends-from-root.tokens.json | 8 +- ...ude-extends-of-common-template.tokens.json | 14 +- .../include-extends-relative.tokens.json | 8 +- .../cases/include-only-text-body.tokens.json | 14 +- .../test/cases/include-only-text.tokens.json | 32 +- .../cases/include-with-text-head.tokens.json | 24 +- .../test/cases/include-with-text.tokens.json | 34 +- .../test/cases/include.script.tokens.json | 20 +- .../cases/include.yield.nested.tokens.json | 22 +- .../cases/includes-with-ext-js.tokens.json | 18 +- .../test/cases/includes.tokens.json | 50 +- .../inheritance.alert-dialog.tokens.json | 26 +- .../cases/inheritance.defaults.tokens.json | 48 +- .../inheritance.extend.include.tokens.json | 56 +- ...nheritance.extend.mixins.block.tokens.json | 18 +- .../inheritance.extend.mixins.tokens.json | 44 +- .../inheritance.extend.recursive.tokens.json | 18 +- .../test/cases/inheritance.extend.tokens.json | 40 +- .../inheritance.extend.whitespace.tokens.json | 40 +- .../test/cases/inheritance.tokens.json | 40 +- .../cases/inline-block-comment.tokens.json | 20 +- .../test/cases/inline-tag.tokens.json | 154 +- .../cases/intepolated-elements.tokens.json | 76 +- .../test/cases/interpolated-mixin.tokens.json | 30 +- .../cases/interpolation.escape.tokens.json | 30 +- .../test/cases/layout.append.tokens.json | 34 +- .../layout.append.without-block.tokens.json | 34 +- ...out.multi.append.prepend.block.tokens.json | 92 +- .../test/cases/layout.prepend.tokens.json | 34 +- .../layout.prepend.without-block.tokens.json | 34 +- .../cases/mixin-at-end-of-file.tokens.json | 18 +- .../cases/mixin-block-with-space.tokens.json | 24 +- .../test/cases/mixin-hoist.tokens.json | 28 +- .../test/cases/mixin-via-include.tokens.json | 14 +- .../test/cases/mixin.attrs.tokens.json | 322 +- .../mixin.block-tag-behaviour.tokens.json | 112 +- .../test/cases/mixin.blocks.tokens.json | 216 +- .../test/cases/mixin.merge.tokens.json | 116 +- .../test/cases/mixins-unused.tokens.json | 14 +- .../test/cases/mixins.rest-args.tokens.json | 28 +- .../pug-parser/test/cases/mixins.tokens.json | 130 +- .../test/cases/namespaces.tokens.json | 16 +- .../pug-parser/test/cases/nesting.tokens.json | 46 +- .../test/cases/pipeless-comments.tokens.json | 18 +- .../test/cases/pipeless-filters.tokens.json | 18 +- .../test/cases/pipeless-tag.tokens.json | 28 +- .../pug-parser/test/cases/pre.tokens.json | 50 +- .../pug-parser/test/cases/quotes.tokens.json | 12 +- .../test/cases/regression.1794.tokens.json | 18 +- .../test/cases/regression.784.tokens.json | 10 +- .../test/cases/script.whitespace.tokens.json | 28 +- .../test/cases/scripts.non-js.tokens.json | 58 +- .../pug-parser/test/cases/scripts.tokens.json | 40 +- .../test/cases/self-closing-html.tokens.json | 22 +- .../test/cases/single-period.tokens.json | 6 +- .../pug-parser/test/cases/source.tokens.json | 42 +- .../pug-parser/test/cases/styles.tokens.json | 128 +- .../test/cases/tag-blocks.tokens.json | 32 +- .../test/cases/tag.interpolation.tokens.json | 132 +- .../test/cases/tags.self-closing.tokens.json | 120 +- .../test/cases/template.tokens.json | 54 +- .../test/cases/text-block.tokens.json | 40 +- .../pug-parser/test/cases/text.tokens.json | 182 +- .../pug-parser/test/cases/utf8bom.tokens.json | 8 +- .../pug-parser/test/cases/vars.tokens.json | 20 +- .../pug-parser/test/cases/while.tokens.json | 26 +- .../pug-parser/test/cases/xml.tokens.json | 22 +- .../yield-before-conditional-head.tokens.json | 36 +- .../yield-before-conditional.tokens.json | 40 +- .../test/cases/yield-head.tokens.json | 30 +- .../test/cases/yield-title-head.tokens.json | 34 +- .../test/cases/yield-title.tokens.json | 24 +- .../pug-parser/test/cases/yield.tokens.json | 40 +- packages/pug/lib/index.js | 3 +- 124 files changed, 39452 insertions(+), 11360 deletions(-) create mode 100644 packages/pug-parser/test/cases/filters.verbatim.tokens.json diff --git a/.gitignore b/.gitignore index e2e102653..09cffd2c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .DS_Store .idea +.vscode testing node_modules lib-cov diff --git a/packages/pug-lexer/index.js b/packages/pug-lexer/index.js index c4f3db5c3..434e3a048 100644 --- a/packages/pug-lexer/index.js +++ b/packages/pug-lexer/index.js @@ -41,6 +41,7 @@ function Lexer(str, options) { this.indentRe = null; // If #{}, !{} or #[] syntax is allowed when adding text this.interpolationAllowed = true; + this.whitespaceRe = /[ \n\t]/; this.tokens = []; this.ended = false; @@ -106,12 +107,37 @@ Lexer.prototype = { */ tok: function(type, val){ - var res = {type: type, line: this.lineno, col: this.colno}; + var res = { + type: type, + loc: { + start: { + line: this.lineno, + column: this.colno + }, + filename: this.filename + } + }; if (val !== undefined) res.val = val; return res; }, + + /** + * Set the token's `loc.end` value. + * + * @param {Object} tok + * @returns {Object} + * @api private + */ + + tokEnd: function(tok){ + tok.loc.end = { + line: this.lineno, + column: this.colno + }; + return tok; + }, /** * Increment `this.lineno` and reset `this.colno`. @@ -275,9 +301,9 @@ Lexer.prototype = { this.error('NO_END_BRACKET', 'End of line was reached with no closing bracket for interpolation.'); } for (var i = 0; this.indentStack[i]; i++) { - this.tokens.push(this.tok('outdent')); + this.tokens.push(this.tokEnd(this.tok('outdent'))); } - this.tokens.push(this.tok('eos')); + this.tokens.push(this.tokEnd(this.tok('eos'))); this.ended = true; return true; }, @@ -308,6 +334,7 @@ Lexer.prototype = { this.interpolationAllowed = tok.buffer; this.tokens.push(tok); this.incrementColumn(captures[0].length); + this.tokEnd(tok); this.callLexerFunction('pipelessText'); return true; } @@ -330,6 +357,7 @@ Lexer.prototype = { var lines = splitted.length - 1; this.incrementLine(lines); this.incrementColumn(splitted[lines].length + 1); // + 1 → '}' + this.tokEnd(tok); return true; } }, @@ -347,6 +375,7 @@ Lexer.prototype = { tok = this.tok('tag', name); this.tokens.push(tok); this.incrementColumn(len); + this.tokEnd(tok); return true; } }, @@ -361,6 +390,7 @@ Lexer.prototype = { if (tok) { this.tokens.push(tok); this.incrementColumn(tok.val.length); + this.tokEnd(tok); this.callLexerFunction('attrs'); if (!inInclude) { this.interpolationAllowed = false; @@ -377,7 +407,7 @@ Lexer.prototype = { doctype: function() { var node = this.scanEndOfLine(/^doctype *([^\n]*)/, 'doctype'); if (node) { - this.tokens.push(node); + this.tokens.push(this.tokEnd(node)); return true; } }, @@ -391,6 +421,7 @@ Lexer.prototype = { if (tok) { this.tokens.push(tok); this.incrementColumn(tok.val.length); + this.tokEnd(tok); return true; } if (/^#/.test(this.input)) { @@ -407,6 +438,7 @@ Lexer.prototype = { if (tok) { this.tokens.push(tok); this.incrementColumn(tok.val.length); + this.tokEnd(tok); return true; } if (/^\.[_a-z0-9\-]+/i.test(this.input)) { @@ -428,8 +460,10 @@ Lexer.prototype = { } }, addText: function (type, value, prefix, escaped) { + var tok; if (value + prefix === '') return; prefix = prefix || ''; + escaped = escaped || 0; var indexOfEnd = this.interpolated ? value.indexOf(']') : -1; var indexOfStart = this.interpolationAllowed ? value.indexOf('#[') : -1; var indexOfEscaped = this.interpolationAllowed ? value.indexOf('\\#[') : -1; @@ -442,14 +476,15 @@ Lexer.prototype = { if (indexOfEscaped !== Infinity && indexOfEscaped < indexOfEnd && indexOfEscaped < indexOfStart && indexOfEscaped < indexOfStringInterp) { prefix = prefix + value.substring(0, indexOfEscaped) + '#['; - return this.addText(type, value.substring(indexOfEscaped + 3), prefix, true); + return this.addText(type, value.substring(indexOfEscaped + 3), prefix, escaped + 1); } if (indexOfStart !== Infinity && indexOfStart < indexOfEnd && indexOfStart < indexOfEscaped && indexOfStart < indexOfStringInterp) { - this.tokens.push(this.tok(type, prefix + value.substring(0, indexOfStart))); - this.incrementColumn(prefix.length + indexOfStart); - if (escaped) this.incrementColumn(1); - this.tokens.push(this.tok('start-pug-interpolation')); + tok = this.tok(type, prefix + value.substring(0, indexOfStart)); + this.incrementColumn(prefix.length + indexOfStart + escaped); + this.tokens.push(this.tokEnd(tok)); + tok = this.tok('start-pug-interpolation'); this.incrementColumn(2); + this.tokens.push(this.tokEnd(tok)); var child = new this.constructor(value.substr(indexOfStart + 2), { filename: this.filename, interpolated: true, @@ -468,8 +503,9 @@ Lexer.prototype = { } this.colno = child.colno; this.tokens = this.tokens.concat(interpolated); - this.tokens.push(this.tok('end-pug-interpolation')); + tok = this.tok('end-pug-interpolation'); this.incrementColumn(1); + this.tokens.push(this.tokEnd(tok)); this.addText(type, child.input); return; } @@ -484,18 +520,19 @@ Lexer.prototype = { if (indexOfStringInterp !== Infinity) { if (matchOfStringInterp[1]) { prefix = prefix + value.substring(0, indexOfStringInterp) + '#{'; - return this.addText(type, value.substring(indexOfStringInterp + 3), prefix); + return this.addText(type, value.substring(indexOfStringInterp + 3), prefix, escaped + 1); } var before = value.substr(0, indexOfStringInterp); if (prefix || before) { before = prefix + before; - this.tokens.push(this.tok(type, before)); - this.incrementColumn(before.length); + tok = this.tok(type, before); + this.incrementColumn(before.length + escaped); + this.tokens.push(this.tokEnd(tok)); } var rest = matchOfStringInterp[3]; var range; - var tok = this.tok('interpolated-code'); + tok = this.tok('interpolated-code'); this.incrementColumn(2); try { range = characterParser.parseUntil(rest, '}'); @@ -515,21 +552,23 @@ Lexer.prototype = { tok.buffer = true; tok.val = range.src; this.assertExpression(range.src); - this.tokens.push(tok); if (range.end + 1 < rest.length) { rest = rest.substr(range.end + 1); this.incrementColumn(range.end + 1); + this.tokens.push(this.tokEnd(tok)); this.addText(type, rest); } else { this.incrementColumn(rest.length); + this.tokens.push(this.tokEnd(tok)); } return; } value = prefix + value; - this.tokens.push(this.tok(type, value)); - this.incrementColumn(value.length); + tok = this.tok(type, value); + this.incrementColumn(value.length + escaped); + this.tokens.push(this.tokEnd(tok)); }, text: function() { @@ -557,7 +596,7 @@ Lexer.prototype = { dot: function() { var tok; if (tok = this.scanEndOfLine(/^\./, 'dot')) { - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); this.callLexerFunction('pipelessText'); return true; } @@ -570,7 +609,7 @@ Lexer.prototype = { "extends": function() { var tok = this.scan(/^extends?(?= |$|\n)/, 'extends'); if (tok) { - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); if (!this.callLexerFunction('path')) { this.error('NO_EXTENDS_PATH', 'missing path for extends'); } @@ -595,10 +634,14 @@ Lexer.prototype = { name = name.split('//')[0].trim(); } if (!name) return; - this.consume(captures[0].length - comment.length); var tok = this.tok('block', name); + var len = captures[0].length - comment.length; + while(this.whitespaceRe.test(this.input.charAt(len - 1))) len--; + this.incrementColumn(len); tok.mode = 'prepend'; - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); + this.consume(captures[0].length - comment.length); + this.incrementColumn(captures[0].length - comment.length - len); return true; } }, @@ -617,10 +660,14 @@ Lexer.prototype = { name = name.split('//')[0].trim(); } if (!name) return; - this.consume(captures[0].length - comment.length); var tok = this.tok('block', name); + var len = captures[0].length - comment.length; + while(this.whitespaceRe.test(this.input.charAt(len - 1))) len--; + this.incrementColumn(len); tok.mode = 'append'; - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); + this.consume(captures[0].length - comment.length); + this.incrementColumn(captures[0].length - comment.length - len); return true; } }, @@ -639,10 +686,14 @@ Lexer.prototype = { name = name.split('//')[0].trim(); } if (!name) return; - this.consume(captures[0].length - comment.length); var tok = this.tok('block', name); + var len = captures[0].length - comment.length; + while(this.whitespaceRe.test(this.input.charAt(len - 1))) len--; + this.incrementColumn(len); tok.mode = 'replace'; - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); + this.consume(captures[0].length - comment.length); + this.incrementColumn(captures[0].length - comment.length - len); return true; } }, @@ -654,7 +705,7 @@ Lexer.prototype = { mixinBlock: function() { var tok; if (tok = this.scanEndOfLine(/^block/, 'mixin-block')) { - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); return true; } }, @@ -666,7 +717,7 @@ Lexer.prototype = { 'yield': function() { var tok = this.scanEndOfLine(/^yield/, 'yield'); if (tok) { - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); return true; } }, @@ -678,7 +729,7 @@ Lexer.prototype = { include: function() { var tok = this.scan(/^include(?=:| |$|\n)/, 'include'); if (tok) { - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); while (this.callLexerFunction('filter', { inInclude: true })); if (!this.callLexerFunction('path')) { if (/^[^ \n]+/.test(this.input)) { @@ -703,7 +754,7 @@ Lexer.prototype = { path: function() { var tok = this.scanEndOfLine(/^ ([^\n]+)/, 'path'); if (tok && (tok.val = tok.val.trim())) { - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); return true; } }, @@ -718,7 +769,7 @@ Lexer.prototype = { this.incrementColumn(-tok.val.length); this.assertExpression(tok.val); this.incrementColumn(tok.val.length); - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); return true; } if (this.scan(/^case\b/)) { @@ -747,7 +798,7 @@ Lexer.prototype = { this.incrementColumn(-tok.val.length); this.assertExpression(tok.val); this.incrementColumn(tok.val.length); - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); return true; } if (this.scan(/^when\b/)) { @@ -762,7 +813,7 @@ Lexer.prototype = { "default": function() { var tok = this.scanEndOfLine(/^default/, 'default'); if (tok) { - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); return true; } if (this.scan(/^default\b/)) { @@ -813,7 +864,7 @@ Lexer.prototype = { } } } - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); return true; } }, @@ -828,7 +879,8 @@ Lexer.prototype = { this.consume(captures[0].length); var tok = this.tok('mixin', captures[1]); tok.args = captures[2] || null; - this.tokens.push(tok); + this.incrementColumn(captures[0].length); + this.tokens.push(this.tokEnd(tok)); return true; } }, @@ -866,7 +918,8 @@ Lexer.prototype = { } break; } - this.tokens.push(tok); + this.incrementColumn(js.length); + this.tokens.push(this.tokEnd(tok)); return true; } }, @@ -876,11 +929,13 @@ Lexer.prototype = { */ "while": function() { - var captures; + var captures, tok; if (captures = /^while +([^\n]+)/.exec(this.input)) { this.consume(captures[0].length); - this.assertExpression(captures[1]) - this.tokens.push(this.tok('while', captures[1])); + this.assertExpression(captures[1]); + tok = this.tok('while', captures[1]); + this.incrementColumn(captures[0].length); + this.tokens.push(this.tokEnd(tok)); return true; } if (this.scan(/^while\b/)) { @@ -902,7 +957,7 @@ Lexer.prototype = { this.assertExpression(captures[3]) tok.code = captures[3]; this.incrementColumn(captures[3].length); - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); return true; } if (this.scan(/^(?:each|for)\b/)) { @@ -980,6 +1035,7 @@ Lexer.prototype = { // --- code // ^ after colno this.incrementColumn(code.length); + this.tokEnd(tok); return true; } }, @@ -990,172 +1046,242 @@ Lexer.prototype = { blockCode: function() { var tok if (tok = this.scanEndOfLine(/^-/, 'blockcode')) { - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); this.interpolationAllowed = false; this.callLexerFunction('pipelessText'); return true; } }, - + /** - * Attributes. + * Attribute Name. */ - - attrs: function() { - if ('(' == this.input.charAt(0)) { - var startingLine = this.lineno; - this.tokens.push(this.tok('start-attributes')); - var index = this.bracketExpression().end - , str = this.input.substr(1, index-1); - + attribute: function(str){ + var quote = ''; + var quoteRe = /['"]/; + var key = ''; + var i; + + // consume all whitespace before the key + for(i = 0; i < str.length; i++){ + if(!this.whitespaceRe.test(str[i])) break; + if(str[i] === '\n'){ + this.incrementLine(1); + } else { + this.incrementColumn(1); + } + } + + if(i === str.length){ + return ''; + } + + var tok = this.tok('attribute'); + + // quote? + if(quoteRe.test(str[i])){ + quote = str[i]; this.incrementColumn(1); - this.assertNestingCorrect(str); - - var quote = ''; - var self = this; - - this.consume(index + 1); - - var whitespaceRe = /[ \n\t]/; - var quoteRe = /['"]/; - - var escapedAttr = false - var key = ''; - var val = ''; - var state = characterParser.defaultState(); - var lineno = startingLine; - var colnoBeginAttr = this.colno; - var colnoBeginVal; - var loc = 'key'; - var isEndOfAttribute = function (i) { - // if the key is not started, then the attribute cannot be ended - if (key.trim() === '') { - colnoBeginAttr = this.colno; - return false; + i++; + } + + // start looping through the key + for (; i < str.length; i++) { + + if(quote){ + if (str[i] === quote) { + this.incrementColumn(1); + i++; + break; } - // if there's nothing more then the attribute must be ended - if (i === str.length) return true; - - if (loc === 'key') { - if (whitespaceRe.test(str[i])) { - // find the first non-whitespace character - for (var x = i; x < str.length; x++) { - if (!whitespaceRe.test(str[x])) { - // starts a `value` - if (str[x] === '=' || str[x] === '!') return false; - // will be handled when x === i - else if (str[x] === ',') return false; - // attribute ended - else return true; + } else { + if(this.whitespaceRe.test(str[i]) || str[i] === '!' || str[i] === '=' || str[i] === ',') { + break; + } + } + + key += str[i]; + + if (str[i] === '\n') { + this.incrementLine(1); + } else { + this.incrementColumn(1); + } + } + + tok.name = key; + + var valueResponse = this.attributeValue(str.substr(i)); + + if (valueResponse.val) { + tok.val = valueResponse.val; + tok.mustEscape = valueResponse.mustEscape; + } else { + // was a boolean attribute (ex: `input(disabled)`) + tok.val = true; + tok.mustEscape = true; + } + + str = valueResponse.remainingSource; + + this.tokens.push(this.tokEnd(tok)); + + for(i = 0; i < str.length; i++){ + if(!this.whitespaceRe.test(str[i])) { + break; + } + if(str[i] === '\n'){ + this.incrementLine(1); + } else { + this.incrementColumn(1); + } + } + + if(str[i] === ','){ + this.incrementColumn(1); + i++; + } + + return str.substr(i); + }, + + /** + * Attribute Value. + */ + attributeValue: function(str){ + var quoteRe = /['"]/; + var val = ''; + var done, i, x; + var escapeAttr = true; + var state = characterParser.defaultState(); + var col = this.colno; + var line = this.lineno; + + // consume all whitespace before the equals sign + for(i = 0; i < str.length; i++){ + if(!this.whitespaceRe.test(str[i])) break; + if(str[i] === '\n'){ + line++; + col = 1; + } else { + col++; + } + } + + if(i === str.length){ + return { remainingSource: str }; + } + + if(str[i] === '!'){ + escapeAttr = false; + col++; + i++; + if (str[i] !== '=') this.error('INVALID_KEY_CHARACTER', 'Unexpected character ' + str[i] + ' expected `=`'); + } + + if(str[i] !== '='){ + // check for anti-pattern `div("foo"bar)` + if (i === 0 && str && !this.whitespaceRe.test(str[0]) && str[0] !== ','){ + this.error('INVALID_KEY_CHARACTER', 'Unexpected character ' + str[0] + ' expected `=`'); + } else { + return { remainingSource: str }; + } + } + + this.lineno = line; + this.colno = col + 1; + i++; + + // consume all whitespace before the value + for(; i < str.length; i++){ + if(!this.whitespaceRe.test(str[i])) break; + if(str[i] === '\n'){ + this.incrementLine(1); + } else { + this.incrementColumn(1); + } + } + + line = this.lineno; + col = this.colno; + + // start looping through the value + for (; i < str.length; i++) { + // if the character is in a string or in parentheses/brackets/braces + if (!(state.isNesting() || state.isString())){ + + if (this.whitespaceRe.test(str[i])) { + done = false; + + // find the first non-whitespace character + for (x = i; x < str.length; x++) { + if (!this.whitespaceRe.test(str[x])) { + // if it is a JavaScript punctuator, then assume that it is + // a part of the value + if((!characterParser.isPunctuator(str[x]) || quoteRe.test(str[x]) || str[x] === ':') && this.assertExpression(val, true)){ + done = true; } + break; } } - // if there's no whitespace and the character is not ',', the - // attribute did not end. - return str[i] === ','; - } else if (loc === 'value') { - // if the character is in a string or in parentheses/brackets/braces - if (state.isNesting() || state.isString()) return false; - - // if the current value expression is not valid JavaScript, then - // assume that the user did not end the value. To enforce this, - // we call `self.assertExpression(val, true)`, but since the other - // tests are much faster, we run the other tests first. - - if (whitespaceRe.test(str[i])) { - // find the first non-whitespace character - for (var x = i; x < str.length; x++) { - if (!whitespaceRe.test(str[x])) { - // if it is a JavaScript punctuator, then assume that it is - // a part of the value - return (!characterParser.isPunctuator(str[x]) || quoteRe.test(str[x]) || str[x] === ':') && self.assertExpression(val, true); - } - } + + // if everything else is whitespace, return now so last attribute + // does not include trailing whitespace + if(done || x === str.length){ + break; } - // if there's no whitespace and the character is not ',', the - // attribute did not end. - return str[i] === ',' && self.assertExpression(val, true); + } + + // if there's no whitespace and the character is not ',', the + // attribute did not end. + if(str[i] === ',' && this.assertExpression(val, true)){ + break; } } + + state = characterParser.parseChar(str[i], state); + val += str[i]; + + if (str[i] === '\n') { + line++; + col = 1; + } else { + col++; + } + } + + this.assertExpression(val); + + this.lineno = line; + this.colno = col; + + return { val: val, mustEscape: escapeAttr, remainingSource: str.substr(i) }; + }, - for (var i = 0; i <= str.length; i++) { - if (isEndOfAttribute.call(this, i)) { - if (val.trim()) { - var saved = this.colno; - this.colno = colnoBeginVal; - this.assertExpression(val); - this.colno = saved; - } - - val = val.trim(); - - key = key.trim(); - key = key.replace(/^['"]|['"]$/g, ''); + /** + * Attributes. + */ + + attrs: function() { + var tok; + + if ('(' == this.input.charAt(0)) { + tok = this.tok('start-attributes'); + var index = this.bracketExpression().end; + var str = this.input.substr(1, index-1); - var tok = this.tok('attribute'); - tok.name = key; - tok.val = '' == val ? true : val; - tok.col = colnoBeginAttr; - tok.mustEscape = escapedAttr; - this.tokens.push(tok); + this.incrementColumn(1); + this.tokens.push(this.tokEnd(tok)); + this.assertNestingCorrect(str); + this.consume(index + 1); - key = val = ''; - loc = 'key'; - escapedAttr = false; - this.lineno = lineno; - } else { - switch (loc) { - case 'key-char': - if (str[i] === quote) { - loc = 'key'; - if (i + 1 < str.length && !/[ ,!=\n\t]/.test(str[i + 1])) - this.error('INVALID_KEY_CHARACTER', 'Unexpected character "' + str[i + 1] + '" expected ` `, `\\n`, `\t`, `,`, `!` or `=`'); - } else { - key += str[i]; - } - break; - case 'key': - if (key === '' && quoteRe.test(str[i])) { - loc = 'key-char'; - quote = str[i]; - } else if (str[i] === '!' || str[i] === '=') { - escapedAttr = str[i] !== '!'; - if (str[i] === '!') { - this.incrementColumn(1); - i++; - } - if (str[i] !== '=') this.error('INVALID_KEY_CHARACTER', 'Unexpected character ' + str[i] + ' expected `=`'); - loc = 'value'; - colnoBeginVal = this.colno + 1; - state = characterParser.defaultState(); - } else { - key += str[i] - } - break; - case 'value': - state = characterParser.parseChar(str[i], state); - val += str[i]; - break; - } - } - if (str[i] === '\n') { - // Save the line number locally to keep this.lineno at the start of - // the attribute. - lineno++; - this.colno = 1; - // If the key has not been started, update this.lineno immediately. - if (!key.trim()) this.lineno = lineno; - } else if (str[i] !== undefined) { - this.incrementColumn(1); - } + while(str){ + str = this.attribute(str); } - // Reset the line numbers based on the line started on - // plus the number of newline characters encountered - this.lineno = startingLine + (str.match(/\n/g) || []).length; - - this.tokens.push(this.tok('end-attributes')); + tok = this.tok('end-attributes'); this.incrementColumn(1); + this.tokens.push(this.tokEnd(tok)); return true; } }, @@ -1173,8 +1299,8 @@ Lexer.prototype = { consumed = args.end + 1; this.consume(consumed); tok.val = args.src; - this.tokens.push(tok); this.incrementColumn(consumed); + this.tokens.push(this.tokEnd(tok)); return true; } }, @@ -1185,6 +1311,7 @@ Lexer.prototype = { indent: function() { var captures = this.scanIndentation(); + var tok; if (captures) { var indents = captures[1].length; @@ -1199,28 +1326,36 @@ Lexer.prototype = { // blank line if ('\n' == this.input[0]) { this.interpolationAllowed = true; - return this.tok('newline'); + return this.tokEnd(this.tok('newline')); } // outdent if (indents < this.indentStack[0]) { + var outdent_count = 0; while (this.indentStack[0] > indents) { if (this.indentStack[1] < indents) { this.error('INCONSISTENT_INDENTATION', 'Inconsistent indentation. Expecting either ' + this.indentStack[1] + ' or ' + this.indentStack[0] + ' spaces/tabs.'); } - this.colno = this.indentStack[1] + 1; - this.tokens.push(this.tok('outdent')); + outdent_count++; this.indentStack.shift(); } + while(outdent_count--){ + this.colno = 1; + tok = this.tok('outdent'); + this.colno = this.indentStack[0] + 1; + this.tokens.push(this.tokEnd(tok)); + } // indent } else if (indents && indents != this.indentStack[0]) { - this.tokens.push(this.tok('indent', indents)); + tok = this.tok('indent', indents); this.colno = 1 + indents; + this.tokens.push(this.tokEnd(tok)); this.indentStack.unshift(indents); // newline } else { - this.tokens.push(this.tok('newline')); - this.colno = 1 + (this.indentStack[0] || 0); + tok = this.tok('newline'); + this.colno = 1 + Math.min(this.indentStack[0] || 0, indents); + this.tokens.push(this.tokEnd(tok)); } this.interpolationAllowed = true; @@ -1235,8 +1370,9 @@ Lexer.prototype = { indents = indents || captures && captures[1].length; if (indents > this.indentStack[0]) { - this.tokens.push(this.tok('start-pipeless-text')); + this.tokens.push(this.tokEnd(this.tok('start-pipeless-text'))); var tokens = []; + var token_indent = []; var isMatch; // Index in this.input. Can't use this.consume because we might need to // retry lexing the block. @@ -1248,7 +1384,9 @@ Lexer.prototype = { var str = this.input.substr(stringPtr + 1, i); var lineCaptures = this.indentRe.exec('\n' + str); var lineIndents = lineCaptures && lineCaptures[1].length; - isMatch = lineIndents >= indents || !str.trim(); + isMatch = lineIndents >= indents; + token_indent.push(isMatch); + isMatch = isMatch || !str.trim(); if (isMatch) { // consume test along with `\n` prefix if match stringPtr += str.length + 1; @@ -1263,12 +1401,14 @@ Lexer.prototype = { this.consume(stringPtr); while (this.input.length === 0 && tokens[tokens.length - 1] === '') tokens.pop(); tokens.forEach(function (token, i) { + var tok; this.incrementLine(1); - if (i !== 0) this.tokens.push(this.tok('newline')); - this.incrementColumn(indents); + if (i !== 0) tok = this.tok('newline'); + if (token_indent[i]) this.incrementColumn(indents); + if (tok) this.tokens.push(this.tokEnd(tok)); this.addText('text', token); }.bind(this)); - this.tokens.push(this.tok('end-pipeless-text')); + this.tokens.push(this.tokEnd(this.tok('end-pipeless-text'))); return true; } }, @@ -1280,7 +1420,7 @@ Lexer.prototype = { slash: function() { var tok = this.scan(/^\//, 'slash'); if (tok) { - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); return true; } }, @@ -1292,7 +1432,7 @@ Lexer.prototype = { colon: function() { var tok = this.scan(/^: +/, ':'); if (tok) { - this.tokens.push(tok); + this.tokens.push(this.tokEnd(tok)); return true; } }, diff --git a/packages/pug-lexer/test/__snapshots__/index.test.js.snap b/packages/pug-lexer/test/__snapshots__/index.test.js.snap index 368020744..0484b309b 100644 --- a/packages/pug-lexer/test/__snapshots__/index.test.js.snap +++ b/packages/pug-lexer/test/__snapshots__/index.test.js.snap @@ -2,55 +2,136 @@ exports[`test attr-es2015.pug 1`] = ` Array [ Object { "buffer": false, - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/attr-es2015.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "mustEscape": false, "type": "code", "val": "var avatar = \'219b77f9d21de75e81851b6b886057c7\'", }, Object { - "col": 1, - "line": 3, - "type": "newline", - }, - Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attr-es2015.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attr-es2015.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "type": "tag", "val": "div", }, Object { - "col": 4, - "line": 3, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attr-es2015.pug", + "start": Object { + "column": 4, + "line": 3, + }, + }, "type": "class", "val": "avatar-div", }, Object { - "col": 15, - "line": 3, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attr-es2015.pug", + "start": Object { + "column": 15, + "line": 3, + }, + }, "type": "start-attributes", }, Object { - "col": 16, - "line": 3, + "loc": Object { + "end": Object { + "column": 88, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attr-es2015.pug", + "start": Object { + "column": 16, + "line": 3, + }, + }, "mustEscape": true, "name": "style", "type": "attribute", "val": "\`background-image: url(https://www.gravatar.com/avatar/\${avatar})\`", }, Object { - "col": 88, - "line": 3, + "loc": Object { + "end": Object { + "column": 89, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attr-es2015.pug", + "start": Object { + "column": 88, + "line": 3, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 4, - "type": "newline", - }, - Object { - "col": 1, - "line": 4, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attr-es2015.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attr-es2015.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, "type": "eos", }, ] @@ -69,474 +150,1176 @@ exports[`test attrs.js.pug 1`] = ` Array [ Object { "buffer": false, - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "mustEscape": false, "type": "code", "val": "var id = 5", }, Object { - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "type": "newline", }, Object { "buffer": false, - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "mustEscape": false, "type": "code", "val": "function answer() { return 42; }", }, Object { - "col": 1, - "line": 3, - "type": "newline", - }, - Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 3, + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 2, + "line": 3, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 3, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 3, + "line": 3, + }, + }, "mustEscape": true, "name": "href", "type": "attribute", "val": "\'/user/\' + id", }, Object { - "col": 23, - "line": 3, + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 23, + "line": 3, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "\'button\'", }, Object { - "col": 37, - "line": 3, + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 37, + "line": 3, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 4, - "type": "newline", - }, - Object { - "col": 1, - "line": 4, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 4, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 2, + "line": 4, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 4, + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 3, + "line": 4, + }, + }, "mustEscape": true, "name": "href", "type": "attribute", "val": "\'/user/\' + id", }, Object { - "col": 27, - "line": 4, + "loc": Object { + "end": Object { + "column": 45, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 27, + "line": 4, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "\'button\'", }, Object { - "col": 45, - "line": 4, + "loc": Object { + "end": Object { + "column": 46, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 45, + "line": 4, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 5, - "type": "newline", - }, - Object { - "col": 1, - "line": 5, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, "type": "tag", "val": "meta", }, Object { - "col": 5, - "line": 5, + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 5, + "line": 5, + }, + }, "type": "start-attributes", }, Object { - "col": 6, - "line": 5, + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 6, + "line": 5, + }, + }, "mustEscape": true, "name": "key", "type": "attribute", "val": "\'answer\'", }, Object { - "col": 20, - "line": 5, + "loc": Object { + "end": Object { + "column": 34, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 20, + "line": 5, + }, + }, "mustEscape": true, "name": "value", "type": "attribute", "val": "answer()", }, Object { - "col": 34, - "line": 5, + "loc": Object { + "end": Object { + "column": 35, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 34, + "line": 5, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 6, - "type": "newline", - }, - Object { - "col": 1, - "line": 6, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 6, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 6, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 6, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 2, + "line": 6, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 6, + "loc": Object { + "end": Object { + "column": 31, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 3, + "line": 6, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "[\'class1\', \'class2\']", }, Object { - "col": 31, - "line": 6, + "loc": Object { + "end": Object { + "column": 32, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 31, + "line": 6, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 7, - "type": "newline", - }, - Object { - "col": 1, - "line": 7, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 7, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 7, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 7, + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 2, + "line": 7, + }, + }, "type": "class", "val": "tag-class", }, Object { - "col": 12, - "line": 7, + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 12, + "line": 7, + }, + }, "type": "start-attributes", }, Object { - "col": 13, - "line": 7, + "loc": Object { + "end": Object { + "column": 41, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 13, + "line": 7, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "[\'class1\', \'class2\']", }, Object { - "col": 41, - "line": 7, + "loc": Object { + "end": Object { + "column": 42, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 41, + "line": 7, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 9, - "type": "newline", - }, - Object { - "col": 1, - "line": 9, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 9, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 9, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 9, + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 2, + "line": 9, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 9, + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 3, + "line": 9, + }, + }, "mustEscape": true, "name": "href", "type": "attribute", "val": "\'/user/\' + id", }, Object { - "col": 22, - "line": 9, + "loc": Object { + "end": Object { + "column": 36, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 22, + "line": 9, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "\'button\'", }, Object { - "col": 36, - "line": 9, + "loc": Object { + "end": Object { + "column": 37, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 36, + "line": 9, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 10, - "type": "newline", - }, - Object { - "col": 1, - "line": 10, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 10, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 10, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 10, + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 2, + "line": 10, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 10, + "loc": Object { + "end": Object { + "column": 25, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 3, + "line": 10, + }, + }, "mustEscape": true, "name": "href", "type": "attribute", "val": "\'/user/\' + id", }, Object { - "col": 26, - "line": 10, + "loc": Object { + "end": Object { + "column": 44, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 26, + "line": 10, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "\'button\'", }, Object { - "col": 44, - "line": 10, + "loc": Object { + "end": Object { + "column": 45, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 44, + "line": 10, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 11, - "type": "newline", - }, - Object { - "col": 1, - "line": 11, + "loc": Object { + "end": Object { + "column": 1, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 11, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 11, + }, + }, "type": "tag", "val": "meta", }, Object { - "col": 5, - "line": 11, + "loc": Object { + "end": Object { + "column": 6, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 5, + "line": 11, + }, + }, "type": "start-attributes", }, Object { - "col": 6, - "line": 11, + "loc": Object { + "end": Object { + "column": 18, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 6, + "line": 11, + }, + }, "mustEscape": true, "name": "key", "type": "attribute", "val": "\'answer\'", }, Object { - "col": 19, - "line": 11, + "loc": Object { + "end": Object { + "column": 33, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 19, + "line": 11, + }, + }, "mustEscape": true, "name": "value", "type": "attribute", "val": "answer()", }, Object { - "col": 33, - "line": 11, + "loc": Object { + "end": Object { + "column": 34, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 33, + "line": 11, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 12, - "type": "newline", - }, - Object { - "col": 1, - "line": 12, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 12, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 12, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 12, + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 2, + "line": 12, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 12, + "loc": Object { + "end": Object { + "column": 31, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 3, + "line": 12, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "[\'class1\', \'class2\']", }, Object { - "col": 31, - "line": 12, + "loc": Object { + "end": Object { + "column": 32, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 31, + "line": 12, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 13, - "type": "newline", - }, - Object { - "col": 1, - "line": 13, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 13, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 13, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 13, + "loc": Object { + "end": Object { + "column": 12, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 2, + "line": 13, + }, + }, "type": "class", "val": "tag-class", }, Object { - "col": 12, - "line": 13, + "loc": Object { + "end": Object { + "column": 13, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 12, + "line": 13, + }, + }, "type": "start-attributes", }, Object { - "col": 13, - "line": 13, + "loc": Object { + "end": Object { + "column": 41, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 13, + "line": 13, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "[\'class1\', \'class2\']", }, Object { - "col": 41, - "line": 13, + "loc": Object { + "end": Object { + "column": 42, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 41, + "line": 13, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 15, - "type": "newline", - }, - Object { - "col": 1, - "line": 15, + "loc": Object { + "end": Object { + "column": 1, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 15, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 15, + }, + }, "type": "tag", "val": "div", }, Object { - "col": 4, - "line": 15, + "loc": Object { + "end": Object { + "column": 5, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 4, + "line": 15, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 15, + "loc": Object { + "end": Object { + "column": 10, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 5, + "line": 15, + }, + }, "mustEscape": true, "name": "id", "type": "attribute", "val": "id", }, Object { - "col": 10, - "line": 15, + "loc": Object { + "end": Object { + "column": 11, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 10, + "line": 15, + }, + }, "type": "end-attributes", }, Object { - "col": 11, - "line": 15, + "loc": Object { + "end": Object { + "column": 36, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 11, + "line": 15, + }, + }, "type": "&attributes", "val": "{foo: \'bar\'}", }, Object { - "col": 1, - "line": 16, + "loc": Object { + "end": Object { + "column": 1, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 16, + }, + }, "type": "newline", }, Object { "buffer": false, - "col": 1, - "line": 16, + "loc": Object { + "end": Object { + "column": 17, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 16, + }, + }, "mustEscape": false, "type": "code", "val": "var bar = null", }, Object { - "col": 1, - "line": 17, - "type": "newline", - }, - Object { - "col": 1, - "line": 17, + "loc": Object { + "end": Object { + "column": 1, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 17, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 17, + }, + }, "type": "tag", "val": "div", }, Object { - "col": 4, - "line": 17, + "loc": Object { + "end": Object { + "column": 5, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 4, + "line": 17, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 17, + "loc": Object { + "end": Object { + "column": 13, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 5, + "line": 17, + }, + }, "mustEscape": true, "name": "foo", "type": "attribute", "val": "null", }, Object { - "col": 14, - "line": 17, + "loc": Object { + "end": Object { + "column": 21, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 14, + "line": 17, + }, + }, "mustEscape": true, "name": "bar", "type": "attribute", "val": "bar", }, Object { - "col": 21, - "line": 17, + "loc": Object { + "end": Object { + "column": 22, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 21, + "line": 17, + }, + }, "type": "end-attributes", }, Object { - "col": 22, - "line": 17, + "loc": Object { + "end": Object { + "column": 47, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 22, + "line": 17, + }, + }, "type": "&attributes", "val": "{baz: \'baz\'}", }, Object { - "col": 1, - "line": 18, - "type": "newline", - }, - Object { - "col": 1, - "line": 18, + "loc": Object { + "end": Object { + "column": 1, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 18, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.js.pug", + "start": Object { + "column": 1, + "line": 18, + }, + }, "type": "eos", }, ] @@ -545,1094 +1328,2714 @@ Array [ exports[`test attrs.pug 1`] = ` Array [ Object { - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 1, + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 1, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 1, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 1, + }, + }, "mustEscape": true, "name": "href", "type": "attribute", "val": "\'/contact\'", }, Object { - "col": 18, - "line": 1, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 18, + "line": 1, + }, + }, "type": "end-attributes", }, Object { - "col": 20, - "line": 1, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 20, + "line": 1, + }, + }, "type": "text", "val": "contact", }, Object { - "col": 1, - "line": 2, - "type": "newline", - }, - Object { - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 2, + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 2, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 2, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 2, + }, + }, "mustEscape": true, "name": "href", "type": "attribute", "val": "\'/save\'", }, Object { - "col": 15, - "line": 2, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 15, + "line": 2, + }, + }, "type": "end-attributes", }, Object { - "col": 16, - "line": 2, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 16, + "line": 2, + }, + }, "type": "class", "val": "button", }, Object { - "col": 24, - "line": 2, + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 24, + "line": 2, + }, + }, "type": "text", "val": "save", }, Object { - "col": 1, - "line": 3, - "type": "newline", - }, - Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 3, + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 3, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 3, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 3, + }, + }, + "mustEscape": true, "name": "foo", "type": "attribute", "val": true, }, Object { - "col": 8, - "line": 3, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 8, + "line": 3, + }, + }, + "mustEscape": true, "name": "bar", "type": "attribute", "val": true, }, Object { - "col": 13, - "line": 3, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 13, + "line": 3, + }, + }, + "mustEscape": true, "name": "baz", "type": "attribute", "val": true, }, Object { - "col": 16, - "line": 3, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 16, + "line": 3, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 4, - "type": "newline", - }, - Object { - "col": 1, - "line": 4, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 4, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 4, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 4, + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 4, + }, + }, "mustEscape": true, "name": "foo", "type": "attribute", "val": "\'foo, bar, baz\'", }, Object { - "col": 24, - "line": 4, + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 24, + "line": 4, + }, + }, "mustEscape": true, "name": "bar", "type": "attribute", "val": "1", }, Object { - "col": 29, - "line": 4, + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 29, + "line": 4, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 5, - "type": "newline", - }, - Object { - "col": 1, - "line": 5, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 5, + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 5, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 5, + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 5, + }, + }, "mustEscape": true, "name": "foo", "type": "attribute", "val": "\'((foo))\'", }, Object { - "col": 18, - "line": 5, + "loc": Object { + "end": Object { + "column": 34, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 18, + "line": 5, + }, + }, "mustEscape": true, "name": "bar", "type": "attribute", "val": "(1) ? 1 : 0", }, Object { - "col": 35, - "line": 5, + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 35, + "line": 5, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 6, - "type": "newline", - }, - Object { - "col": 1, - "line": 6, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 6, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 6, + }, + }, "type": "tag", "val": "select", }, Object { - "col": 1, - "line": 7, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 7, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 7, + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 7, + }, + }, "type": "tag", "val": "option", }, Object { - "col": 9, - "line": 7, + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 9, + "line": 7, + }, + }, "type": "start-attributes", }, Object { - "col": 10, - "line": 7, + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 10, + "line": 7, + }, + }, "mustEscape": true, "name": "value", "type": "attribute", "val": "\'foo\'", }, Object { - "col": 23, - "line": 7, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 31, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 23, + "line": 7, + }, + }, + "mustEscape": true, "name": "selected", "type": "attribute", "val": true, }, Object { - "col": 31, - "line": 7, + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 31, + "line": 7, + }, + }, "type": "end-attributes", }, Object { - "col": 33, - "line": 7, + "loc": Object { + "end": Object { + "column": 36, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 33, + "line": 7, + }, + }, "type": "text", "val": "Foo", }, Object { - "col": 1, - "line": 8, - "type": "newline", - }, - Object { - "col": 3, - "line": 8, + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 8, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 8, + }, + }, "type": "tag", "val": "option", }, Object { - "col": 9, - "line": 8, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 9, + "line": 8, + }, + }, "type": "start-attributes", }, Object { - "col": 10, - "line": 8, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 10, + "line": 8, + }, + }, + "mustEscape": true, "name": "selected", "type": "attribute", "val": true, }, Object { - "col": 20, - "line": 8, + "loc": Object { + "end": Object { + "column": 31, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 20, + "line": 8, + }, + }, "mustEscape": true, "name": "value", "type": "attribute", "val": "\'bar\'", }, Object { - "col": 31, - "line": 8, + "loc": Object { + "end": Object { + "column": 32, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 31, + "line": 8, + }, + }, "type": "end-attributes", }, Object { - "col": 33, - "line": 8, + "loc": Object { + "end": Object { + "column": 36, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 33, + "line": 8, + }, + }, "type": "text", "val": "Bar", }, Object { - "col": 1, - "line": 9, - "type": "outdent", - }, - Object { - "col": 1, - "line": 9, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 9, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 9, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 9, + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 9, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 9, + "loc": Object { + "end": Object { + "column": 15, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 9, + }, + }, "mustEscape": true, "name": "foo", "type": "attribute", "val": "\"class:\"", }, Object { - "col": 15, - "line": 9, + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 15, + "line": 9, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 10, - "type": "newline", - }, - Object { - "col": 1, - "line": 10, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 10, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 10, + }, + }, "type": "tag", "val": "input", }, Object { - "col": 6, - "line": 10, + "loc": Object { + "end": Object { + "column": 7, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 6, + "line": 10, + }, + }, "type": "start-attributes", }, Object { - "col": 7, - "line": 10, + "loc": Object { + "end": Object { + "column": 21, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 7, + "line": 10, + }, + }, "mustEscape": true, "name": "pattern", "type": "attribute", "val": "\'\\\\S+\'", }, Object { - "col": 21, - "line": 10, + "loc": Object { + "end": Object { + "column": 22, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 21, + "line": 10, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 12, - "type": "newline", - }, - Object { - "col": 1, - "line": 12, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 12, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 12, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 12, + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 12, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 12, + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 12, + }, + }, "mustEscape": true, "name": "href", "type": "attribute", "val": "\'/contact\'", }, Object { - "col": 18, - "line": 12, + "loc": Object { + "end": Object { + "column": 19, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 18, + "line": 12, + }, + }, "type": "end-attributes", }, Object { - "col": 20, - "line": 12, + "loc": Object { + "end": Object { + "column": 27, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 20, + "line": 12, + }, + }, "type": "text", "val": "contact", }, Object { - "col": 1, - "line": 13, - "type": "newline", - }, - Object { - "col": 1, - "line": 13, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 13, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 13, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 13, + "loc": Object { + "end": Object { + "column": 3, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 13, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 13, + "loc": Object { + "end": Object { + "column": 15, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 13, + }, + }, "mustEscape": true, "name": "href", "type": "attribute", "val": "\'/save\'", }, Object { - "col": 15, - "line": 13, + "loc": Object { + "end": Object { + "column": 16, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 15, + "line": 13, + }, + }, "type": "end-attributes", }, Object { - "col": 16, - "line": 13, + "loc": Object { + "end": Object { + "column": 23, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 16, + "line": 13, + }, + }, "type": "class", "val": "button", }, Object { - "col": 24, - "line": 13, + "loc": Object { + "end": Object { + "column": 28, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 24, + "line": 13, + }, + }, "type": "text", "val": "save", }, Object { - "col": 1, - "line": 14, - "type": "newline", - }, - Object { - "col": 1, - "line": 14, + "loc": Object { + "end": Object { + "column": 1, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 14, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 14, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 14, + "loc": Object { + "end": Object { + "column": 3, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 14, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 14, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 6, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 14, + }, + }, + "mustEscape": true, "name": "foo", "type": "attribute", "val": true, }, Object { - "col": 7, - "line": 14, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 7, + "line": 14, + }, + }, + "mustEscape": true, "name": "bar", "type": "attribute", "val": true, }, Object { - "col": 11, - "line": 14, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 11, + "line": 14, + }, + }, + "mustEscape": true, "name": "baz", "type": "attribute", "val": true, }, Object { - "col": 14, - "line": 14, + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 14, + "line": 14, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 15, - "type": "newline", - }, - Object { - "col": 1, - "line": 15, + "loc": Object { + "end": Object { + "column": 1, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 15, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 15, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 15, + "loc": Object { + "end": Object { + "column": 3, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 15, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 15, + "loc": Object { + "end": Object { + "column": 22, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 15, + }, + }, "mustEscape": true, "name": "foo", "type": "attribute", "val": "\'foo, bar, baz\'", }, Object { - "col": 23, - "line": 15, + "loc": Object { + "end": Object { + "column": 28, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 23, + "line": 15, + }, + }, "mustEscape": true, "name": "bar", "type": "attribute", "val": "1", }, Object { - "col": 28, - "line": 15, + "loc": Object { + "end": Object { + "column": 29, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 28, + "line": 15, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 16, - "type": "newline", - }, - Object { - "col": 1, - "line": 16, + "loc": Object { + "end": Object { + "column": 1, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 16, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 16, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 16, + "loc": Object { + "end": Object { + "column": 3, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 16, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 16, + "loc": Object { + "end": Object { + "column": 16, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 16, + }, + }, "mustEscape": true, "name": "foo", "type": "attribute", "val": "\'((foo))\'", }, Object { - "col": 17, - "line": 16, + "loc": Object { + "end": Object { + "column": 33, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 17, + "line": 16, + }, + }, "mustEscape": true, "name": "bar", "type": "attribute", "val": "(1) ? 1 : 0", }, Object { - "col": 34, - "line": 16, + "loc": Object { + "end": Object { + "column": 35, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 34, + "line": 16, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 17, - "type": "newline", - }, - Object { - "col": 1, - "line": 17, + "loc": Object { + "end": Object { + "column": 1, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 17, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 17, + }, + }, "type": "tag", "val": "select", }, Object { - "col": 1, - "line": 18, + "loc": Object { + "end": Object { + "column": 3, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 18, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 18, + "loc": Object { + "end": Object { + "column": 9, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 18, + }, + }, "type": "tag", "val": "option", }, Object { - "col": 9, - "line": 18, + "loc": Object { + "end": Object { + "column": 10, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 9, + "line": 18, + }, + }, "type": "start-attributes", }, Object { - "col": 10, - "line": 18, + "loc": Object { + "end": Object { + "column": 21, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 10, + "line": 18, + }, + }, "mustEscape": true, "name": "value", "type": "attribute", "val": "\'foo\'", }, Object { - "col": 22, - "line": 18, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 30, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 22, + "line": 18, + }, + }, + "mustEscape": true, "name": "selected", "type": "attribute", "val": true, }, Object { - "col": 30, - "line": 18, + "loc": Object { + "end": Object { + "column": 31, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 30, + "line": 18, + }, + }, "type": "end-attributes", }, Object { - "col": 32, - "line": 18, + "loc": Object { + "end": Object { + "column": 35, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 32, + "line": 18, + }, + }, "type": "text", "val": "Foo", }, Object { - "col": 1, - "line": 19, - "type": "newline", - }, - Object { - "col": 3, - "line": 19, + "loc": Object { + "end": Object { + "column": 3, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 19, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 19, + }, + }, "type": "tag", "val": "option", }, Object { - "col": 9, - "line": 19, + "loc": Object { + "end": Object { + "column": 10, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 9, + "line": 19, + }, + }, "type": "start-attributes", }, Object { - "col": 10, - "line": 19, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 10, + "line": 19, + }, + }, + "mustEscape": true, "name": "selected", "type": "attribute", "val": true, }, Object { - "col": 19, - "line": 19, + "loc": Object { + "end": Object { + "column": 30, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 19, + "line": 19, + }, + }, "mustEscape": true, "name": "value", "type": "attribute", "val": "\'bar\'", }, Object { - "col": 30, - "line": 19, + "loc": Object { + "end": Object { + "column": 31, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 30, + "line": 19, + }, + }, "type": "end-attributes", }, Object { - "col": 32, - "line": 19, + "loc": Object { + "end": Object { + "column": 35, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 32, + "line": 19, + }, + }, "type": "text", "val": "Bar", }, Object { - "col": 1, - "line": 20, - "type": "outdent", - }, - Object { - "col": 1, - "line": 20, + "loc": Object { + "end": Object { + "column": 1, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 20, + "loc": Object { + "end": Object { + "column": 3, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 20, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 20, + "loc": Object { + "end": Object { + "column": 15, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 20, + }, + }, "mustEscape": true, "name": "foo", "type": "attribute", "val": "\"class:\"", }, Object { - "col": 15, - "line": 20, + "loc": Object { + "end": Object { + "column": 16, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 15, + "line": 20, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 21, - "type": "newline", - }, - Object { - "col": 1, - "line": 21, + "loc": Object { + "end": Object { + "column": 1, + "line": 21, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 21, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 21, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 21, + }, + }, "type": "tag", "val": "input", }, Object { - "col": 6, - "line": 21, + "loc": Object { + "end": Object { + "column": 7, + "line": 21, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 6, + "line": 21, + }, + }, "type": "start-attributes", }, Object { - "col": 7, - "line": 21, + "loc": Object { + "end": Object { + "column": 21, + "line": 21, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 7, + "line": 21, + }, + }, "mustEscape": true, "name": "pattern", "type": "attribute", "val": "\'\\\\S+\'", }, Object { - "col": 21, - "line": 21, + "loc": Object { + "end": Object { + "column": 22, + "line": 21, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 21, + "line": 21, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 22, - "type": "newline", - }, - Object { - "col": 1, - "line": 22, + "loc": Object { + "end": Object { + "column": 1, + "line": 22, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 22, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 22, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 22, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 22, + "loc": Object { + "end": Object { + "column": 5, + "line": 22, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 4, + "line": 22, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 22, + "loc": Object { + "end": Object { + "column": 17, + "line": 22, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 5, + "line": 22, + }, + }, "mustEscape": true, "name": "terse", "type": "attribute", "val": "\"true\"", }, Object { - "col": 17, - "line": 22, + "loc": Object { + "end": Object { + "column": 18, + "line": 22, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 17, + "line": 22, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 23, - "type": "newline", - }, - Object { - "col": 1, - "line": 23, + "loc": Object { + "end": Object { + "column": 1, + "line": 23, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 23, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 23, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 23, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 23, + "loc": Object { + "end": Object { + "column": 5, + "line": 23, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 4, + "line": 23, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 23, + "loc": Object { + "end": Object { + "column": 21, + "line": 23, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 5, + "line": 23, + }, + }, "mustEscape": true, "name": "date", "type": "attribute", "val": "new Date(0)", }, Object { - "col": 21, - "line": 23, + "loc": Object { + "end": Object { + "column": 22, + "line": 23, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 21, + "line": 23, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 25, - "type": "newline", - }, - Object { - "col": 1, - "line": 25, + "loc": Object { + "end": Object { + "column": 1, + "line": 25, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 25, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 25, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 25, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 25, + "loc": Object { + "end": Object { + "column": 5, + "line": 25, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 4, + "line": 25, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 25, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 8, + "line": 25, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 5, + "line": 25, + }, + }, + "mustEscape": true, "name": "abc", "type": "attribute", "val": true, }, Object { - "col": 5, - "line": 26, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 8, + "line": 26, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 5, + "line": 26, + }, + }, + "mustEscape": true, "name": "def", "type": "attribute", "val": true, }, Object { - "col": 8, - "line": 26, + "loc": Object { + "end": Object { + "column": 9, + "line": 26, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 8, + "line": 26, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 27, - "type": "newline", - }, - Object { - "col": 1, - "line": 27, + "loc": Object { + "end": Object { + "column": 1, + "line": 27, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 27, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 27, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 27, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 27, + "loc": Object { + "end": Object { + "column": 5, + "line": 27, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 4, + "line": 27, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 27, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 8, + "line": 27, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 5, + "line": 27, + }, + }, + "mustEscape": true, "name": "abc", "type": "attribute", "val": true, }, Object { - "col": 5, - "line": 28, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 8, + "line": 28, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 5, + "line": 28, + }, + }, + "mustEscape": true, "name": "def", "type": "attribute", "val": true, }, Object { - "col": 8, - "line": 28, + "loc": Object { + "end": Object { + "column": 9, + "line": 28, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 8, + "line": 28, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 29, - "type": "newline", - }, - Object { - "col": 1, - "line": 29, + "loc": Object { + "end": Object { + "column": 1, + "line": 29, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 29, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 29, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 29, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 29, + "loc": Object { + "end": Object { + "column": 5, + "line": 29, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 4, + "line": 29, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 29, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 8, + "line": 29, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 5, + "line": 29, + }, + }, + "mustEscape": true, "name": "abc", "type": "attribute", "val": true, }, Object { - "col": 3, - "line": 30, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 6, + "line": 30, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 30, + }, + }, + "mustEscape": true, "name": "def", "type": "attribute", "val": true, }, Object { - "col": 6, - "line": 30, + "loc": Object { + "end": Object { + "column": 7, + "line": 30, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 6, + "line": 30, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 31, - "type": "newline", - }, - Object { - "col": 1, - "line": 31, + "loc": Object { + "end": Object { + "column": 1, + "line": 31, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 31, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 31, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 31, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 31, + "loc": Object { + "end": Object { + "column": 5, + "line": 31, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 4, + "line": 31, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 31, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 8, + "line": 31, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 5, + "line": 31, + }, + }, + "mustEscape": true, "name": "abc", "type": "attribute", "val": true, }, Object { - "col": 4, - "line": 32, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 7, + "line": 32, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 4, + "line": 32, + }, + }, + "mustEscape": true, "name": "def", "type": "attribute", "val": true, }, Object { - "col": 7, - "line": 32, + "loc": Object { + "end": Object { + "column": 8, + "line": 32, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 7, + "line": 32, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 33, - "type": "newline", - }, - Object { - "col": 1, - "line": 33, + "loc": Object { + "end": Object { + "column": 1, + "line": 33, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 33, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 33, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 33, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 33, + "loc": Object { + "end": Object { + "column": 5, + "line": 33, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 4, + "line": 33, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 33, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 8, + "line": 33, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 5, + "line": 33, + }, + }, + "mustEscape": true, "name": "abc", "type": "attribute", "val": true, }, Object { - "col": 3, - "line": 34, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 6, + "line": 34, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 34, + }, + }, + "mustEscape": true, "name": "def", "type": "attribute", "val": true, }, Object { - "col": 6, - "line": 34, + "loc": Object { + "end": Object { + "column": 7, + "line": 34, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 6, + "line": 34, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 35, - "type": "newline", - }, - Object { - "col": 1, - "line": 35, + "loc": Object { + "end": Object { + "column": 1, + "line": 35, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 35, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 35, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 35, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 35, + "loc": Object { + "end": Object { + "column": 5, + "line": 35, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 4, + "line": 35, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 35, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 8, + "line": 35, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 5, + "line": 35, + }, + }, + "mustEscape": true, "name": "abc", "type": "attribute", "val": true, }, Object { - "col": 5, - "line": 36, - "mustEscape": false, + "loc": Object { + "end": Object { + "column": 8, + "line": 36, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 5, + "line": 36, + }, + }, + "mustEscape": true, "name": "def", "type": "attribute", "val": true, }, Object { - "col": 8, - "line": 36, + "loc": Object { + "end": Object { + "column": 9, + "line": 36, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 8, + "line": 36, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 38, + "loc": Object { + "end": Object { + "column": 1, + "line": 38, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 38, + }, + }, "type": "newline", }, Object { "buffer": false, - "col": 1, - "line": 38, + "loc": Object { + "end": Object { + "column": 41, + "line": 38, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 38, + }, + }, "mustEscape": false, "type": "code", "val": "var attrs = {foo: \'bar\', bar: \'\'}", }, Object { - "col": 1, - "line": 40, - "type": "newline", - }, - Object { - "col": 1, - "line": 40, + "loc": Object { + "end": Object { + "column": 1, + "line": 40, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 40, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 40, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 40, + }, + }, "type": "tag", "val": "div", }, Object { - "col": 4, - "line": 40, + "loc": Object { + "end": Object { + "column": 22, + "line": 40, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 4, + "line": 40, + }, + }, "type": "&attributes", "val": "attrs", }, Object { - "col": 1, - "line": 42, - "type": "newline", - }, - Object { - "col": 1, - "line": 42, + "loc": Object { + "end": Object { + "column": 1, + "line": 42, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 42, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 42, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 42, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 42, + "loc": Object { + "end": Object { + "column": 3, + "line": 42, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 42, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 42, + "loc": Object { + "end": Object { + "column": 12, + "line": 42, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 42, + }, + }, "mustEscape": true, "name": "foo", "type": "attribute", "val": "\'foo\'", }, Object { - "col": 14, - "line": 42, + "loc": Object { + "end": Object { + "column": 24, + "line": 42, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 13, + "line": 42, + }, + }, "mustEscape": true, "name": "bar", "type": "attribute", "val": "\"bar\"", }, Object { - "col": 24, - "line": 42, + "loc": Object { + "end": Object { + "column": 25, + "line": 42, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 24, + "line": 42, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 43, - "type": "newline", - }, - Object { - "col": 1, - "line": 43, + "loc": Object { + "end": Object { + "column": 1, + "line": 43, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 43, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 43, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 43, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 43, + "loc": Object { + "end": Object { + "column": 3, + "line": 43, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 2, + "line": 43, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 43, + "loc": Object { + "end": Object { + "column": 12, + "line": 43, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 3, + "line": 43, + }, + }, "mustEscape": true, "name": "foo", "type": "attribute", "val": "\'foo\'", }, Object { - "col": 14, - "line": 43, + "loc": Object { + "end": Object { + "column": 24, + "line": 43, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 13, + "line": 43, + }, + }, "mustEscape": true, "name": "bar", "type": "attribute", "val": "\'bar\'", }, Object { - "col": 24, - "line": 43, + "loc": Object { + "end": Object { + "column": 25, + "line": 43, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 24, + "line": 43, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 44, - "type": "newline", - }, - Object { - "col": 1, - "line": 44, + "loc": Object { + "end": Object { + "column": 1, + "line": 44, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 44, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 44, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.pug", + "start": Object { + "column": 1, + "line": 44, + }, + }, "type": "eos", }, ] @@ -1641,90 +4044,225 @@ Array [ exports[`test attrs.unescaped.pug 1`] = ` Array [ Object { - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "tag", "val": "script", }, Object { - "col": 7, - "line": 1, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 7, + "line": 1, + }, + }, "type": "start-attributes", }, Object { - "col": 8, - "line": 1, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 8, + "line": 1, + }, + }, "mustEscape": true, "name": "type", "type": "attribute", "val": "\'text/x-template\'", }, Object { - "col": 30, - "line": 1, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 30, + "line": 1, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 2, + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 3, + "line": 2, + }, + }, "type": "tag", "val": "div", }, Object { - "col": 6, - "line": 2, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 6, + "line": 2, + }, + }, "type": "start-attributes", }, Object { - "col": 7, - "line": 2, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 7, + "line": 2, + }, + }, "mustEscape": false, "name": "id", "type": "attribute", "val": "\'user-<%= user.id %>\'", }, Object { - "col": 32, - "line": 2, + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 32, + "line": 2, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "type": "indent", "val": 4, }, Object { - "col": 5, - "line": 3, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 5, + "line": 3, + }, + }, "type": "tag", "val": "h1", }, Object { - "col": 8, - "line": 3, + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 8, + "line": 3, + }, + }, "type": "text", "val": "<%= user.title %>", }, Object { - "col": 25, - "line": 3, - "type": "outdent", - }, - Object { - "col": 25, - "line": 3, - "type": "outdent", - }, - Object { - "col": 25, - "line": 3, + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 25, + "line": 3, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 25, + "line": 3, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs.unescaped.pug", + "start": Object { + "column": 25, + "line": 3, + }, + }, "type": "eos", }, ] @@ -1734,194 +4272,491 @@ exports[`test attrs-data.pug 1`] = ` Array [ Object { "buffer": false, - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "mustEscape": false, "type": "code", "val": "var user = { name: \'tobi\' }", }, Object { - "col": 1, - "line": 2, - "type": "newline", - }, - Object { - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 2, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 4, + "line": 2, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 2, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 5, + "line": 2, + }, + }, "mustEscape": true, "name": "data-user", "type": "attribute", "val": "user", }, Object { - "col": 19, - "line": 2, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 19, + "line": 2, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 3, - "type": "newline", - }, - Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 3, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 4, + "line": 3, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 3, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 5, + "line": 3, + }, + }, "mustEscape": true, "name": "data-items", "type": "attribute", "val": "[1,2,3]", }, Object { - "col": 23, - "line": 3, + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 23, + "line": 3, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 4, - "type": "newline", - }, - Object { - "col": 1, - "line": 4, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 4, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 4, + "line": 4, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 4, + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 5, + "line": 4, + }, + }, "mustEscape": true, "name": "data-username", "type": "attribute", "val": "\'tobi\'", }, Object { - "col": 25, - "line": 4, + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 25, + "line": 4, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 5, - "type": "newline", - }, - Object { - "col": 1, - "line": 5, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 5, + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 4, + "line": 5, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 5, + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 5, + "line": 5, + }, + }, "mustEscape": true, "name": "data-escaped", "type": "attribute", "val": "{message: \"Let\'s rock!\"}", }, Object { - "col": 42, - "line": 5, + "loc": Object { + "end": Object { + "column": 43, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 42, + "line": 5, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 6, - "type": "newline", - }, - Object { - "col": 1, - "line": 6, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 6, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 6, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 6, + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 4, + "line": 6, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 6, + "loc": Object { + "end": Object { + "column": 60, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 5, + "line": 6, + }, + }, "mustEscape": true, "name": "data-ampersand", "type": "attribute", "val": "{message: \"a quote: " this & that\"}", }, Object { - "col": 60, - "line": 6, + "loc": Object { + "end": Object { + "column": 61, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 60, + "line": 6, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 7, - "type": "newline", - }, - Object { - "col": 1, - "line": 7, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 7, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 7, + }, + }, "type": "tag", "val": "foo", }, Object { - "col": 4, - "line": 7, + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 4, + "line": 7, + }, + }, "type": "start-attributes", }, Object { - "col": 5, - "line": 7, + "loc": Object { + "end": Object { + "column": 26, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 5, + "line": 7, + }, + }, "mustEscape": true, "name": "data-epoc", "type": "attribute", "val": "new Date(0)", }, Object { - "col": 26, - "line": 7, + "loc": Object { + "end": Object { + "column": 27, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 26, + "line": 7, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 8, - "type": "newline", - }, - Object { - "col": 1, - "line": 8, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 8, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/attrs-data.pug", + "start": Object { + "column": 1, + "line": 8, + }, + }, "type": "eos", }, ] @@ -1930,54 +4765,135 @@ Array [ exports[`test basic.pug 1`] = ` Array [ Object { - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/basic.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "tag", "val": "html", }, Object { - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/basic.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 2, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/basic.pug", + "start": Object { + "column": 3, + "line": 2, + }, + }, "type": "tag", "val": "body", }, Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/basic.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "type": "indent", "val": 4, }, Object { - "col": 5, - "line": 3, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/basic.pug", + "start": Object { + "column": 5, + "line": 3, + }, + }, "type": "tag", "val": "h1", }, Object { - "col": 8, - "line": 3, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/basic.pug", + "start": Object { + "column": 8, + "line": 3, + }, + }, "type": "text", "val": "Title", }, Object { - "col": 13, - "line": 3, - "type": "outdent", - }, - Object { - "col": 13, - "line": 3, - "type": "outdent", - }, - Object { - "col": 13, - "line": 3, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/basic.pug", + "start": Object { + "column": 13, + "line": 3, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/basic.pug", + "start": Object { + "column": 13, + "line": 3, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/basic.pug", + "start": Object { + "column": 13, + "line": 3, + }, + }, "type": "eos", }, ] @@ -1986,76 +4902,193 @@ Array [ exports[`test blanks.pug 1`] = ` Array [ Object { - "col": 1, - "line": 3, - "type": "newline", - }, - Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/blanks.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/blanks.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "type": "tag", "val": "ul", }, Object { - "col": 1, - "line": 4, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/blanks.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 4, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/blanks.pug", + "start": Object { + "column": 3, + "line": 4, + }, + }, "type": "tag", "val": "li", }, Object { - "col": 6, - "line": 4, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/blanks.pug", + "start": Object { + "column": 6, + "line": 4, + }, + }, "type": "text", "val": "foo", }, Object { - "col": 1, - "line": 6, - "type": "newline", - }, - Object { - "col": 3, - "line": 6, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/blanks.pug", + "start": Object { + "column": 1, + "line": 6, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/blanks.pug", + "start": Object { + "column": 3, + "line": 6, + }, + }, "type": "tag", "val": "li", }, Object { - "col": 6, - "line": 6, + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/blanks.pug", + "start": Object { + "column": 6, + "line": 6, + }, + }, "type": "text", "val": "bar", }, Object { - "col": 1, - "line": 8, - "type": "newline", - }, - Object { - "col": 3, - "line": 8, + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/blanks.pug", + "start": Object { + "column": 1, + "line": 8, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/blanks.pug", + "start": Object { + "column": 3, + "line": 8, + }, + }, "type": "tag", "val": "li", }, Object { - "col": 6, - "line": 8, + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/blanks.pug", + "start": Object { + "column": 6, + "line": 8, + }, + }, "type": "text", "val": "baz", }, Object { - "col": 1, - "line": 9, - "type": "outdent", - }, - Object { - "col": 1, - "line": 9, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/blanks.pug", + "start": Object { + "column": 1, + "line": 9, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/blanks.pug", + "start": Object { + "column": 1, + "line": 9, + }, + }, "type": "eos", }, ] @@ -2064,159 +5097,411 @@ Array [ exports[`test block-code.pug 1`] = ` Array [ Object { - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "blockcode", }, Object { - "col": 2, - "line": 1, + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 2, + "line": 1, + }, + }, "type": "start-pipeless-text", }, Object { - "col": 3, - "line": 2, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 3, + "line": 2, + }, + }, "type": "text", "val": "list = [\"uno\", \"dos\", \"tres\",", }, Object { - "col": 1, - "line": 3, - "type": "newline", - }, - Object { - "col": 3, - "line": 3, + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 3, + "line": 3, + }, + }, "type": "text", "val": " \"cuatro\", \"cinco\", \"seis\"];", }, Object { - "col": 38, - "line": 3, + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 38, + "line": 3, + }, + }, "type": "end-pipeless-text", }, Object { - "col": 1, - "line": 4, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, "type": "newline", }, Object { "buffer": false, - "col": 1, - "line": 4, + "loc": Object { + "end": Object { + "column": 70, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, "type": "comment", "val": " Without a block, the element is accepted and no code is generated", }, Object { - "col": 1, - "line": 5, - "type": "newline", - }, - Object { - "col": 1, - "line": 5, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, "type": "blockcode", }, Object { - "col": 1, - "line": 6, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 6, + }, + }, "type": "newline", }, Object { "code": "list", - "col": 1, "key": null, - "line": 6, + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 6, + }, + }, "type": "each", "val": "item", }, Object { - "col": 1, - "line": 7, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 7, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 7, + "loc": Object { + "end": Object { + "column": 4, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 3, + "line": 7, + }, + }, "type": "blockcode", }, Object { - "col": 4, - "line": 7, + "loc": Object { + "end": Object { + "column": 4, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 4, + "line": 7, + }, + }, "type": "start-pipeless-text", }, Object { - "col": 5, - "line": 8, + "loc": Object { + "end": Object { + "column": 28, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 5, + "line": 8, + }, + }, "type": "text", "val": "string = item.charAt(0)", }, Object { - "col": 1, - "line": 9, - "type": "newline", - }, - Object { - "col": 5, - "line": 9, + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 9, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 5, + "line": 9, + }, + }, "type": "text", "val": "", }, Object { - "col": 1, - "line": 10, - "type": "newline", - }, - Object { - "col": 5, - "line": 10, + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 10, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 5, + "line": 10, + }, + }, "type": "text", "val": " .toUpperCase() +", }, Object { - "col": 1, - "line": 11, - "type": "newline", - }, - Object { - "col": 5, - "line": 11, + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 11, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 5, + "line": 11, + }, + }, "type": "text", "val": "item.slice(1);", }, Object { - "col": 19, - "line": 11, + "loc": Object { + "end": Object { + "column": 19, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 19, + "line": 11, + }, + }, "type": "end-pipeless-text", }, Object { - "col": 1, - "line": 12, - "type": "newline", - }, - Object { - "col": 3, - "line": 12, + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 12, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 3, + "line": 12, + }, + }, "type": "tag", "val": "li", }, Object { "buffer": true, - "col": 5, - "line": 12, + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 5, + "line": 12, + }, + }, "mustEscape": true, "type": "code", "val": "string", }, Object { - "col": 1, - "line": 13, - "type": "outdent", - }, - Object { - "col": 1, - "line": 13, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 13, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/block-code.pug", + "start": Object { + "column": 1, + "line": 13, + }, + }, "type": "eos", }, ] @@ -2225,124 +5510,313 @@ Array [ exports[`test block-expansion.pug 1`] = ` Array [ Object { - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "tag", "val": "ul", }, Object { - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 2, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 3, + "line": 2, + }, + }, "type": "tag", "val": "li", }, Object { - "col": 5, - "line": 2, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 5, + "line": 2, + }, + }, "type": ":", }, Object { - "col": 7, - "line": 2, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 7, + "line": 2, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 8, - "line": 2, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 8, + "line": 2, + }, + }, "type": "start-attributes", }, Object { - "col": 9, - "line": 2, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 9, + "line": 2, + }, + }, "mustEscape": true, "name": "href", "type": "attribute", "val": "\'#\'", }, Object { - "col": 17, - "line": 2, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 17, + "line": 2, + }, + }, "type": "end-attributes", }, Object { - "col": 19, - "line": 2, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 19, + "line": 2, + }, + }, "type": "text", "val": "foo", }, Object { - "col": 1, - "line": 3, - "type": "newline", - }, - Object { - "col": 3, - "line": 3, + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 3, + "line": 3, + }, + }, "type": "tag", "val": "li", }, Object { - "col": 5, - "line": 3, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 5, + "line": 3, + }, + }, "type": ":", }, Object { - "col": 7, - "line": 3, + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 7, + "line": 3, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 8, - "line": 3, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 8, + "line": 3, + }, + }, "type": "start-attributes", }, Object { - "col": 9, - "line": 3, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 9, + "line": 3, + }, + }, "mustEscape": true, "name": "href", "type": "attribute", "val": "\'#\'", }, Object { - "col": 17, - "line": 3, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 17, + "line": 3, + }, + }, "type": "end-attributes", }, Object { - "col": 19, - "line": 3, + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 19, + "line": 3, + }, + }, "type": "text", "val": "bar", }, Object { - "col": 1, - "line": 5, - "type": "outdent", - }, - Object { - "col": 1, - "line": 5, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 3, - "line": 5, + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 3, + "line": 5, + }, + }, "type": "text", "val": "baz", }, Object { - "col": 6, - "line": 5, + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.pug", + "start": Object { + "column": 6, + "line": 5, + }, + }, "type": "eos", }, ] @@ -2351,65 +5825,164 @@ Array [ exports[`test block-expansion.shorthands.pug 1`] = ` Array [ Object { - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.shorthands.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "tag", "val": "ul", }, Object { - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.shorthands.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 2, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.shorthands.pug", + "start": Object { + "column": 3, + "line": 2, + }, + }, "type": "tag", "val": "li", }, Object { - "col": 5, - "line": 2, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.shorthands.pug", + "start": Object { + "column": 5, + "line": 2, + }, + }, "type": "class", "val": "list-item", }, Object { - "col": 15, - "line": 2, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.shorthands.pug", + "start": Object { + "column": 15, + "line": 2, + }, + }, "type": ":", }, Object { - "col": 17, - "line": 2, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.shorthands.pug", + "start": Object { + "column": 17, + "line": 2, + }, + }, "type": "class", "val": "foo", }, Object { - "col": 21, - "line": 2, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.shorthands.pug", + "start": Object { + "column": 21, + "line": 2, + }, + }, "type": ":", }, Object { - "col": 23, - "line": 2, + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.shorthands.pug", + "start": Object { + "column": 23, + "line": 2, + }, + }, "type": "id", "val": "bar", }, Object { - "col": 28, - "line": 2, + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.shorthands.pug", + "start": Object { + "column": 28, + "line": 2, + }, + }, "type": "text", "val": "baz", }, Object { - "col": 31, - "line": 2, - "type": "outdent", - }, - Object { - "col": 31, - "line": 2, + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.shorthands.pug", + "start": Object { + "column": 31, + "line": 2, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/block-expansion.shorthands.pug", + "start": Object { + "column": 31, + "line": 2, + }, + }, "type": "eos", }, ] @@ -2418,61 +5991,151 @@ Array [ exports[`test blockquote.pug 1`] = ` Array [ Object { - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/blockquote.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "tag", "val": "figure", }, Object { - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/blockquote.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 2, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/blockquote.pug", + "start": Object { + "column": 3, + "line": 2, + }, + }, "type": "tag", "val": "blockquote", }, Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/blockquote.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "type": "indent", "val": 4, }, Object { - "col": 7, - "line": 3, + "loc": Object { + "end": Object { + "column": 123, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/blockquote.pug", + "start": Object { + "column": 7, + "line": 3, + }, + }, "type": "text", "val": "Try to define yourself by what you do, and you’ll burnout every time. You are. That is enough. I rest in that.", }, Object { - "col": 3, - "line": 4, - "type": "outdent", - }, - Object { - "col": 3, - "line": 4, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/blockquote.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/blockquote.pug", + "start": Object { + "column": 3, + "line": 4, + }, + }, "type": "tag", "val": "figcaption", }, Object { - "col": 14, - "line": 4, + "loc": Object { + "end": Object { + "column": 47, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/blockquote.pug", + "start": Object { + "column": 14, + "line": 4, + }, + }, "type": "text", "val": "from @thefray at 1:43pm on May 10", }, Object { - "col": 47, - "line": 4, - "type": "outdent", - }, - Object { - "col": 47, - "line": 4, - "type": "eos", + "loc": Object { + "end": Object { + "column": 47, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/blockquote.pug", + "start": Object { + "column": 47, + "line": 4, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/blockquote.pug", + "start": Object { + "column": 47, + "line": 4, + }, + }, + "type": "eos", }, ] `; @@ -2480,54 +6143,135 @@ Array [ exports[`test blocks-in-blocks.pug 1`] = ` Array [ Object { - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-blocks.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "extends", }, Object { - "col": 9, - "line": 1, + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-blocks.pug", + "start": Object { + "column": 9, + "line": 1, + }, + }, "type": "path", "val": "./auxiliary/blocks-in-blocks-layout.pug", }, Object { - "col": 1, - "line": 3, - "type": "newline", - }, - Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-blocks.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-blocks.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "mode": "replace", "type": "block", "val": "body", }, Object { - "col": 1, - "line": 4, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-blocks.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 4, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-blocks.pug", + "start": Object { + "column": 3, + "line": 4, + }, + }, "type": "tag", "val": "h1", }, Object { - "col": 6, - "line": 4, + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-blocks.pug", + "start": Object { + "column": 6, + "line": 4, + }, + }, "type": "text", "val": "Page 2", }, Object { - "col": 1, - "line": 5, - "type": "outdent", - }, - Object { - "col": 1, - "line": 5, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-blocks.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-blocks.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, "type": "eos", }, ] @@ -2537,262 +6281,658 @@ exports[`test blocks-in-if.pug 1`] = ` Array [ Object { "buffer": false, - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "comment", "val": " see https://github.com/pugjs/pug/issues/1589", }, Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "type": "newline", }, Object { "buffer": false, - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "mustEscape": false, "type": "code", "val": "var ajax = true", }, Object { - "col": 1, - "line": 5, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, "type": "newline", }, Object { "buffer": false, - "col": 1, - "line": 5, + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, "mustEscape": false, "type": "code", "val": "if( ajax )", }, Object { - "col": 1, - "line": 6, + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 6, + }, + }, "type": "indent", "val": 4, }, Object { "buffer": false, - "col": 5, - "line": 6, + "loc": Object { + "end": Object { + "column": 46, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 5, + "line": 6, + }, + }, "type": "comment", "val": " return only contents if ajax requests", }, Object { - "col": 1, - "line": 7, - "type": "newline", - }, - Object { - "col": 5, - "line": 7, + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 7, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 5, + "line": 7, + }, + }, "mode": "replace", "type": "block", "val": "contents", }, Object { - "col": 1, - "line": 8, + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 8, + }, + }, "type": "indent", "val": 8, }, Object { - "col": 9, - "line": 8, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 9, + "line": 8, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 11, - "line": 8, + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 11, + "line": 8, + }, + }, "type": "text", "val": "ajax contents", }, Object { - "col": 5, - "line": 10, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 10, + }, + }, "type": "outdent", }, Object { - "col": 1, - "line": 10, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 10, + }, + }, "type": "outdent", }, Object { "buffer": false, - "col": 1, - "line": 10, + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 10, + }, + }, "mustEscape": false, "type": "code", "val": "else", }, Object { - "col": 1, - "line": 11, + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 11, + }, + }, "type": "indent", "val": 4, }, Object { "buffer": false, - "col": 5, - "line": 11, + "loc": Object { + "end": Object { + "column": 24, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 5, + "line": 11, + }, + }, "type": "comment", "val": " return all html", }, Object { - "col": 1, - "line": 12, - "type": "newline", - }, - Object { - "col": 5, - "line": 12, + "loc": Object { + "end": Object { + "column": 5, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 12, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 5, + "line": 12, + }, + }, "type": "doctype", "val": "html", }, Object { - "col": 1, - "line": 13, - "type": "newline", - }, - Object { - "col": 5, - "line": 13, + "loc": Object { + "end": Object { + "column": 5, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 13, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 5, + "line": 13, + }, + }, "type": "tag", "val": "html", }, Object { - "col": 1, - "line": 14, + "loc": Object { + "end": Object { + "column": 9, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 14, + }, + }, "type": "indent", "val": 8, }, Object { - "col": 9, - "line": 14, + "loc": Object { + "end": Object { + "column": 13, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 9, + "line": 14, + }, + }, "type": "tag", "val": "head", }, Object { - "col": 1, - "line": 15, + "loc": Object { + "end": Object { + "column": 13, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 15, + }, + }, "type": "indent", "val": 12, }, Object { - "col": 13, - "line": 15, + "loc": Object { + "end": Object { + "column": 17, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 13, + "line": 15, + }, + }, "type": "tag", "val": "meta", }, Object { - "col": 17, - "line": 15, + "loc": Object { + "end": Object { + "column": 18, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 17, + "line": 15, + }, + }, "type": "start-attributes", }, Object { - "col": 19, - "line": 15, + "loc": Object { + "end": Object { + "column": 33, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 19, + "line": 15, + }, + }, "mustEscape": true, "name": "charset", "type": "attribute", "val": "\'utf8\'", }, Object { - "col": 34, - "line": 15, + "loc": Object { + "end": Object { + "column": 35, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 34, + "line": 15, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 16, - "type": "newline", - }, - Object { - "col": 13, - "line": 16, + "loc": Object { + "end": Object { + "column": 13, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 16, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 13, + "line": 16, + }, + }, "type": "tag", "val": "title", }, Object { - "col": 19, - "line": 16, + "loc": Object { + "end": Object { + "column": 25, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 19, + "line": 16, + }, + }, "type": "text", "val": "sample", }, Object { - "col": 1, - "line": 17, - "type": "newline", - }, - Object { - "col": 13, - "line": 17, + "loc": Object { + "end": Object { + "column": 13, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 17, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 13, + "line": 17, + }, + }, "type": "tag", "val": "body", }, Object { - "col": 1, - "line": 18, + "loc": Object { + "end": Object { + "column": 17, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 18, + }, + }, "type": "indent", "val": 16, }, Object { - "col": 17, - "line": 18, + "loc": Object { + "end": Object { + "column": 31, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 17, + "line": 18, + }, + }, "mode": "replace", "type": "block", "val": "contents", }, Object { - "col": 1, - "line": 19, + "loc": Object { + "end": Object { + "column": 21, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 19, + }, + }, "type": "indent", "val": 20, }, Object { - "col": 21, - "line": 19, + "loc": Object { + "end": Object { + "column": 22, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 21, + "line": 19, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 23, - "line": 19, + "loc": Object { + "end": Object { + "column": 35, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 23, + "line": 19, + }, + }, "type": "text", "val": "all contetns", }, Object { - "col": 17, - "line": 20, - "type": "outdent", - }, - Object { - "col": 13, - "line": 20, - "type": "outdent", - }, - Object { - "col": 9, - "line": 20, - "type": "outdent", - }, - Object { - "col": 5, - "line": 20, - "type": "outdent", - }, - Object { - "col": 1, - "line": 20, - "type": "outdent", - }, - Object { - "col": 1, - "line": 20, + "loc": Object { + "end": Object { + "column": 1, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/blocks-in-if.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, "type": "eos", }, ] @@ -2801,357 +6941,906 @@ Array [ exports[`test case.pug 1`] = ` Array [ Object { - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "tag", "val": "html", }, Object { - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 2, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 3, + "line": 2, + }, + }, "type": "tag", "val": "body", }, Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "type": "indent", "val": 4, }, Object { "buffer": false, - "col": 5, - "line": 3, + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 5, + "line": 3, + }, + }, "mustEscape": false, "type": "code", "val": "var friends = 1", }, Object { - "col": 1, - "line": 4, - "type": "newline", - }, - Object { - "col": 5, - "line": 4, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 5, + "line": 4, + }, + }, "type": "case", "val": "friends", }, Object { - "col": 1, - "line": 5, + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, "type": "indent", "val": 6, }, Object { - "col": 7, - "line": 5, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 7, + "line": 5, + }, + }, "type": "when", "val": "0", }, Object { - "col": 13, - "line": 5, + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 13, + "line": 5, + }, + }, "type": ":", }, Object { - "col": 15, - "line": 5, + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 15, + "line": 5, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 17, - "line": 5, + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 17, + "line": 5, + }, + }, "type": "text", "val": "you have no friends", }, Object { - "col": 1, - "line": 6, - "type": "newline", - }, - Object { - "col": 7, - "line": 6, + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 6, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 7, + "line": 6, + }, + }, "type": "when", "val": "1", }, Object { - "col": 13, - "line": 6, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 13, + "line": 6, + }, + }, "type": ":", }, Object { - "col": 15, - "line": 6, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 15, + "line": 6, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 17, - "line": 6, + "loc": Object { + "end": Object { + "column": 34, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 17, + "line": 6, + }, + }, "type": "text", "val": "you have a friend", }, Object { - "col": 1, - "line": 7, - "type": "newline", - }, - Object { - "col": 7, - "line": 7, + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 7, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 7, + "line": 7, + }, + }, "type": "default", }, Object { - "col": 14, - "line": 7, + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 14, + "line": 7, + }, + }, "type": ":", }, Object { - "col": 16, - "line": 7, + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 16, + "line": 7, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 18, - "line": 7, + "loc": Object { + "end": Object { + "column": 27, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 18, + "line": 7, + }, + }, "type": "text", "val": "you have ", }, Object { "buffer": true, - "col": 27, - "line": 7, + "loc": Object { + "end": Object { + "column": 37, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 27, + "line": 7, + }, + }, "mustEscape": true, "type": "interpolated-code", "val": "friends", }, Object { - "col": 37, - "line": 7, + "loc": Object { + "end": Object { + "column": 45, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 37, + "line": 7, + }, + }, "type": "text", "val": " friends", }, Object { - "col": 5, - "line": 8, + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 8, + }, + }, "type": "outdent", }, Object { "buffer": false, - "col": 5, - "line": 8, + "loc": Object { + "end": Object { + "column": 22, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 5, + "line": 8, + }, + }, "mustEscape": false, "type": "code", "val": "var friends = 0", }, Object { - "col": 1, - "line": 9, - "type": "newline", - }, - Object { - "col": 5, - "line": 9, + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 9, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 5, + "line": 9, + }, + }, "type": "case", "val": "friends", }, Object { - "col": 1, - "line": 10, + "loc": Object { + "end": Object { + "column": 7, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 10, + }, + }, "type": "indent", "val": 6, }, Object { - "col": 7, - "line": 10, + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 7, + "line": 10, + }, + }, "type": "when", "val": "0", }, Object { - "col": 1, - "line": 11, - "type": "newline", - }, - Object { - "col": 7, - "line": 11, + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 11, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 7, + "line": 11, + }, + }, "type": "when", "val": "1", }, Object { - "col": 1, - "line": 12, + "loc": Object { + "end": Object { + "column": 9, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 12, + }, + }, "type": "indent", "val": 8, }, Object { - "col": 9, - "line": 12, + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 9, + "line": 12, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 11, - "line": 12, + "loc": Object { + "end": Object { + "column": 36, + "line": 12, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 11, + "line": 12, + }, + }, "type": "text", "val": "you have very few friends", }, Object { - "col": 7, - "line": 13, - "type": "outdent", - }, - Object { - "col": 7, - "line": 13, + "loc": Object { + "end": Object { + "column": 7, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 13, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 7, + "line": 13, + }, + }, "type": "default", }, Object { - "col": 1, - "line": 14, + "loc": Object { + "end": Object { + "column": 9, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 14, + }, + }, "type": "indent", "val": 8, }, Object { - "col": 9, - "line": 14, + "loc": Object { + "end": Object { + "column": 10, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 9, + "line": 14, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 11, - "line": 14, + "loc": Object { + "end": Object { + "column": 20, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 11, + "line": 14, + }, + }, "type": "text", "val": "you have ", }, Object { "buffer": true, - "col": 20, - "line": 14, + "loc": Object { + "end": Object { + "column": 30, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 20, + "line": 14, + }, + }, "mustEscape": true, "type": "interpolated-code", "val": "friends", }, Object { - "col": 30, - "line": 14, + "loc": Object { + "end": Object { + "column": 38, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 30, + "line": 14, + }, + }, "type": "text", "val": " friends", }, Object { - "col": 7, - "line": 16, + "loc": Object { + "end": Object { + "column": 5, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 16, + }, + }, "type": "outdent", }, Object { - "col": 5, - "line": 16, + "loc": Object { + "end": Object { + "column": 5, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 16, + }, + }, "type": "outdent", }, Object { "buffer": false, - "col": 5, - "line": 16, + "loc": Object { + "end": Object { + "column": 27, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 5, + "line": 16, + }, + }, "mustEscape": false, "type": "code", "val": "var friend = \'Tim:G\'", }, Object { - "col": 1, - "line": 17, - "type": "newline", - }, - Object { - "col": 5, - "line": 17, + "loc": Object { + "end": Object { + "column": 5, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 17, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 5, + "line": 17, + }, + }, "type": "case", "val": "friend", }, Object { - "col": 1, - "line": 18, + "loc": Object { + "end": Object { + "column": 7, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 18, + }, + }, "type": "indent", "val": 6, }, Object { - "col": 7, - "line": 18, + "loc": Object { + "end": Object { + "column": 19, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 7, + "line": 18, + }, + }, "type": "when", "val": "\'Tim:G\'", }, Object { - "col": 19, - "line": 18, + "loc": Object { + "end": Object { + "column": 24, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 19, + "line": 18, + }, + }, "type": ":", }, Object { - "col": 24, - "line": 18, + "loc": Object { + "end": Object { + "column": 25, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 24, + "line": 18, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 26, - "line": 18, + "loc": Object { + "end": Object { + "column": 44, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 26, + "line": 18, + }, + }, "type": "text", "val": "Friend is a string", }, Object { - "col": 1, - "line": 19, - "type": "newline", - }, - Object { - "col": 7, - "line": 19, + "loc": Object { + "end": Object { + "column": 7, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 19, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 7, + "line": 19, + }, + }, "type": "when", "val": "{tim: \'g\'}", }, Object { - "col": 22, - "line": 19, + "loc": Object { + "end": Object { + "column": 24, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 22, + "line": 19, + }, + }, "type": ":", }, Object { - "col": 24, - "line": 19, + "loc": Object { + "end": Object { + "column": 25, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 24, + "line": 19, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 26, - "line": 19, + "loc": Object { + "end": Object { + "column": 45, + "line": 19, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 26, + "line": 19, + }, + }, "type": "text", "val": "Friend is an object", }, Object { - "col": 5, - "line": 20, - "type": "outdent", - }, - Object { - "col": 3, - "line": 20, - "type": "outdent", - }, - Object { - "col": 1, - "line": 20, - "type": "outdent", - }, - Object { - "col": 1, - "line": 20, + "loc": Object { + "end": Object { + "column": 1, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/case.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, "type": "eos", }, ] @@ -3160,172 +7849,433 @@ Array [ exports[`test case-blocks.pug 1`] = ` Array [ Object { - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "tag", "val": "html", }, Object { - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 2, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 3, + "line": 2, + }, + }, "type": "tag", "val": "body", }, Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "type": "indent", "val": 4, }, Object { "buffer": false, - "col": 5, - "line": 3, + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 5, + "line": 3, + }, + }, "mustEscape": false, "type": "code", "val": "var friends = 1", }, Object { - "col": 1, - "line": 4, - "type": "newline", - }, - Object { - "col": 5, - "line": 4, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 5, + "line": 4, + }, + }, "type": "case", "val": "friends", }, Object { - "col": 1, - "line": 5, + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, "type": "indent", "val": 6, }, Object { - "col": 7, - "line": 5, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 7, + "line": 5, + }, + }, "type": "when", "val": "0", }, Object { - "col": 1, - "line": 6, + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 1, + "line": 6, + }, + }, "type": "indent", "val": 8, }, Object { - "col": 9, - "line": 6, + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 9, + "line": 6, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 11, - "line": 6, + "loc": Object { + "end": Object { + "column": 30, + "line": 6, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 11, + "line": 6, + }, + }, "type": "text", "val": "you have no friends", }, Object { - "col": 7, - "line": 7, - "type": "outdent", - }, - Object { - "col": 7, - "line": 7, + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 1, + "line": 7, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 7, + "line": 7, + }, + }, "type": "when", "val": "1", }, Object { - "col": 1, - "line": 8, + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 1, + "line": 8, + }, + }, "type": "indent", "val": 8, }, Object { - "col": 9, - "line": 8, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 9, + "line": 8, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 11, - "line": 8, + "loc": Object { + "end": Object { + "column": 28, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 11, + "line": 8, + }, + }, "type": "text", "val": "you have a friend", }, Object { - "col": 7, - "line": 9, - "type": "outdent", - }, - Object { - "col": 7, - "line": 9, + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 1, + "line": 9, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 7, + "line": 9, + }, + }, "type": "default", }, Object { - "col": 1, - "line": 10, + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 1, + "line": 10, + }, + }, "type": "indent", "val": 8, }, Object { - "col": 9, - "line": 10, + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 9, + "line": 10, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 11, - "line": 10, + "loc": Object { + "end": Object { + "column": 20, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 11, + "line": 10, + }, + }, "type": "text", "val": "you have ", }, Object { "buffer": true, - "col": 20, - "line": 10, + "loc": Object { + "end": Object { + "column": 30, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 20, + "line": 10, + }, + }, "mustEscape": true, "type": "interpolated-code", "val": "friends", }, Object { - "col": 30, - "line": 10, + "loc": Object { + "end": Object { + "column": 38, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 30, + "line": 10, + }, + }, "type": "text", "val": " friends", }, Object { - "col": 38, - "line": 10, - "type": "outdent", - }, - Object { - "col": 38, - "line": 10, - "type": "outdent", - }, - Object { - "col": 38, - "line": 10, - "type": "outdent", - }, - Object { - "col": 38, - "line": 10, - "type": "outdent", - }, - Object { - "col": 38, - "line": 10, + "loc": Object { + "end": Object { + "column": 38, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 38, + "line": 10, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 38, + "line": 10, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 38, + "line": 10, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 38, + "line": 10, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/case-blocks.pug", + "start": Object { + "column": 38, + "line": 10, + }, + }, "type": "eos", }, ] @@ -3352,158 +8302,401 @@ Object { exports[`test classes.pug 1`] = ` Array [ Object { - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 1, + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 2, + "line": 1, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 1, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 3, + "line": 1, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "[\'foo\', \'bar\', \'baz\']", }, Object { - "col": 30, - "line": 1, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 30, + "line": 1, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 5, - "type": "newline", - }, - Object { - "col": 1, - "line": 5, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 5, + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 2, + "line": 5, + }, + }, "type": "class", "val": "foo", }, Object { - "col": 6, - "line": 5, + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 6, + "line": 5, + }, + }, "type": "start-attributes", }, Object { - "col": 7, - "line": 5, + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 7, + "line": 5, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "\'bar\'", }, Object { - "col": 18, - "line": 5, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 18, + "line": 5, + }, + }, "type": "end-attributes", }, Object { - "col": 19, - "line": 5, + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 19, + "line": 5, + }, + }, "type": "class", "val": "baz", }, Object { - "col": 1, - "line": 9, - "type": "newline", - }, - Object { - "col": 1, - "line": 9, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 1, + "line": 9, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 1, + "line": 9, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 9, + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 2, + "line": 9, + }, + }, "type": "class", "val": "foo-bar_baz", }, Object { - "col": 1, - "line": 11, - "type": "newline", - }, - Object { - "col": 1, - "line": 11, + "loc": Object { + "end": Object { + "column": 1, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 1, + "line": 11, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 1, + "line": 11, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 11, + "loc": Object { + "end": Object { + "column": 3, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 2, + "line": 11, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 11, + "loc": Object { + "end": Object { + "column": 43, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 3, + "line": 11, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "{foo: true, bar: false, baz: true}", }, Object { - "col": 43, - "line": 11, + "loc": Object { + "end": Object { + "column": 44, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 43, + "line": 11, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 13, - "type": "newline", - }, - Object { - "col": 1, - "line": 13, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 1, + "line": 13, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 1, + "line": 13, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 13, + "loc": Object { + "end": Object { + "column": 7, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 2, + "line": 13, + }, + }, "type": "class", "val": "-foo", }, Object { - "col": 1, - "line": 14, - "type": "newline", - }, - Object { - "col": 1, - "line": 14, + "loc": Object { + "end": Object { + "column": 1, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 1, + "line": 14, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 1, + "line": 14, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 14, + "loc": Object { + "end": Object { + "column": 7, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 2, + "line": 14, + }, + }, "type": "class", "val": "3foo", }, Object { - "col": 1, - "line": 15, - "type": "newline", - }, - Object { - "col": 1, - "line": 15, + "loc": Object { + "end": Object { + "column": 1, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 1, + "line": 15, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/classes.pug", + "start": Object { + "column": 1, + "line": 15, + }, + }, "type": "eos", }, ] @@ -3512,90 +8705,225 @@ Array [ exports[`test classes-empty.pug 1`] = ` Array [ Object { - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 1, + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 2, + "line": 1, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 1, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 3, + "line": 1, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "\'\'", }, Object { - "col": 11, - "line": 1, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 11, + "line": 1, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 2, - "type": "newline", - }, - Object { - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 2, + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 2, + "line": 2, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 2, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 3, + "line": 2, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "null", }, Object { - "col": 13, - "line": 2, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 13, + "line": 2, + }, + }, "type": "end-attributes", }, Object { - "col": 1, - "line": 3, - "type": "newline", - }, - Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "type": "tag", "val": "a", }, Object { - "col": 2, - "line": 3, + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 2, + "line": 3, + }, + }, "type": "start-attributes", }, Object { - "col": 3, - "line": 3, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 3, + "line": 3, + }, + }, "mustEscape": true, "name": "class", "type": "attribute", "val": "undefined", }, Object { - "col": 18, - "line": 3, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 18, + "line": 3, + }, + }, "type": "end-attributes", }, Object { - "col": 19, - "line": 3, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/classes-empty.pug", + "start": Object { + "column": 19, + "line": 3, + }, + }, "type": "eos", }, ] @@ -3604,506 +8932,1280 @@ Array [ exports[`test code.conditionals.pug 1`] = ` Array [ Object { - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "type": "newline", }, Object { "buffer": false, - "col": 1, - "line": 2, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 2, + }, + }, "mustEscape": false, "type": "code", "val": "if (true)", }, Object { - "col": 1, - "line": 3, + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 3, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 3, + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 3, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 5, - "line": 3, + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 5, + "line": 3, + }, + }, "type": "text", "val": "foo", }, Object { - "col": 1, - "line": 4, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, "type": "outdent", }, Object { "buffer": false, - "col": 1, - "line": 4, + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 4, + }, + }, "mustEscape": false, "type": "code", "val": "else", }, Object { - "col": 1, - "line": 5, + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 5, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 5, + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 5, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 5, - "line": 5, + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 5, + "line": 5, + }, + }, "type": "text", "val": "bar", }, Object { - "col": 1, - "line": 7, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 7, + }, + }, "type": "outdent", }, Object { "buffer": false, - "col": 1, - "line": 7, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 7, + }, + }, "mustEscape": false, "type": "code", "val": "if (true) {", }, Object { - "col": 1, - "line": 8, + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 8, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 8, + "loc": Object { + "end": Object { + "column": 4, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 8, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 5, - "line": 8, + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 5, + "line": 8, + }, + }, "type": "text", "val": "foo", }, Object { - "col": 1, - "line": 9, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 9, + }, + }, "type": "outdent", }, Object { "buffer": false, - "col": 1, - "line": 9, + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 9, + }, + }, "mustEscape": false, "type": "code", "val": "} else {", }, Object { - "col": 1, - "line": 10, + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 10, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 10, + "loc": Object { + "end": Object { + "column": 4, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 10, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 5, - "line": 10, + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 5, + "line": 10, + }, + }, "type": "text", "val": "bar", }, Object { - "col": 1, - "line": 11, + "loc": Object { + "end": Object { + "column": 1, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 11, + }, + }, "type": "outdent", }, Object { "buffer": false, - "col": 1, - "line": 11, + "loc": Object { + "end": Object { + "column": 4, + "line": 11, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 11, + }, + }, "mustEscape": false, "type": "code", "val": "}", }, Object { - "col": 1, - "line": 13, - "type": "newline", - }, - Object { - "col": 1, - "line": 13, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 13, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 13, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 13, + }, + }, "type": "if", "val": "true", }, Object { - "col": 1, - "line": 14, + "loc": Object { + "end": Object { + "column": 3, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 14, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 14, + "loc": Object { + "end": Object { + "column": 4, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 14, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 5, - "line": 14, + "loc": Object { + "end": Object { + "column": 8, + "line": 14, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 5, + "line": 14, + }, + }, "type": "text", "val": "foo", }, Object { - "col": 1, - "line": 15, - "type": "newline", - }, - Object { - "col": 3, - "line": 15, + "loc": Object { + "end": Object { + "column": 3, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 15, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 15, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 5, - "line": 15, + "loc": Object { + "end": Object { + "column": 8, + "line": 15, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 5, + "line": 15, + }, + }, "type": "text", "val": "bar", }, Object { - "col": 1, - "line": 16, - "type": "newline", - }, - Object { - "col": 3, - "line": 16, + "loc": Object { + "end": Object { + "column": 3, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 16, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 16, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 5, - "line": 16, + "loc": Object { + "end": Object { + "column": 8, + "line": 16, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 5, + "line": 16, + }, + }, "type": "text", "val": "baz", }, Object { - "col": 1, - "line": 17, - "type": "outdent", - }, - Object { - "col": 1, - "line": 17, + "loc": Object { + "end": Object { + "column": 1, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 17, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 17, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 17, + }, + }, "type": "else", "val": "", }, Object { - "col": 1, - "line": 18, + "loc": Object { + "end": Object { + "column": 3, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 18, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 18, + "loc": Object { + "end": Object { + "column": 4, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 18, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 5, - "line": 18, + "loc": Object { + "end": Object { + "column": 8, + "line": 18, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 5, + "line": 18, + }, + }, "type": "text", "val": "bar", }, Object { - "col": 1, - "line": 20, - "type": "outdent", - }, - Object { - "col": 1, - "line": 20, + "loc": Object { + "end": Object { + "column": 1, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 20, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 20, + }, + }, "type": "if", "val": "!(true)", }, Object { - "col": 1, - "line": 21, + "loc": Object { + "end": Object { + "column": 3, + "line": 21, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 21, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 21, + "loc": Object { + "end": Object { + "column": 4, + "line": 21, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 21, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 5, - "line": 21, + "loc": Object { + "end": Object { + "column": 8, + "line": 21, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 5, + "line": 21, + }, + }, "type": "text", "val": "foo", }, Object { - "col": 1, - "line": 22, - "type": "outdent", - }, - Object { - "col": 1, - "line": 22, + "loc": Object { + "end": Object { + "column": 1, + "line": 22, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 22, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 22, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 22, + }, + }, "type": "else", "val": "", }, Object { - "col": 1, - "line": 23, + "loc": Object { + "end": Object { + "column": 3, + "line": 23, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 23, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 23, + "loc": Object { + "end": Object { + "column": 4, + "line": 23, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 23, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 5, - "line": 23, + "loc": Object { + "end": Object { + "column": 8, + "line": 23, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 5, + "line": 23, + }, + }, "type": "text", "val": "bar", }, Object { - "col": 1, - "line": 25, - "type": "outdent", - }, - Object { - "col": 1, - "line": 25, + "loc": Object { + "end": Object { + "column": 1, + "line": 25, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 25, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 25, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 25, + }, + }, "type": "if", "val": "\'nested\'", }, Object { - "col": 1, - "line": 26, + "loc": Object { + "end": Object { + "column": 3, + "line": 26, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 26, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 26, + "loc": Object { + "end": Object { + "column": 13, + "line": 26, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 26, + }, + }, "type": "if", "val": "\'works\'", }, Object { - "col": 1, - "line": 27, + "loc": Object { + "end": Object { + "column": 5, + "line": 27, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 27, + }, + }, "type": "indent", "val": 4, }, Object { - "col": 5, - "line": 27, + "loc": Object { + "end": Object { + "column": 6, + "line": 27, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 5, + "line": 27, + }, + }, "type": "tag", "val": "p", }, Object { - "col": 7, - "line": 27, + "loc": Object { + "end": Object { + "column": 10, + "line": 27, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 7, + "line": 27, + }, + }, "type": "text", "val": "yay", }, Object { - "col": 3, - "line": 29, + "loc": Object { + "end": Object { + "column": 1, + "line": 29, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 29, + }, + }, "type": "outdent", }, Object { - "col": 1, - "line": 29, + "loc": Object { + "end": Object { + "column": 1, + "line": 29, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 29, + }, + }, "type": "outdent", }, Object { "buffer": false, - "col": 1, - "line": 29, + "loc": Object { + "end": Object { + "column": 23, + "line": 29, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 29, + }, + }, "type": "comment", "val": " allow empty blocks", }, Object { - "col": 1, - "line": 30, - "type": "newline", - }, - Object { - "col": 1, - "line": 30, + "loc": Object { + "end": Object { + "column": 1, + "line": 30, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 30, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 30, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 30, + }, + }, "type": "if", "val": "false", }, Object { - "col": 1, - "line": 31, - "type": "newline", - }, - Object { - "col": 1, - "line": 31, + "loc": Object { + "end": Object { + "column": 1, + "line": 31, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 31, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 31, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 31, + }, + }, "type": "else", "val": "", }, Object { - "col": 1, - "line": 32, + "loc": Object { + "end": Object { + "column": 3, + "line": 32, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 32, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 32, + "loc": Object { + "end": Object { + "column": 7, + "line": 32, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 32, + }, + }, "type": "class", "val": "bar", }, Object { - "col": 1, - "line": 33, - "type": "outdent", - }, - Object { - "col": 1, - "line": 33, + "loc": Object { + "end": Object { + "column": 1, + "line": 33, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 33, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 33, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 33, + }, + }, "type": "if", "val": "true", }, Object { - "col": 1, - "line": 34, + "loc": Object { + "end": Object { + "column": 3, + "line": 34, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 34, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 34, + "loc": Object { + "end": Object { + "column": 7, + "line": 34, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 34, + }, + }, "type": "class", "val": "bar", }, Object { - "col": 1, - "line": 35, - "type": "outdent", - }, - Object { - "col": 1, - "line": 35, + "loc": Object { + "end": Object { + "column": 1, + "line": 35, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 35, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 35, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 35, + }, + }, "type": "else", "val": "", }, Object { - "col": 1, - "line": 36, - "type": "newline", - }, - Object { - "col": 1, - "line": 36, + "loc": Object { + "end": Object { + "column": 1, + "line": 36, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 36, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 36, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 36, + }, + }, "type": "class", "val": "bing", }, Object { - "col": 1, - "line": 38, - "type": "newline", - }, - Object { - "col": 1, - "line": 38, + "loc": Object { + "end": Object { + "column": 1, + "line": 38, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 38, + }, + }, + "type": "newline", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 38, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 38, + }, + }, "type": "if", "val": "false", }, Object { - "col": 1, - "line": 39, + "loc": Object { + "end": Object { + "column": 3, + "line": 39, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 39, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 39, + "loc": Object { + "end": Object { + "column": 8, + "line": 39, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 39, + }, + }, "type": "class", "val": "bing", }, Object { - "col": 1, - "line": 40, - "type": "outdent", - }, - Object { - "col": 1, - "line": 40, + "loc": Object { + "end": Object { + "column": 1, + "line": 40, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 40, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 40, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 40, + }, + }, "type": "else-if", "val": "false", }, Object { - "col": 1, - "line": 41, + "loc": Object { + "end": Object { + "column": 3, + "line": 41, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 41, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 41, + "loc": Object { + "end": Object { + "column": 7, + "line": 41, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 41, + }, + }, "type": "class", "val": "bar", }, Object { - "col": 1, - "line": 42, - "type": "outdent", - }, - Object { - "col": 1, - "line": 42, + "loc": Object { + "end": Object { + "column": 1, + "line": 42, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 42, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 42, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 42, + }, + }, "type": "else", "val": "", }, Object { - "col": 1, - "line": 43, + "loc": Object { + "end": Object { + "column": 3, + "line": 43, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 1, + "line": 43, + }, + }, "type": "indent", "val": 2, }, Object { - "col": 3, - "line": 43, + "loc": Object { + "end": Object { + "column": 7, + "line": 43, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 3, + "line": 43, + }, + }, "type": "class", "val": "foo", }, Object { - "col": 7, - "line": 43, - "type": "outdent", - }, - Object { - "col": 7, - "line": 43, + "loc": Object { + "end": Object { + "column": 7, + "line": 43, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 7, + "line": 43, + }, + }, + "type": "outdent", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 43, + }, + "filename": "/packages/pug-lexer/test/cases/code.conditionals.pug", + "start": Object { + "column": 7, + "line": 43, + }, + }, "type": "eos", }, ] @@ -4112,41 +10214,95 @@ Array [ exports[`test code.escape.pug 1`] = ` Array [ Object { - "col": 1, - "line": 1, + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/code.escape.pug", + "start": Object { + "column": 1, + "line": 1, + }, + }, "type": "tag", "val": "p", }, Object { "buffer": true, - "col": 2, - "line": 1, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "filename": "/packages/pug-lexer/test/cases/code.escape.pug", + "start": Object { + "column": 2, + "line": 1, + }, + }, "mustEscape": true, "type": "code", "val": "\'