Fix parser's use of underscore's template method to work with modern use of it.
This commit is contained in:
parent
176886f1ad
commit
d3e23dcb5d
@ -114,8 +114,9 @@ carto.Parser = function Parser(env) {
|
|||||||
// - `index`: Char. index where the error occurred.
|
// - `index`: Char. index where the error occurred.
|
||||||
function makeError(err) {
|
function makeError(err) {
|
||||||
var einput;
|
var einput;
|
||||||
|
var errorTemplate;
|
||||||
|
|
||||||
_(err).defaults({
|
_.defaults(err, {
|
||||||
index: furthest,
|
index: furthest,
|
||||||
filename: env.filename,
|
filename: env.filename,
|
||||||
message: 'Parse error.',
|
message: 'Parse error.',
|
||||||
@ -133,8 +134,8 @@ carto.Parser = function Parser(env) {
|
|||||||
for (var n = err.index; n >= 0 && einput.charAt(n) !== '\n'; n--) {
|
for (var n = err.index; n >= 0 && einput.charAt(n) !== '\n'; n--) {
|
||||||
err.column++;
|
err.column++;
|
||||||
}
|
}
|
||||||
|
errorTemplate = _.template('<%=filename%>:<%=line%>:<%=column%> <%=message%>');
|
||||||
return new Error(_('<%=filename%>:<%=line%>:<%=column%> <%=message%>').template(err));
|
return new Error(errorTemplate(err));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.env = env = env || {};
|
this.env = env = env || {};
|
||||||
|
Loading…
Reference in New Issue
Block a user