diff --git a/src/script/index.ts b/src/script/index.ts index ef29ca03..19f5bbf8 100644 --- a/src/script/index.ts +++ b/src/script/index.ts @@ -7,6 +7,7 @@ import first from "lodash/first" import last from "lodash/last" import sortedIndexBy from "lodash/sortedIndexBy" import type { + ESLintArrayExpression, ESLintArrayPattern, ESLintCallExpression, ESLintExpression, @@ -15,9 +16,9 @@ import type { ESLintForInStatement, ESLintForOfStatement, ESLintFunctionExpression, - ESLintPattern, - ESLintVariableDeclaration, + ESLintIdentifier, ESLintUnaryExpression, + ESLintVariableDeclaration, HasLocation, Node, Reference, @@ -43,10 +44,11 @@ import { getEspree } from "./espree" import type { ParserOptions } from "../common/parser-options" import { fixLocations } from "../common/fix-locations" -// [1] = spacing before the aliases. -// [2] = aliases. -// [3] = all after the aliases. -const ALIAS_PARENS = /^(\s*)\(([\s\S]+)\)(\s*(?:in|of)\b[\s\S]+)$/u +// [1] = aliases. +// [2] = delimiter. +// [3] = iterator. +const ALIAS_ITERATOR = /^([\s\S]*?(?:\s|\)))(\bin|of\b)([\s\S]*)$/u +const PARENS = /^(\s*\()([\s\S]*?)(\)\s*)$/u const DUMMY_PARENT: any = {} // Like Vue, it judges whether it is a function expression or not. @@ -55,36 +57,42 @@ const IS_FUNCTION_EXPRESSION = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/u const IS_SIMPLE_PATH = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?'\]|\["[^"]*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/u /** - * Replace parentheses which wrap the alias of 'v-for' directive values by array brackets in order to avoid syntax errors. - * @param code The code to replace. - * @returns The replaced code. + * Parse the alias and iterator of 'v-for' directive values. + * @param code The code to parse. + * @returns The parsed result. */ -function replaceAliasParens(code: string): string { - const match = ALIAS_PARENS.exec(code) +function processVForAliasAndIterator( + code: string, +): { + aliases: string + hasParens: boolean + delimiter: string + iterator: string + aliasesWithBrackets: string +} { + const match = ALIAS_ITERATOR.exec(code) if (match != null) { - return `${match[1]}[${match[2]}]${match[3]}` - } - return code -} - -/** - * Normalize the `ForXStatement#left` node to parse v-for expressions. - * @param left The `ForXStatement#left` node to normalize. - * @param replaced The flag to indicate that the alias parentheses were replaced. - */ -function normalizeLeft( - left: ESLintVariableDeclaration | ESLintPattern, - replaced: boolean, -): ESLintPattern[] { - if (left.type !== "VariableDeclaration") { - throw new Error("unreachable") + const aliases = match[1] + const parenMatch = PARENS.exec(aliases) + return { + aliases, + hasParens: Boolean(parenMatch), + aliasesWithBrackets: parenMatch + ? `${parenMatch[1].slice(0, -1)}[${ + parenMatch[2] + }]${parenMatch[3].slice(1)}` + : `[${aliases.slice(0, -1)}]`, + delimiter: match[2] || "", + iterator: match[3], + } } - const id = left.declarations[0].id - - if (replaced) { - return (id as ESLintArrayPattern).elements + return { + aliases: "", + hasParens: false, + aliasesWithBrackets: "", + delimiter: "", + iterator: code, } - return [id] } /** @@ -675,23 +683,41 @@ export function parseExpression( * @param parserOptions The parser options. * @returns The result of parsing. */ +// eslint-disable-next-line complexity export function parseVForExpression( code: string, locationCalculator: LocationCalculator, parserOptions: ParserOptions, ): ExpressionParseResult { - const processedCode = replaceAliasParens(code) - debug('[script] parse v-for expression: "for(%s);"', processedCode) - if (code.trim() === "") { throwEmptyError(locationCalculator, "' in '") } + if (isEcmaVersion5(parserOptions)) { + return parseVForExpressionForEcmaVersion5( + code, + locationCalculator, + parserOptions, + ) + } + const processed = processVForAliasAndIterator(code) + + if (!processed.aliases.trim()) { + return throwEmptyError(locationCalculator, "an alias") + } try { - const replaced = processedCode !== code + debug( + '[script] parse v-for expression: "for(%s%s%s);"', + processed.aliasesWithBrackets, + processed.delimiter, + processed.iterator, + ) + const ast = parseScriptFragment( - `for(let ${processedCode});`, - locationCalculator.getSubCalculatorShift(-8), + `for(let ${processed.aliasesWithBrackets}${processed.delimiter}${processed.iterator});`, + locationCalculator.getSubCalculatorShift( + processed.hasParens ? -8 : -9, + ), parserOptions, ).ast const tokens = ast.tokens || [] @@ -702,10 +728,41 @@ export function parseVForExpression( const statement = ast.body[0] as | ESLintForInStatement | ESLintForOfStatement - const left = normalizeLeft(statement.left, replaced) + const varDecl = statement.left as ESLintVariableDeclaration + const id = varDecl.declarations[0].id as ESLintArrayPattern + const left = id.elements const right = statement.right - const firstToken = tokens[3] || statement.left - const lastToken = tokens[tokens.length - 3] || statement.right + + if (!processed.hasParens && !left.length) { + return throwEmptyError(locationCalculator, "an alias") + } + // Remove `for` `(` `let` `)` `;`. + tokens.shift() + tokens.shift() + tokens.shift() + tokens.pop() + tokens.pop() + + const closeOffset = statement.left.range[1] - 1 + const closeIndex = tokens.findIndex((t) => t.range[0] === closeOffset) + + if (processed.hasParens) { + // Restore parentheses from array brackets. + const open = tokens[0] + if (open != null) { + open.value = "(" + } + const close = tokens[closeIndex] + if (close != null) { + close.value = ")" + } + } else { + // Remove array brackets. + tokens.splice(closeIndex, 1) + tokens.shift() + } + const firstToken = tokens[0] || statement.left + const lastToken = tokens[tokens.length - 1] || statement.right const expression: VForExpression = { type: "VForExpression", range: [firstToken.range[0], lastToken.range[1]], @@ -723,26 +780,104 @@ export function parseVForExpression( } right.parent = expression - // Remvoe `for` `(` `let` `)` `;`. - tokens.shift() - tokens.shift() - tokens.shift() - tokens.pop() - tokens.pop() + return { expression, tokens, comments, references, variables } + } catch (err) { + return throwErrorAsAdjustingOutsideOfCode(err, code, locationCalculator) + } +} - // Restore parentheses from array brackets. - if (replaced) { - const closeOffset = statement.left.range[1] - 1 - const open = tokens[0] - const close = tokens.find((t) => t.range[0] === closeOffset) +function isEcmaVersion5(parserOptions: ParserOptions) { + return ( + (parserOptions.ecmaVersion == null || parserOptions.ecmaVersion <= 5) && + (parserOptions.parser == null || parserOptions.parser === "espree") + ) +} + +function parseVForExpressionForEcmaVersion5( + code: string, + locationCalculator: LocationCalculator, + parserOptions: ParserOptions, +): ExpressionParseResult { + const processed = processVForAliasAndIterator(code) + if (!processed.aliases.trim()) { + return throwEmptyError(locationCalculator, "an alias") + } + try { + const tokens: Token[] = [] + const comments: Token[] = [] + + const parsedAliases = parseVForAliasesForEcmaVersion5( + processed.aliasesWithBrackets, + locationCalculator.getSubCalculatorShift( + processed.hasParens ? 0 : -1, + ), + parserOptions, + ) + + if (processed.hasParens) { + // Restore parentheses from array brackets. + const open = parsedAliases.tokens[0] if (open != null) { open.value = "(" } + const close = last(parsedAliases.tokens) if (close != null) { close.value = ")" } + } else { + // Remove array brackets. + parsedAliases.tokens.shift() + parsedAliases.tokens.pop() + } + tokens.push(...parsedAliases.tokens) + comments.push(...parsedAliases.comments) + const { left, variables } = parsedAliases + + if (!processed.hasParens && !left.length) { + return throwEmptyError(locationCalculator, "an alias") + } + + const delimiterStart = processed.aliases.length + const delimiterEnd = delimiterStart + processed.delimiter.length + tokens.push( + locationCalculator.fixLocation({ + type: processed.delimiter === "in" ? "Keyword" : "Identifier", + value: processed.delimiter, + start: delimiterStart, + end: delimiterEnd, + loc: {} as any, + range: [delimiterStart, delimiterEnd], + } as Token), + ) + + const parsedIterator = parseVForIteratorForEcmaVersion5( + processed.iterator, + locationCalculator.getSubCalculatorShift(delimiterEnd), + parserOptions, + ) + + tokens.push(...parsedIterator.tokens) + comments.push(...parsedIterator.comments) + const { right, references } = parsedIterator + const firstToken = tokens[0] + const lastToken = last(tokens) || firstToken + const expression: VForExpression = { + type: "VForExpression", + range: [firstToken.range[0], lastToken.range[1]], + loc: { start: firstToken.loc.start, end: lastToken.loc.end }, + parent: DUMMY_PARENT, + left, + right, + } + + // Modify parent. + for (const l of left) { + if (l != null) { + l.parent = expression + } } + right.parent = expression return { expression, tokens, comments, references, variables } } catch (err) { @@ -750,6 +885,89 @@ export function parseVForExpression( } } +function parseVForAliasesForEcmaVersion5( + code: string, + locationCalculator: LocationCalculator, + parserOptions: ParserOptions, +) { + const ast = parseScriptFragment( + `0(${code})`, + locationCalculator.getSubCalculatorShift(-2), + parserOptions, + ).ast + const tokens = ast.tokens || [] + const comments = ast.comments || [] + const variables = analyzeExternalReferences(ast, parserOptions).map( + transformVariable, + ) + + const statement = ast.body[0] as ESLintExpressionStatement + const callExpression = statement.expression as ESLintCallExpression + const expression = callExpression.arguments[0] as ESLintArrayExpression + + const left: ESLintIdentifier[] = expression.elements.filter( + (e): e is ESLintIdentifier => { + if (e == null || e.type === "Identifier") { + return true + } + const errorToken = tokens.find( + (t) => e.range[0] <= t.range[0] && t.range[1] <= e.range[1], + )! + return throwUnexpectedTokenError(errorToken.value, errorToken) + }, + ) + // Remove parens. + tokens.shift() + tokens.shift() + tokens.pop() + + return { left, tokens, comments, variables } + + function transformVariable(reference: Reference): Variable { + const ret: Variable = { + id: reference.id, + kind: "v-for", + references: [], + } + Object.defineProperty(ret, "references", { enumerable: false }) + + return ret + } +} + +function parseVForIteratorForEcmaVersion5( + code: string, + locationCalculator: LocationCalculator, + parserOptions: ParserOptions, +) { + const ast = parseScriptFragment( + `0(${code})`, + locationCalculator.getSubCalculatorShift(-2), + parserOptions, + ).ast + const tokens = ast.tokens || [] + const comments = ast.comments || [] + const references = analyzeExternalReferences(ast, parserOptions) + + const statement = ast.body[0] as ESLintExpressionStatement + const callExpression = statement.expression as ESLintCallExpression + const expression = callExpression.arguments[0] + + if (!expression) { + return throwEmptyError(locationCalculator, "an expression") + } + if (expression && expression.type === "SpreadElement") { + return throwUnexpectedTokenError("...", expression) + } + const right = expression + + // Remove parens. + tokens.shift() + tokens.shift() + tokens.pop() + return { right, tokens, comments, references } +} + /** * Parse the source code of inline scripts. * @param code The source code of inline scripts. @@ -903,7 +1121,7 @@ export function parseSlotScopeExpression( param.parent = expression } - // Remvoe `void` `function` `(` `)` `{` `}`. + // Remove `void` `function` `(` `)` `{` `}`. tokens.shift() tokens.shift() tokens.shift() diff --git a/test/fixtures/ast/error-message-outside/ast.json b/test/fixtures/ast/error-message-outside/ast.json index 4d4be9bf..4e041bcb 100644 --- a/test/fixtures/ast/error-message-outside/ast.json +++ b/test/fixtures/ast/error-message-outside/ast.json @@ -24,7 +24,7 @@ "type": "VElement", "range": [ 0, - 132 + 138 ], "loc": { "start": { @@ -118,7 +118,7 @@ "type": "VElement", "range": [ 28, - 51 + 57 ], "loc": { "start": { @@ -127,7 +127,7 @@ }, "end": { "line": 3, - "column": 27 + "column": 33 } }, "name": "div", @@ -137,7 +137,7 @@ "type": "VStartTag", "range": [ 28, - 45 + 51 ], "loc": { "start": { @@ -146,7 +146,7 @@ }, "end": { "line": 3, - "column": 21 + "column": 27 } }, "selfClosing": false, @@ -155,7 +155,7 @@ "type": "VAttribute", "range": [ 33, - 44 + 50 ], "loc": { "start": { @@ -164,7 +164,7 @@ }, "end": { "line": 3, - "column": 20 + "column": 26 } }, "directive": true, @@ -210,7 +210,7 @@ "type": "VExpressionContainer", "range": [ 39, - 44 + 50 ], "loc": { "start": { @@ -219,7 +219,7 @@ }, "end": { "line": 3, - "column": 20 + "column": 26 } }, "expression": null, @@ -232,17 +232,17 @@ "endTag": { "type": "VEndTag", "range": [ - 45, - 51 + 51, + 57 ], "loc": { "start": { "line": 3, - "column": 21 + "column": 27 }, "end": { "line": 3, - "column": 27 + "column": 33 } } }, @@ -251,13 +251,13 @@ { "type": "VText", "range": [ - 51, - 56 + 57, + 62 ], "loc": { "start": { "line": 3, - "column": 27 + "column": 33 }, "end": { "line": 4, @@ -269,8 +269,8 @@ { "type": "VElement", "range": [ - 56, - 83 + 62, + 89 ], "loc": { "start": { @@ -288,8 +288,8 @@ "startTag": { "type": "VStartTag", "range": [ - 56, - 77 + 62, + 83 ], "loc": { "start": { @@ -306,8 +306,8 @@ { "type": "VAttribute", "range": [ - 61, - 76 + 67, + 82 ], "loc": { "start": { @@ -323,8 +323,8 @@ "key": { "type": "VDirectiveKey", "range": [ - 61, - 65 + 67, + 71 ], "loc": { "start": { @@ -339,8 +339,8 @@ "name": { "type": "VIdentifier", "range": [ - 61, - 62 + 67, + 68 ], "loc": { "start": { @@ -358,8 +358,8 @@ "argument": { "type": "VIdentifier", "range": [ - 62, - 65 + 68, + 71 ], "loc": { "start": { @@ -379,8 +379,8 @@ "value": { "type": "VExpressionContainer", "range": [ - 66, - 76 + 72, + 82 ], "loc": { "start": { @@ -402,8 +402,8 @@ "endTag": { "type": "VEndTag", "range": [ - 77, - 83 + 83, + 89 ], "loc": { "start": { @@ -421,8 +421,8 @@ { "type": "VText", "range": [ - 83, - 88 + 89, + 94 ], "loc": { "start": { @@ -439,8 +439,8 @@ { "type": "VElement", "range": [ - 88, - 120 + 94, + 126 ], "loc": { "start": { @@ -458,8 +458,8 @@ "startTag": { "type": "VStartTag", "range": [ - 88, - 114 + 94, + 120 ], "loc": { "start": { @@ -476,8 +476,8 @@ { "type": "VAttribute", "range": [ - 93, - 113 + 99, + 119 ], "loc": { "start": { @@ -493,8 +493,8 @@ "key": { "type": "VDirectiveKey", "range": [ - 93, - 99 + 99, + 105 ], "loc": { "start": { @@ -509,8 +509,8 @@ "name": { "type": "VIdentifier", "range": [ - 93, - 94 + 99, + 100 ], "loc": { "start": { @@ -528,8 +528,8 @@ "argument": { "type": "VIdentifier", "range": [ - 94, - 99 + 100, + 105 ], "loc": { "start": { @@ -549,8 +549,8 @@ "value": { "type": "VExpressionContainer", "range": [ - 100, - 113 + 106, + 119 ], "loc": { "start": { @@ -572,8 +572,8 @@ "endTag": { "type": "VEndTag", "range": [ - 114, - 120 + 120, + 126 ], "loc": { "start": { @@ -591,8 +591,8 @@ { "type": "VText", "range": [ - 120, - 121 + 126, + 127 ], "loc": { "start": { @@ -610,8 +610,8 @@ "endTag": { "type": "VEndTag", "range": [ - 121, - 132 + 127, + 138 ], "loc": { "start": { @@ -864,7 +864,7 @@ "type": "HTMLLiteral", "range": [ 39, - 44 + 50 ], "loc": { "start": { @@ -873,25 +873,25 @@ }, "end": { "line": 3, - "column": 20 + "column": 26 } }, - "value": "abc" + "value": "i in abc." }, { "type": "HTMLTagClose", "range": [ - 44, - 45 + 50, + 51 ], "loc": { "start": { "line": 3, - "column": 20 + "column": 26 }, "end": { "line": 3, - "column": 21 + "column": 27 } }, "value": "" @@ -899,17 +899,17 @@ { "type": "HTMLEndTagOpen", "range": [ - 45, - 50 + 51, + 56 ], "loc": { "start": { "line": 3, - "column": 21 + "column": 27 }, "end": { "line": 3, - "column": 26 + "column": 32 } }, "value": "div" @@ -917,17 +917,17 @@ { "type": "HTMLTagClose", "range": [ - 50, - 51 + 56, + 57 ], "loc": { "start": { "line": 3, - "column": 26 + "column": 32 }, "end": { "line": 3, - "column": 27 + "column": 33 } }, "value": "" @@ -935,13 +935,13 @@ { "type": "HTMLWhitespace", "range": [ - 51, - 56 + 57, + 62 ], "loc": { "start": { "line": 3, - "column": 27 + "column": 33 }, "end": { "line": 4, @@ -953,8 +953,8 @@ { "type": "HTMLTagOpen", "range": [ - 56, - 60 + 62, + 66 ], "loc": { "start": { @@ -971,8 +971,8 @@ { "type": "Punctuator", "range": [ - 61, - 62 + 67, + 68 ], "loc": { "start": { @@ -989,8 +989,8 @@ { "type": "HTMLIdentifier", "range": [ - 62, - 65 + 68, + 71 ], "loc": { "start": { @@ -1007,8 +1007,8 @@ { "type": "HTMLAssociation", "range": [ - 65, - 66 + 71, + 72 ], "loc": { "start": { @@ -1025,8 +1025,8 @@ { "type": "HTMLLiteral", "range": [ - 66, - 76 + 72, + 82 ], "loc": { "start": { @@ -1043,8 +1043,8 @@ { "type": "HTMLTagClose", "range": [ - 76, - 77 + 82, + 83 ], "loc": { "start": { @@ -1061,8 +1061,8 @@ { "type": "HTMLEndTagOpen", "range": [ - 77, - 82 + 83, + 88 ], "loc": { "start": { @@ -1079,8 +1079,8 @@ { "type": "HTMLTagClose", "range": [ - 82, - 83 + 88, + 89 ], "loc": { "start": { @@ -1097,8 +1097,8 @@ { "type": "HTMLWhitespace", "range": [ - 83, - 88 + 89, + 94 ], "loc": { "start": { @@ -1115,8 +1115,8 @@ { "type": "HTMLTagOpen", "range": [ - 88, - 92 + 94, + 98 ], "loc": { "start": { @@ -1133,8 +1133,8 @@ { "type": "Punctuator", "range": [ - 93, - 94 + 99, + 100 ], "loc": { "start": { @@ -1151,8 +1151,8 @@ { "type": "HTMLIdentifier", "range": [ - 94, - 99 + 100, + 105 ], "loc": { "start": { @@ -1169,8 +1169,8 @@ { "type": "HTMLAssociation", "range": [ - 99, - 100 + 105, + 106 ], "loc": { "start": { @@ -1187,8 +1187,8 @@ { "type": "HTMLLiteral", "range": [ - 100, - 113 + 106, + 119 ], "loc": { "start": { @@ -1205,8 +1205,8 @@ { "type": "HTMLTagClose", "range": [ - 113, - 114 + 119, + 120 ], "loc": { "start": { @@ -1223,8 +1223,8 @@ { "type": "HTMLEndTagOpen", "range": [ - 114, - 119 + 120, + 125 ], "loc": { "start": { @@ -1241,8 +1241,8 @@ { "type": "HTMLTagClose", "range": [ - 119, - 120 + 125, + 126 ], "loc": { "start": { @@ -1259,8 +1259,8 @@ { "type": "HTMLWhitespace", "range": [ - 120, - 121 + 126, + 127 ], "loc": { "start": { @@ -1277,8 +1277,8 @@ { "type": "HTMLEndTagOpen", "range": [ - 121, - 131 + 127, + 137 ], "loc": { "start": { @@ -1295,8 +1295,8 @@ { "type": "HTMLTagClose", "range": [ - 131, - 132 + 137, + 138 ], "loc": { "start": { @@ -1313,8 +1313,8 @@ { "type": "HTMLWhitespace", "range": [ - 132, - 133 + 138, + 139 ], "loc": { "start": { @@ -1339,19 +1339,19 @@ }, { "message": "Unexpected end of expression.", - "index": 43, + "index": 49, "lineNumber": 3, - "column": 19 + "column": 25 }, { "message": "Unexpected end of expression.", - "index": 76, + "index": 82, "lineNumber": 4, "column": 24 }, { "message": "Unexpected end of expression.", - "index": 112, + "index": 118, "lineNumber": 5, "column": 28 } diff --git a/test/fixtures/ast/error-message-outside/source.vue b/test/fixtures/ast/error-message-outside/source.vue index d7ced3de..9154164c 100644 --- a/test/fixtures/ast/error-message-outside/source.vue +++ b/test/fixtures/ast/error-message-outside/source.vue @@ -1,6 +1,6 @@ diff --git a/test/fixtures/ast/error-message-outside/token-ranges.json b/test/fixtures/ast/error-message-outside/token-ranges.json index b166ebd1..b7754866 100644 --- a/test/fixtures/ast/error-message-outside/token-ranges.json +++ b/test/fixtures/ast/error-message-outside/token-ranges.json @@ -12,7 +12,7 @@ "", "", diff --git a/test/fixtures/ast/error-message-outside/tree.json b/test/fixtures/ast/error-message-outside/tree.json index 5107ead3..248eea33 100644 --- a/test/fixtures/ast/error-message-outside/tree.json +++ b/test/fixtures/ast/error-message-outside/tree.json @@ -1,7 +1,7 @@ [ { "type": "VElement", - "text": "", + "text": "", "children": [ { "type": "VStartTag", @@ -25,15 +25,15 @@ }, { "type": "VElement", - "text": "
", + "text": "
", "children": [ { "type": "VStartTag", - "text": "
", + "text": "
", "children": [ { "type": "VAttribute", - "text": "v-for=\"abc\"", + "text": "v-for=\"i in abc.\"", "children": [ { "type": "VDirectiveKey", @@ -48,7 +48,7 @@ }, { "type": "VExpressionContainer", - "text": "\"abc\"", + "text": "\"i in abc.\"", "children": [] } ] diff --git a/test/fixtures/ast/v-for-directives-error-with-es5/ast.json b/test/fixtures/ast/v-for-directives-error-with-es5/ast.json new file mode 100644 index 00000000..71d5f6fa --- /dev/null +++ b/test/fixtures/ast/v-for-directives-error-with-es5/ast.json @@ -0,0 +1,2684 @@ +{ + "type": "Program", + "start": 0, + "end": 0, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 0 + } + }, + "range": [ + 0, + 0 + ], + "body": [], + "sourceType": "script", + "comments": [], + "tokens": [], + "templateBody": { + "type": "VElement", + "range": [ + 0, + 370 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 11, + "column": 11 + } + }, + "name": "template", + "rawName": "template", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "selfClosing": false, + "attributes": [] + }, + "children": [ + { + "type": "VText", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 15, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 15, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "column": 9, + "line": 2 + }, + "end": { + "column": 14, + "line": 2 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "expression": null, + "references": [] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "variables": [] + }, + { + "type": "VText", + "range": [ + 38, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 43, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 30 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 43, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 48, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 48, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 48, + 53 + ], + "loc": { + "start": { + "column": 9, + "line": 3 + }, + "end": { + "column": 14, + "line": 3 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 54, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "expression": null, + "references": [] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 63, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + "variables": [] + }, + { + "type": "VText", + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 4, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 74, + 105 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 35 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 74, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 29 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 79, + 98 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 79, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 79, + 84 + ], + "loc": { + "start": { + "column": 9, + "line": 4 + }, + "end": { + "column": 14, + "line": 4 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 85, + 98 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "expression": null, + "references": [] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 99, + 105 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + "variables": [] + }, + { + "type": "VText", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 5, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VText", + "range": [ + 132, + 137 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 6, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 137, + 175 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 42 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 137, + 169 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 36 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 142, + 168 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 35 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 142, + 147 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 142, + 147 + ], + "loc": { + "start": { + "column": 9, + "line": 6 + }, + "end": { + "column": 14, + "line": 6 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 148, + 168 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 35 + } + }, + "expression": null, + "references": [] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 169, + 175 + ], + "loc": { + "start": { + "line": 6, + "column": 36 + }, + "end": { + "line": 6, + "column": 42 + } + } + }, + "variables": [] + }, + { + "type": "VText", + "range": [ + 175, + 180 + ], + "loc": { + "start": { + "line": 6, + "column": 42 + }, + "end": { + "line": 7, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 180, + 227 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 51 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 180, + 221 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 45 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 185, + 220 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 44 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 185, + 190 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 185, + 190 + ], + "loc": { + "start": { + "column": 9, + "line": 7 + }, + "end": { + "column": 14, + "line": 7 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 191, + 220 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 44 + } + }, + "expression": null, + "references": [] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 221, + 227 + ], + "loc": { + "start": { + "line": 7, + "column": 45 + }, + "end": { + "line": 7, + "column": 51 + } + } + }, + "variables": [] + }, + { + "type": "VText", + "range": [ + 227, + 232 + ], + "loc": { + "start": { + "line": 7, + "column": 51 + }, + "end": { + "line": 8, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 232, + 271 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 43 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 232, + 265 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 37 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 237, + 264 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 36 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 237, + 242 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 237, + 242 + ], + "loc": { + "start": { + "column": 9, + "line": 8 + }, + "end": { + "column": 14, + "line": 8 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 243, + 264 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 36 + } + }, + "expression": null, + "references": [] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 265, + 271 + ], + "loc": { + "start": { + "line": 8, + "column": 37 + }, + "end": { + "line": 8, + "column": 43 + } + } + }, + "variables": [] + }, + { + "type": "VText", + "range": [ + 271, + 276 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 9, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 276, + 309 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 37 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 276, + 303 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 31 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 281, + 302 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 30 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 281, + 286 + ], + "loc": { + "start": { + "line": 9, + "column": 9 + }, + "end": { + "line": 9, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 281, + 286 + ], + "loc": { + "start": { + "column": 9, + "line": 9 + }, + "end": { + "column": 14, + "line": 9 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 287, + 302 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 30 + } + }, + "expression": null, + "references": [] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 303, + 309 + ], + "loc": { + "start": { + "line": 9, + "column": 31 + }, + "end": { + "line": 9, + "column": 37 + } + } + }, + "variables": [] + }, + { + "type": "VText", + "range": [ + 309, + 314 + ], + "loc": { + "start": { + "line": 9, + "column": 37 + }, + "end": { + "line": 10, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 314, + 358 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 48 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 314, + 352 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 42 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 319, + 351 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 41 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 319, + 324 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 319, + 324 + ], + "loc": { + "start": { + "column": 9, + "line": 10 + }, + "end": { + "column": 14, + "line": 10 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 325, + 351 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 41 + } + }, + "expression": null, + "references": [] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 352, + 358 + ], + "loc": { + "start": { + "line": 10, + "column": 42 + }, + "end": { + "line": 10, + "column": 48 + } + } + }, + "variables": [] + }, + { + "type": "VText", + "range": [ + 358, + 359 + ], + "loc": { + "start": { + "line": 10, + "column": 48 + }, + "end": { + "line": 11, + "column": 0 + } + }, + "value": "\n" + } + ], + "endTag": { + "type": "VEndTag", + "range": [ + 359, + 370 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 11 + } + } + }, + "variables": [], + "tokens": [ + { + "type": "HTMLTagOpen", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": "template" + }, + { + "type": "HTMLTagClose", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "column": 9, + "line": 2 + }, + "end": { + "column": 14, + "line": 2 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": "" + }, + { + "type": "HTMLLiteral", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "value": "abc" + }, + { + "type": "HTMLTagClose", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 38, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 43, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 48, + 53 + ], + "loc": { + "start": { + "column": 9, + "line": 3 + }, + "end": { + "column": 14, + "line": 3 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "value": "" + }, + { + "type": "HTMLLiteral", + "range": [ + 54, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "value": "in abc" + }, + { + "type": "HTMLTagClose", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 63, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 30 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 4, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 74, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 79, + 84 + ], + "loc": { + "start": { + "column": 9, + "line": 4 + }, + "end": { + "column": 14, + "line": 4 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "value": "" + }, + { + "type": "HTMLLiteral", + "range": [ + 85, + 98 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "value": "/**/ in abc" + }, + { + "type": "HTMLTagClose", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 28 + }, + "end": { + "line": 4, + "column": 29 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 99, + 104 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 34 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 4, + "column": 34 + }, + "end": { + "line": 4, + "column": 35 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 105, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 5, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLWhitespace", + "range": [ + 132, + 137 + ], + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 6, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 137, + 141 + ], + "loc": { + "start": { + "line": 6, + "column": 4 + }, + "end": { + "line": 6, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 142, + 147 + ], + "loc": { + "start": { + "column": 9, + "line": 6 + }, + "end": { + "column": 14, + "line": 6 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 147, + 148 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 15 + } + }, + "value": "" + }, + { + "type": "HTMLLiteral", + "range": [ + 148, + 168 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 35 + } + }, + "value": "{key,name} in list" + }, + { + "type": "HTMLTagClose", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 6, + "column": 35 + }, + "end": { + "line": 6, + "column": 36 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 169, + 174 + ], + "loc": { + "start": { + "line": 6, + "column": 36 + }, + "end": { + "line": 6, + "column": 41 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 6, + "column": 41 + }, + "end": { + "line": 6, + "column": 42 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 175, + 180 + ], + "loc": { + "start": { + "line": 6, + "column": 42 + }, + "end": { + "line": 7, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 180, + 184 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 185, + 190 + ], + "loc": { + "start": { + "column": 9, + "line": 7 + }, + "end": { + "column": 14, + "line": 7 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 190, + 191 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 15 + } + }, + "value": "" + }, + { + "type": "HTMLLiteral", + "range": [ + 191, + 220 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 44 + } + }, + "value": "{key:key,name:name} in list" + }, + { + "type": "HTMLTagClose", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 7, + "column": 44 + }, + "end": { + "line": 7, + "column": 45 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 221, + 226 + ], + "loc": { + "start": { + "line": 7, + "column": 45 + }, + "end": { + "line": 7, + "column": 50 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 226, + 227 + ], + "loc": { + "start": { + "line": 7, + "column": 50 + }, + "end": { + "line": 7, + "column": 51 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 227, + 232 + ], + "loc": { + "start": { + "line": 7, + "column": 51 + }, + "end": { + "line": 8, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 232, + 236 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 237, + 242 + ], + "loc": { + "start": { + "column": 9, + "line": 8 + }, + "end": { + "column": 14, + "line": 8 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 242, + 243 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 15 + } + }, + "value": "" + }, + { + "type": "HTMLLiteral", + "range": [ + 243, + 264 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 36 + } + }, + "value": "([a,,b], c) in list" + }, + { + "type": "HTMLTagClose", + "range": [ + 264, + 265 + ], + "loc": { + "start": { + "line": 8, + "column": 36 + }, + "end": { + "line": 8, + "column": 37 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 265, + 270 + ], + "loc": { + "start": { + "line": 8, + "column": 37 + }, + "end": { + "line": 8, + "column": 42 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 270, + 271 + ], + "loc": { + "start": { + "line": 8, + "column": 42 + }, + "end": { + "line": 8, + "column": 43 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 271, + 276 + ], + "loc": { + "start": { + "line": 8, + "column": 43 + }, + "end": { + "line": 9, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 276, + 280 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 281, + 286 + ], + "loc": { + "start": { + "column": 9, + "line": 9 + }, + "end": { + "column": 14, + "line": 9 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 286, + 287 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + }, + "value": "" + }, + { + "type": "HTMLLiteral", + "range": [ + 287, + 302 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 30 + } + }, + "value": "[a,b] of list" + }, + { + "type": "HTMLTagClose", + "range": [ + 302, + 303 + ], + "loc": { + "start": { + "line": 9, + "column": 30 + }, + "end": { + "line": 9, + "column": 31 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 303, + 308 + ], + "loc": { + "start": { + "line": 9, + "column": 31 + }, + "end": { + "line": 9, + "column": 36 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 308, + 309 + ], + "loc": { + "start": { + "line": 9, + "column": 36 + }, + "end": { + "line": 9, + "column": 37 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 309, + 314 + ], + "loc": { + "start": { + "line": 9, + "column": 37 + }, + "end": { + "line": 10, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 314, + 318 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 319, + 324 + ], + "loc": { + "start": { + "column": 9, + "line": 10 + }, + "end": { + "column": 14, + "line": 10 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 324, + 325 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 15 + } + }, + "value": "" + }, + { + "type": "HTMLLiteral", + "range": [ + 325, + 351 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 41 + } + }, + "value": "{[z]:key=x,name} in list" + }, + { + "type": "HTMLTagClose", + "range": [ + 351, + 352 + ], + "loc": { + "start": { + "line": 10, + "column": 41 + }, + "end": { + "line": 10, + "column": 42 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 352, + 357 + ], + "loc": { + "start": { + "line": 10, + "column": 42 + }, + "end": { + "line": 10, + "column": 47 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 357, + 358 + ], + "loc": { + "start": { + "line": 10, + "column": 47 + }, + "end": { + "line": 10, + "column": 48 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 358, + 359 + ], + "loc": { + "start": { + "line": 10, + "column": 48 + }, + "end": { + "line": 11, + "column": 0 + } + }, + "value": "\n" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 359, + 369 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 10 + } + }, + "value": "template" + }, + { + "type": "HTMLTagClose", + "range": [ + 369, + 370 + ], + "loc": { + "start": { + "line": 11, + "column": 10 + }, + "end": { + "line": 11, + "column": 11 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 370, + 371 + ], + "loc": { + "start": { + "line": 11, + "column": 11 + }, + "end": { + "line": 12, + "column": 0 + } + }, + "value": "\n" + } + ], + "comments": [ + { + "type": "HTMLComment", + "range": [ + 110, + 132 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 26 + } + }, + "value": " destructuring " + } + ], + "errors": [ + { + "message": "Expected to be an alias, but got empty.", + "index": 27, + "lineNumber": 2, + "column": 16 + }, + { + "message": "Expected to be an alias, but got empty.", + "index": 55, + "lineNumber": 3, + "column": 16 + }, + { + "message": "Expected to be an alias, but got empty.", + "index": 86, + "lineNumber": 4, + "column": 16 + }, + { + "message": "Unexpected token ,", + "index": 153, + "lineNumber": 6, + "column": 20 + }, + { + "message": "Unexpected token '{'.", + "index": 192, + "lineNumber": 7, + "column": 16 + }, + { + "message": "Unexpected token '['.", + "index": 245, + "lineNumber": 8, + "column": 17 + }, + { + "message": "Unexpected token '['.", + "index": 288, + "lineNumber": 9, + "column": 16 + }, + { + "message": "Unexpected token [", + "index": 327, + "lineNumber": 10, + "column": 17 + } + ] + } +} \ No newline at end of file diff --git a/test/fixtures/ast/v-for-directives-error-with-es5/parser-options.json b/test/fixtures/ast/v-for-directives-error-with-es5/parser-options.json new file mode 100644 index 00000000..fcc8a62f --- /dev/null +++ b/test/fixtures/ast/v-for-directives-error-with-es5/parser-options.json @@ -0,0 +1,3 @@ +{ + "ecmaVersion": 5 +} diff --git a/test/fixtures/ast/v-for-directives-error-with-es5/source.vue b/test/fixtures/ast/v-for-directives-error-with-es5/source.vue new file mode 100644 index 00000000..a3df078d --- /dev/null +++ b/test/fixtures/ast/v-for-directives-error-with-es5/source.vue @@ -0,0 +1,11 @@ + diff --git a/test/fixtures/ast/v-for-directives-error-with-es5/token-ranges.json b/test/fixtures/ast/v-for-directives-error-with-es5/token-ranges.json new file mode 100644 index 00000000..f8886fb1 --- /dev/null +++ b/test/fixtures/ast/v-for-directives-error-with-es5/token-ranges.json @@ -0,0 +1,74 @@ +[ + "", + "\n ", + "", + "", + "\n ", + "", + "", + "\n ", + "", + "", + "\n ", + "\n ", + "", + "", + "\n ", + "", + "", + "\n ", + "", + "", + "\n ", + "", + "", + "\n ", + "", + "", + "\n", + "", + "\n", + "" +] \ No newline at end of file diff --git a/test/fixtures/ast/v-for-directives-error-with-es5/tree.json b/test/fixtures/ast/v-for-directives-error-with-es5/tree.json new file mode 100644 index 00000000..eb14fbfa --- /dev/null +++ b/test/fixtures/ast/v-for-directives-error-with-es5/tree.json @@ -0,0 +1,380 @@ +[ + { + "type": "VElement", + "text": "", + "children": [ + { + "type": "VStartTag", + "text": "", + "children": [] + } + ] + } +] \ No newline at end of file diff --git a/test/fixtures/ast/v-for-directives-error/ast.json b/test/fixtures/ast/v-for-directives-error/ast.json new file mode 100644 index 00000000..a79f66fa --- /dev/null +++ b/test/fixtures/ast/v-for-directives-error/ast.json @@ -0,0 +1,1119 @@ +{ + "type": "Program", + "start": 0, + "end": 0, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 0 + } + }, + "range": [ + 0, + 0 + ], + "body": [], + "sourceType": "script", + "comments": [], + "tokens": [], + "templateBody": { + "type": "VElement", + "range": [ + 0, + 117 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "name": "template", + "rawName": "template", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "selfClosing": false, + "attributes": [] + }, + "children": [ + { + "type": "VText", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 15, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 15, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 20, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "column": 9, + "line": 2 + }, + "end": { + "column": 14, + "line": 2 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "expression": null, + "references": [] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 32, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + "variables": [] + }, + { + "type": "VText", + "range": [ + 38, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 43, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 30 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 43, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 48, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 48, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 48, + 53 + ], + "loc": { + "start": { + "column": 9, + "line": 3 + }, + "end": { + "column": 14, + "line": 3 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 54, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "expression": null, + "references": [] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 63, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + "variables": [] + }, + { + "type": "VText", + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 4, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 74, + 105 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 35 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 74, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 29 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 79, + 98 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 79, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 79, + 84 + ], + "loc": { + "start": { + "column": 9, + "line": 4 + }, + "end": { + "column": 14, + "line": 4 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 85, + 98 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "expression": null, + "references": [] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 99, + 105 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + "variables": [] + }, + { + "type": "VText", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 5, + "column": 0 + } + }, + "value": "\n" + } + ], + "endTag": { + "type": "VEndTag", + "range": [ + 106, + 117 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + "variables": [], + "tokens": [ + { + "type": "HTMLTagOpen", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": "template" + }, + { + "type": "HTMLTagClose", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "column": 9, + "line": 2 + }, + "end": { + "column": 14, + "line": 2 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": "" + }, + { + "type": "HTMLLiteral", + "range": [ + 26, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "value": "abc" + }, + { + "type": "HTMLTagClose", + "range": [ + 31, + 32 + ], + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 32, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 38, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 43, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 48, + 53 + ], + "loc": { + "start": { + "column": 9, + "line": 3 + }, + "end": { + "column": 14, + "line": 3 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 53, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "value": "" + }, + { + "type": "HTMLLiteral", + "range": [ + 54, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "value": "in abc" + }, + { + "type": "HTMLTagClose", + "range": [ + 62, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 63, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 68, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 30 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 69, + 74 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 4, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 74, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 79, + 84 + ], + "loc": { + "start": { + "column": 9, + "line": 4 + }, + "end": { + "column": 14, + "line": 4 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 84, + 85 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "value": "" + }, + { + "type": "HTMLLiteral", + "range": [ + 85, + 98 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 28 + } + }, + "value": "/**/ in abc" + }, + { + "type": "HTMLTagClose", + "range": [ + 98, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 28 + }, + "end": { + "line": 4, + "column": 29 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 99, + 104 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 34 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 104, + 105 + ], + "loc": { + "start": { + "line": 4, + "column": 34 + }, + "end": { + "line": 4, + "column": 35 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 5, + "column": 0 + } + }, + "value": "\n" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 106, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 10 + } + }, + "value": "template" + }, + { + "type": "HTMLTagClose", + "range": [ + 116, + 117 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 11 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 6, + "column": 0 + } + }, + "value": "\n" + } + ], + "comments": [], + "errors": [ + { + "message": "Expected to be an alias, but got empty.", + "index": 27, + "lineNumber": 2, + "column": 16 + }, + { + "message": "Expected to be an alias, but got empty.", + "index": 55, + "lineNumber": 3, + "column": 16 + }, + { + "message": "Expected to be an alias, but got empty.", + "index": 86, + "lineNumber": 4, + "column": 16 + } + ] + } +} \ No newline at end of file diff --git a/test/fixtures/ast/v-for-directives-error/source.vue b/test/fixtures/ast/v-for-directives-error/source.vue new file mode 100644 index 00000000..30b67ce2 --- /dev/null +++ b/test/fixtures/ast/v-for-directives-error/source.vue @@ -0,0 +1,5 @@ + diff --git a/test/fixtures/ast/v-for-directives-error/token-ranges.json b/test/fixtures/ast/v-for-directives-error/token-ranges.json new file mode 100644 index 00000000..5426970b --- /dev/null +++ b/test/fixtures/ast/v-for-directives-error/token-ranges.json @@ -0,0 +1,32 @@ +[ + "", + "\n ", + "", + "", + "\n ", + "", + "", + "\n ", + "", + "", + "\n", + "", + "\n" +] \ No newline at end of file diff --git a/test/fixtures/ast/v-for-directives-error/tree.json b/test/fixtures/ast/v-for-directives-error/tree.json new file mode 100644 index 00000000..35425b5e --- /dev/null +++ b/test/fixtures/ast/v-for-directives-error/tree.json @@ -0,0 +1,155 @@ +[ + { + "type": "VElement", + "text": "", + "children": [ + { + "type": "VStartTag", + "text": "", + "children": [] + } + ] + } +] \ No newline at end of file diff --git a/test/fixtures/ast/v-for-directives-with-es5-2/ast.json b/test/fixtures/ast/v-for-directives-with-es5-2/ast.json new file mode 100644 index 00000000..242e4447 --- /dev/null +++ b/test/fixtures/ast/v-for-directives-with-es5-2/ast.json @@ -0,0 +1,1460 @@ +{ + "type": "Program", + "start": 0, + "end": 0, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 0 + } + }, + "range": [ + 0, + 0 + ], + "body": [], + "sourceType": "script", + "comments": [], + "tokens": [], + "templateBody": { + "type": "VElement", + "range": [ + 0, + 100 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "name": "template", + "rawName": "template", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "selfClosing": false, + "attributes": [] + }, + "children": [ + { + "type": "VText", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 15, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 15, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 20, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "column": 9, + "line": 2 + }, + "end": { + "column": 14, + "line": 2 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 26, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "expression": { + "type": "VForExpression", + "range": [ + 27, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "left": [ + { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "range": [ + 28, + 29 + ], + "name": "a" + }, + null, + { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "range": [ + 31, + 32 + ], + "name": "b" + } + ], + "right": { + "type": "Identifier", + "start": 37, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "range": [ + 37, + 41 + ], + "name": "list" + } + }, + "references": [ + { + "id": { + "type": "Identifier", + "start": 37, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "range": [ + 37, + 41 + ], + "name": "list" + }, + "mode": "r" + } + ] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 43, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + "variables": [ + { + "id": { + "type": "Identifier", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "range": [ + 28, + 29 + ], + "name": "a" + }, + "kind": "v-for" + }, + { + "id": { + "type": "Identifier", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "range": [ + 31, + 32 + ], + "name": "b" + }, + "kind": "v-for" + } + ] + }, + { + "type": "VText", + "range": [ + 49, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 54, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 38 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 54, + 82 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 32 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 59, + 81 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 59, + 64 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 59, + 64 + ], + "loc": { + "start": { + "column": 9, + "line": 3 + }, + "end": { + "column": 14, + "line": 3 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 65, + 81 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "expression": { + "type": "VForExpression", + "range": [ + 66, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 30 + } + }, + "left": [ + { + "type": "Identifier", + "start": 67, + "end": 68, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "range": [ + 67, + 68 + ], + "name": "a" + }, + null, + { + "type": "Identifier", + "start": 70, + "end": 71, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "range": [ + 70, + 71 + ], + "name": "b" + } + ], + "right": { + "type": "Identifier", + "start": 76, + "end": 80, + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 30 + } + }, + "range": [ + 76, + 80 + ], + "name": "list" + } + }, + "references": [ + { + "id": { + "type": "Identifier", + "start": 76, + "end": 80, + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 30 + } + }, + "range": [ + 76, + 80 + ], + "name": "list" + }, + "mode": "r" + } + ] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 82, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + "variables": [ + { + "id": { + "type": "Identifier", + "start": 67, + "end": 68, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "range": [ + 67, + 68 + ], + "name": "a" + }, + "kind": "v-for" + }, + { + "id": { + "type": "Identifier", + "start": 70, + "end": 71, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "range": [ + 70, + 71 + ], + "name": "b" + }, + "kind": "v-for" + } + ] + }, + { + "type": "VText", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 3, + "column": 38 + }, + "end": { + "line": 4, + "column": 0 + } + }, + "value": "\n" + } + ], + "endTag": { + "type": "VEndTag", + "range": [ + 89, + 100 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "variables": [], + "tokens": [ + { + "type": "HTMLTagOpen", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": "template" + }, + { + "type": "HTMLTagClose", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "column": 9, + "line": 2 + }, + "end": { + "column": 14, + "line": 2 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": "" + }, + { + "type": "Punctuator", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "value": "\"" + }, + { + "type": "Punctuator", + "value": "(", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Identifier", + "value": "a", + "start": 28, + "end": 29, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "range": [ + 28, + 29 + ] + }, + { + "type": "Punctuator", + "value": ",", + "start": 29, + "end": 30, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 19 + } + }, + "range": [ + 29, + 30 + ] + }, + { + "type": "Punctuator", + "value": ",", + "start": 30, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "range": [ + 30, + 31 + ] + }, + { + "type": "Identifier", + "value": "b", + "start": 31, + "end": 32, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 21 + } + }, + "range": [ + 31, + 32 + ] + }, + { + "type": "Punctuator", + "value": ")", + "start": 32, + "end": 33, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "range": [ + 32, + 33 + ] + }, + { + "type": "Keyword", + "value": "in", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "range": [ + 34, + 36 + ] + }, + { + "type": "Identifier", + "value": "list", + "start": 37, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 30 + } + }, + "range": [ + 37, + 41 + ] + }, + { + "type": "Punctuator", + "range": [ + 41, + 42 + ], + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 31 + } + }, + "value": "\"" + }, + { + "type": "HTMLTagClose", + "range": [ + 42, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 43, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 49, + 54 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 54, + 58 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 59, + 64 + ], + "loc": { + "start": { + "column": 9, + "line": 3 + }, + "end": { + "column": 14, + "line": 3 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 64, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "value": "" + }, + { + "type": "Punctuator", + "range": [ + 65, + 66 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "value": "\"" + }, + { + "type": "Punctuator", + "value": "(", + "start": 66, + "end": 67, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "range": [ + 66, + 67 + ] + }, + { + "type": "Identifier", + "value": "a", + "start": 67, + "end": 68, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "range": [ + 67, + 68 + ] + }, + { + "type": "Punctuator", + "value": ",", + "start": 68, + "end": 69, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "range": [ + 68, + 69 + ] + }, + { + "type": "Punctuator", + "value": ",", + "start": 69, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 20 + } + }, + "range": [ + 69, + 70 + ] + }, + { + "type": "Identifier", + "value": "b", + "start": 70, + "end": 71, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "range": [ + 70, + 71 + ] + }, + { + "type": "Punctuator", + "value": ")", + "start": 71, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "range": [ + 71, + 72 + ] + }, + { + "type": "Identifier", + "value": "of", + "start": 73, + "end": 75, + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 25 + } + }, + "range": [ + 73, + 75 + ] + }, + { + "type": "Identifier", + "value": "list", + "start": 76, + "end": 80, + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 30 + } + }, + "range": [ + 76, + 80 + ] + }, + { + "type": "Punctuator", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 31 + } + }, + "value": "\"" + }, + { + "type": "HTMLTagClose", + "range": [ + 81, + 82 + ], + "loc": { + "start": { + "line": 3, + "column": 31 + }, + "end": { + "line": 3, + "column": 32 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 82, + 87 + ], + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 87, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 38 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 88, + 89 + ], + "loc": { + "start": { + "line": 3, + "column": 38 + }, + "end": { + "line": 4, + "column": 0 + } + }, + "value": "\n" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 89, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 10 + } + }, + "value": "template" + }, + { + "type": "HTMLTagClose", + "range": [ + 99, + 100 + ], + "loc": { + "start": { + "line": 4, + "column": 10 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 100, + 101 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 5, + "column": 0 + } + }, + "value": "\n" + } + ], + "comments": [], + "errors": [] + } +} \ No newline at end of file diff --git a/test/fixtures/ast/v-for-directives-with-es5-2/parser-options.json b/test/fixtures/ast/v-for-directives-with-es5-2/parser-options.json new file mode 100644 index 00000000..fcc8a62f --- /dev/null +++ b/test/fixtures/ast/v-for-directives-with-es5-2/parser-options.json @@ -0,0 +1,3 @@ +{ + "ecmaVersion": 5 +} diff --git a/test/fixtures/ast/v-for-directives-with-es5-2/source.vue b/test/fixtures/ast/v-for-directives-with-es5-2/source.vue new file mode 100644 index 00000000..62baf98b --- /dev/null +++ b/test/fixtures/ast/v-for-directives-with-es5-2/source.vue @@ -0,0 +1,4 @@ + diff --git a/test/fixtures/ast/v-for-directives-with-es5-2/token-ranges.json b/test/fixtures/ast/v-for-directives-with-es5-2/token-ranges.json new file mode 100644 index 00000000..08954e33 --- /dev/null +++ b/test/fixtures/ast/v-for-directives-with-es5-2/token-ranges.json @@ -0,0 +1,42 @@ +[ + "", + "\n ", + "", + "", + "\n ", + "", + "", + "\n", + "", + "\n" +] \ No newline at end of file diff --git a/test/fixtures/ast/v-for-directives-with-es5-2/tree.json b/test/fixtures/ast/v-for-directives-with-es5-2/tree.json new file mode 100644 index 00000000..41b74240 --- /dev/null +++ b/test/fixtures/ast/v-for-directives-with-es5-2/tree.json @@ -0,0 +1,155 @@ +[ + { + "type": "VElement", + "text": "", + "children": [ + { + "type": "VStartTag", + "text": "", + "children": [] + } + ] + } +] \ No newline at end of file diff --git a/test/fixtures/ast/v-for-directives-with-es5/ast.json b/test/fixtures/ast/v-for-directives-with-es5/ast.json new file mode 100644 index 00000000..4672c8d4 --- /dev/null +++ b/test/fixtures/ast/v-for-directives-with-es5/ast.json @@ -0,0 +1,2544 @@ +{ + "type": "Program", + "start": 0, + "end": 0, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 0 + } + }, + "range": [ + 0, + 0 + ], + "body": [], + "sourceType": "script", + "comments": [], + "tokens": [], + "templateBody": { + "type": "VElement", + "range": [ + 0, + 174 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "name": "template", + "rawName": "template", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 0, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "selfClosing": false, + "attributes": [] + }, + "children": [ + { + "type": "VText", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 15, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 15, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 20, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "column": 9, + "line": 2 + }, + "end": { + "column": 14, + "line": 2 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 26, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "expression": { + "type": "VForExpression", + "range": [ + 27, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "left": [ + { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "range": [ + 27, + 28 + ], + "name": "a" + } + ], + "right": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "range": [ + 32, + 36 + ], + "name": "list" + } + }, + "references": [ + { + "id": { + "type": "Identifier", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "range": [ + 32, + 36 + ], + "name": "list" + }, + "mode": "r" + } + ] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 38, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + "variables": [ + { + "id": { + "type": "Identifier", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "range": [ + 27, + 28 + ], + "name": "a" + }, + "kind": "v-for" + } + ] + }, + { + "type": "VText", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 49, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 49, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 54, + 79 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 34 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 54, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 54, + 59 + ], + "loc": { + "start": { + "column": 9, + "line": 3 + }, + "end": { + "column": 14, + "line": 3 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 60, + 79 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 34 + } + }, + "expression": { + "type": "VForExpression", + "range": [ + 61, + 78 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "left": [ + { + "type": "Identifier", + "start": 62, + "end": 63, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "range": [ + 62, + 63 + ], + "name": "a" + }, + { + "type": "Identifier", + "start": 65, + "end": 66, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "range": [ + 65, + 66 + ], + "name": "b" + }, + { + "type": "Identifier", + "start": 68, + "end": 69, + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "range": [ + 68, + 69 + ], + "name": "c" + } + ], + "right": { + "type": "Identifier", + "start": 74, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "range": [ + 74, + 78 + ], + "name": "list" + } + }, + "references": [ + { + "id": { + "type": "Identifier", + "start": 74, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "range": [ + 74, + 78 + ], + "name": "list" + }, + "mode": "r" + } + ] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 80, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + "variables": [ + { + "id": { + "type": "Identifier", + "start": 62, + "end": 63, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "range": [ + 62, + 63 + ], + "name": "a" + }, + "kind": "v-for" + }, + { + "id": { + "type": "Identifier", + "start": 65, + "end": 66, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "range": [ + 65, + 66 + ], + "name": "b" + }, + "kind": "v-for" + }, + { + "id": { + "type": "Identifier", + "start": 68, + "end": 69, + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "range": [ + 68, + 69 + ], + "name": "c" + }, + "kind": "v-for" + } + ] + }, + { + "type": "VText", + "range": [ + 86, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 41 + }, + "end": { + "line": 4, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 91, + 120 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 33 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 91, + 114 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 27 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 96, + 113 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 26 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 96, + 101 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 96, + 101 + ], + "loc": { + "start": { + "column": 9, + "line": 4 + }, + "end": { + "column": 14, + "line": 4 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 102, + 113 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 26 + } + }, + "expression": { + "type": "VForExpression", + "range": [ + 103, + 112 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "left": [ + { + "type": "Identifier", + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + }, + "range": [ + 103, + 104 + ], + "name": "a" + } + ], + "right": { + "type": "Identifier", + "start": 108, + "end": 112, + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "range": [ + 108, + 112 + ], + "name": "list" + } + }, + "references": [ + { + "id": { + "type": "Identifier", + "start": 108, + "end": 112, + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "range": [ + 108, + 112 + ], + "name": "list" + }, + "mode": "r" + } + ] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 114, + 120 + ], + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + "variables": [ + { + "id": { + "type": "Identifier", + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + }, + "range": [ + 103, + 104 + ], + "name": "a" + }, + "kind": "v-for" + } + ] + }, + { + "type": "VText", + "range": [ + 120, + 125 + ], + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 5, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "VElement", + "range": [ + 125, + 162 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 41 + } + }, + "name": "div", + "rawName": "div", + "namespace": "http://www.w3.org/1999/xhtml", + "startTag": { + "type": "VStartTag", + "range": [ + 125, + 156 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 35 + } + }, + "selfClosing": false, + "attributes": [ + { + "type": "VAttribute", + "range": [ + 130, + 155 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 34 + } + }, + "directive": true, + "key": { + "type": "VDirectiveKey", + "range": [ + 130, + 135 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 14 + } + }, + "name": { + "type": "VIdentifier", + "range": [ + 130, + 135 + ], + "loc": { + "start": { + "column": 9, + "line": 5 + }, + "end": { + "column": 14, + "line": 5 + } + }, + "name": "for", + "rawName": "for" + }, + "argument": null, + "modifiers": [] + }, + "value": { + "type": "VExpressionContainer", + "range": [ + 136, + 155 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 34 + } + }, + "expression": { + "type": "VForExpression", + "range": [ + 137, + 154 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 33 + } + }, + "left": [ + { + "type": "Identifier", + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + }, + "range": [ + 138, + 139 + ], + "name": "a" + }, + { + "type": "Identifier", + "start": 141, + "end": 142, + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + }, + "range": [ + 141, + 142 + ], + "name": "b" + }, + { + "type": "Identifier", + "start": 144, + "end": 145, + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + }, + "range": [ + 144, + 145 + ], + "name": "c" + } + ], + "right": { + "type": "Identifier", + "start": 150, + "end": 154, + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 33 + } + }, + "range": [ + 150, + 154 + ], + "name": "list" + } + }, + "references": [ + { + "id": { + "type": "Identifier", + "start": 150, + "end": 154, + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 33 + } + }, + "range": [ + 150, + 154 + ], + "name": "list" + }, + "mode": "r" + } + ] + } + } + ] + }, + "children": [], + "endTag": { + "type": "VEndTag", + "range": [ + 156, + 162 + ], + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 41 + } + } + }, + "variables": [ + { + "id": { + "type": "Identifier", + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + }, + "range": [ + 138, + 139 + ], + "name": "a" + }, + "kind": "v-for" + }, + { + "id": { + "type": "Identifier", + "start": 141, + "end": 142, + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + }, + "range": [ + 141, + 142 + ], + "name": "b" + }, + "kind": "v-for" + }, + { + "id": { + "type": "Identifier", + "start": 144, + "end": 145, + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + }, + "range": [ + 144, + 145 + ], + "name": "c" + }, + "kind": "v-for" + } + ] + }, + { + "type": "VText", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 6, + "column": 0 + } + }, + "value": "\n" + } + ], + "endTag": { + "type": "VEndTag", + "range": [ + 163, + 174 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "variables": [], + "tokens": [ + { + "type": "HTMLTagOpen", + "range": [ + 0, + 9 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "value": "template" + }, + { + "type": "HTMLTagClose", + "range": [ + 9, + 10 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 1, + "column": 10 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 15, + 19 + ], + "loc": { + "start": { + "line": 2, + "column": 4 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 20, + 25 + ], + "loc": { + "start": { + "column": 9, + "line": 2 + }, + "end": { + "column": 14, + "line": 2 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 25, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 15 + } + }, + "value": "" + }, + { + "type": "Punctuator", + "range": [ + 26, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 16 + } + }, + "value": "\"" + }, + { + "type": "Identifier", + "value": "a", + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 17 + } + }, + "range": [ + 27, + 28 + ] + }, + { + "type": "Keyword", + "value": "in", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 20 + } + }, + "range": [ + 29, + 31 + ] + }, + { + "type": "Identifier", + "value": "list", + "start": 32, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 25 + } + }, + "range": [ + 32, + 36 + ] + }, + { + "type": "Punctuator", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 26 + } + }, + "value": "\"" + }, + { + "type": "HTMLTagClose", + "range": [ + 37, + 38 + ], + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 38, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 27 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 43, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 33 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 3, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 49, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 54, + 59 + ], + "loc": { + "start": { + "column": 9, + "line": 3 + }, + "end": { + "column": 14, + "line": 3 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 59, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 15 + } + }, + "value": "" + }, + { + "type": "Punctuator", + "range": [ + 60, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 16 + } + }, + "value": "\"" + }, + { + "type": "Punctuator", + "value": "(", + "start": 61, + "end": 62, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "range": [ + 61, + 62 + ] + }, + { + "type": "Identifier", + "value": "a", + "start": 62, + "end": 63, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 18 + } + }, + "range": [ + 62, + 63 + ] + }, + { + "type": "Punctuator", + "value": ",", + "start": 63, + "end": 64, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "range": [ + 63, + 64 + ] + }, + { + "type": "Identifier", + "value": "b", + "start": 65, + "end": 66, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 21 + } + }, + "range": [ + 65, + 66 + ] + }, + { + "type": "Punctuator", + "value": ",", + "start": 66, + "end": 67, + "loc": { + "start": { + "line": 3, + "column": 21 + }, + "end": { + "line": 3, + "column": 22 + } + }, + "range": [ + 66, + 67 + ] + }, + { + "type": "Identifier", + "value": "c", + "start": 68, + "end": 69, + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "range": [ + 68, + 69 + ] + }, + { + "type": "Punctuator", + "value": ")", + "start": 69, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 25 + } + }, + "range": [ + 69, + 70 + ] + }, + { + "type": "Keyword", + "value": "in", + "start": 71, + "end": 73, + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "range": [ + 71, + 73 + ] + }, + { + "type": "Identifier", + "value": "list", + "start": 74, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "range": [ + 74, + 78 + ] + }, + { + "type": "Punctuator", + "range": [ + 78, + 79 + ], + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 34 + } + }, + "value": "\"" + }, + { + "type": "HTMLTagClose", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 34 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 80, + 85 + ], + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 40 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 86, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 41 + }, + "end": { + "line": 4, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 91, + 95 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 96, + 101 + ], + "loc": { + "start": { + "column": 9, + "line": 4 + }, + "end": { + "column": 14, + "line": 4 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "value": "" + }, + { + "type": "Punctuator", + "range": [ + 102, + 103 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 16 + } + }, + "value": "\"" + }, + { + "type": "Identifier", + "value": "a", + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 17 + } + }, + "range": [ + 103, + 104 + ] + }, + { + "type": "Identifier", + "value": "of", + "start": 105, + "end": 107, + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 20 + } + }, + "range": [ + 105, + 107 + ] + }, + { + "type": "Identifier", + "value": "list", + "start": 108, + "end": 112, + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "range": [ + 108, + 112 + ] + }, + { + "type": "Punctuator", + "range": [ + 112, + 113 + ], + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 26 + } + }, + "value": "\"" + }, + { + "type": "HTMLTagClose", + "range": [ + 113, + 114 + ], + "loc": { + "start": { + "line": 4, + "column": 26 + }, + "end": { + "line": 4, + "column": 27 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 114, + 119 + ], + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 4, + "column": 32 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 119, + 120 + ], + "loc": { + "start": { + "line": 4, + "column": 32 + }, + "end": { + "line": 4, + "column": 33 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 120, + 125 + ], + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 5, + "column": 4 + } + }, + "value": "\n " + }, + { + "type": "HTMLTagOpen", + "range": [ + 125, + 129 + ], + "loc": { + "start": { + "line": 5, + "column": 4 + }, + "end": { + "line": 5, + "column": 8 + } + }, + "value": "div" + }, + { + "type": "HTMLIdentifier", + "range": [ + 130, + 135 + ], + "loc": { + "start": { + "column": 9, + "line": 5 + }, + "end": { + "column": 14, + "line": 5 + } + }, + "value": "v-for" + }, + { + "type": "HTMLAssociation", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 15 + } + }, + "value": "" + }, + { + "type": "Punctuator", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 16 + } + }, + "value": "\"" + }, + { + "type": "Punctuator", + "value": "(", + "start": 137, + "end": 138, + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 17 + } + }, + "range": [ + 137, + 138 + ] + }, + { + "type": "Identifier", + "value": "a", + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 18 + } + }, + "range": [ + 138, + 139 + ] + }, + { + "type": "Punctuator", + "value": ",", + "start": 139, + "end": 140, + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 19 + } + }, + "range": [ + 139, + 140 + ] + }, + { + "type": "Identifier", + "value": "b", + "start": 141, + "end": 142, + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 21 + } + }, + "range": [ + 141, + 142 + ] + }, + { + "type": "Punctuator", + "value": ",", + "start": 142, + "end": 143, + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 22 + } + }, + "range": [ + 142, + 143 + ] + }, + { + "type": "Identifier", + "value": "c", + "start": 144, + "end": 145, + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 24 + } + }, + "range": [ + 144, + 145 + ] + }, + { + "type": "Punctuator", + "value": ")", + "start": 145, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 25 + } + }, + "range": [ + 145, + 146 + ] + }, + { + "type": "Identifier", + "value": "of", + "start": 147, + "end": 149, + "loc": { + "start": { + "line": 5, + "column": 26 + }, + "end": { + "line": 5, + "column": 28 + } + }, + "range": [ + 147, + 149 + ] + }, + { + "type": "Identifier", + "value": "list", + "start": 150, + "end": 154, + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 33 + } + }, + "range": [ + 150, + 154 + ] + }, + { + "type": "Punctuator", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 5, + "column": 33 + }, + "end": { + "line": 5, + "column": 34 + } + }, + "value": "\"" + }, + { + "type": "HTMLTagClose", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 5, + "column": 34 + }, + "end": { + "line": 5, + "column": 35 + } + }, + "value": "" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 156, + 161 + ], + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 40 + } + }, + "value": "div" + }, + { + "type": "HTMLTagClose", + "range": [ + 161, + 162 + ], + "loc": { + "start": { + "line": 5, + "column": 40 + }, + "end": { + "line": 5, + "column": 41 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 5, + "column": 41 + }, + "end": { + "line": 6, + "column": 0 + } + }, + "value": "\n" + }, + { + "type": "HTMLEndTagOpen", + "range": [ + 163, + 173 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 10 + } + }, + "value": "template" + }, + { + "type": "HTMLTagClose", + "range": [ + 173, + 174 + ], + "loc": { + "start": { + "line": 6, + "column": 10 + }, + "end": { + "line": 6, + "column": 11 + } + }, + "value": "" + }, + { + "type": "HTMLWhitespace", + "range": [ + 174, + 175 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 7, + "column": 0 + } + }, + "value": "\n" + } + ], + "comments": [], + "errors": [] + } +} \ No newline at end of file diff --git a/test/fixtures/ast/v-for-directives-with-es5/parser-options.json b/test/fixtures/ast/v-for-directives-with-es5/parser-options.json new file mode 100644 index 00000000..fcc8a62f --- /dev/null +++ b/test/fixtures/ast/v-for-directives-with-es5/parser-options.json @@ -0,0 +1,3 @@ +{ + "ecmaVersion": 5 +} diff --git a/test/fixtures/ast/v-for-directives-with-es5/source.vue b/test/fixtures/ast/v-for-directives-with-es5/source.vue new file mode 100644 index 00000000..0a73ab28 --- /dev/null +++ b/test/fixtures/ast/v-for-directives-with-es5/source.vue @@ -0,0 +1,6 @@ + diff --git a/test/fixtures/ast/v-for-directives-with-es5/token-ranges.json b/test/fixtures/ast/v-for-directives-with-es5/token-ranges.json new file mode 100644 index 00000000..2a5a244b --- /dev/null +++ b/test/fixtures/ast/v-for-directives-with-es5/token-ranges.json @@ -0,0 +1,68 @@ +[ + "", + "\n ", + "", + "", + "\n ", + "", + "", + "\n ", + "", + "", + "\n ", + "", + "", + "\n", + "", + "\n" +] \ No newline at end of file diff --git a/test/fixtures/ast/v-for-directives-with-es5/tree.json b/test/fixtures/ast/v-for-directives-with-es5/tree.json new file mode 100644 index 00000000..bcea2ca7 --- /dev/null +++ b/test/fixtures/ast/v-for-directives-with-es5/tree.json @@ -0,0 +1,287 @@ +[ + { + "type": "VElement", + "text": "", + "children": [ + { + "type": "VStartTag", + "text": "", + "children": [] + } + ] + } +] \ No newline at end of file