decaffeinate-parser
Advanced tools
Comparing version 1.2.16 to 1.2.17
@@ -1753,6 +1753,17 @@ import * as CoffeeScript from 'coffee-script'; | ||
function buildQuasiWithString(range, raw) { | ||
var loc = mapper.invert(range[0]); | ||
return { | ||
type: 'String', | ||
data: raw, | ||
raw: source.slice.apply(source, babelHelpers.toConsumableArray(range)), | ||
line: loc.line + 1, | ||
column: loc.column, | ||
range: range | ||
}; | ||
} | ||
function quotesMatch(string) { | ||
var leftTripleQuoted = string.slice(0, 3) === '"""'; | ||
var rightTripleQuoted = string.slice(-3) === '"""'; | ||
if (string.slice(-4) === '\\"""') { | ||
@@ -1778,3 +1789,2 @@ // Don't count escaped quotes. | ||
} | ||
if (leftSingleQuoted !== rightSingleQuoted) { | ||
@@ -1788,3 +1798,2 @@ // Unbalanced. | ||
} | ||
elements.forEach(function (element, i) { | ||
@@ -1812,7 +1821,12 @@ if (i === 0) { | ||
quasis.push(buildFirstQuasi()); | ||
expressions.push(element); | ||
} else if (element.data && element.data.search(/^"(.*?)"$/) === 0) { | ||
quasis.push(buildQuasiWithString(element.range, element.raw)); | ||
} else if (quasis.length < expressions.length + 1) { | ||
var borderIndex = source.lastIndexOf('}#{', element.range[0]); | ||
quasis.push(buildQuasi([borderIndex + 1, borderIndex + 1])); | ||
expressions.push(element); | ||
} else { | ||
expressions.push(element); | ||
} | ||
expressions.push(element); | ||
} | ||
@@ -1819,0 +1833,0 @@ }); |
{ | ||
"name": "decaffeinate-parser", | ||
"version": "1.2.16", | ||
"version": "1.2.17", | ||
"description": "A better AST for CoffeeScript, inspired by CoffeeScriptRedux.", | ||
@@ -5,0 +5,0 @@ "main": "dist/decaffeinate-parser.umd.js", |
Sorry, the diff of this file is too big to display
130054
3558