Skip to content

Commit

Permalink
re-added parser noop-functions - these are implemented by DebugParser
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Gaggl committed May 6, 2021
1 parent ef7fcb2 commit 25d4b09
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ Parser.prototype.parse = function(parseUntil) {
if (!token.contents) {
this.emptyVariable(token);
}
let filterExpression;
try {
filterExpression = this.compileFilter(token.contents);
} catch (e if e instanceof TemplateSyntaxError) {
this.compileFilterError(token, e);
throw e;
}
let node = this.createVariableNode(this.compileFilter(token.contents));
this.extendNodeList(nodeList, node, token);
} else if (token.tokenType === constants.TOKEN_BLOCK) {
Expand All @@ -76,11 +83,20 @@ Parser.prototype.parse = function(parseUntil) {
this.prependToken(token);
return nodeList;
}
this.enterCommand(command, token);
let compileFunc = this.tags[command];
if (!compileFunc || !(typeof (compileFunc) == 'function')) {
this.invalidBlockTag(token, command);
}
this.extendNodeList(nodeList, compileFunc(this, token), token);
let compiledResult;
try {
compiledResult = compileFunc(this, token);
} catch (e if e instanceof TemplateSyntaxError) {
this.compileFunctionError(token, e);
throw e;
}
this.extendNodeList(nodeList, compiledResult, token);
this.exitCommand();
}
}
if (parseUntil.length > 0) {
Expand Down Expand Up @@ -161,3 +177,8 @@ Parser.prototype.createNodeList = function() {
Parser.prototype.error = function(token, msg) {
return new TemplateSyntaxError(msg);
};

Parser.prototype.enterCommand = () => {};
Parser.prototype.exitCommand = () => {};
Parser.prototype.compileFunctionError = () => {};
Parser.prototype.compileFilterError = () => {};

0 comments on commit 25d4b09

Please sign in to comment.