|
|
|
@ -436,12 +436,16 @@ PEG.Grammar.ZeroOrMore.prototype.compile = function(resultVar) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PEG.Grammar.NotPredicate.prototype.compile = function(resultVar) {
|
|
|
|
|
var savedPosVar = PEG.Compiler.generateUniqueIdentifier("savedPos");
|
|
|
|
|
var expressionResultVar = PEG.Compiler.generateUniqueIdentifier("result");
|
|
|
|
|
var savedPosVar = PEG.Compiler.generateUniqueIdentifier("savedPos");
|
|
|
|
|
var savedReportMatchFailuresVar = PEG.Compiler.generateUniqueIdentifier("savedReportMatchFailuresVar");
|
|
|
|
|
var expressionResultVar = PEG.Compiler.generateUniqueIdentifier("result");
|
|
|
|
|
|
|
|
|
|
return PEG.Compiler.formatCode(
|
|
|
|
|
"var ${savedPosVar} = this._pos;",
|
|
|
|
|
"var ${savedReportMatchFailuresVar} = context.reportMatchFailures;",
|
|
|
|
|
"context.reportMatchFailures = false;",
|
|
|
|
|
"${expressionCode}",
|
|
|
|
|
"context.reportMatchFailures = ${savedReportMatchFailuresVar};",
|
|
|
|
|
"if (${expressionResultVar} === null) {",
|
|
|
|
|
" var ${resultVar} = '';",
|
|
|
|
|
"} else {",
|
|
|
|
@ -449,10 +453,11 @@ PEG.Grammar.NotPredicate.prototype.compile = function(resultVar) {
|
|
|
|
|
" this._pos = ${savedPosVar};",
|
|
|
|
|
"}",
|
|
|
|
|
{
|
|
|
|
|
expressionCode: this._expression.compile(expressionResultVar),
|
|
|
|
|
expressionResultVar: expressionResultVar,
|
|
|
|
|
savedPosVar: savedPosVar,
|
|
|
|
|
resultVar: resultVar
|
|
|
|
|
expressionCode: this._expression.compile(expressionResultVar),
|
|
|
|
|
expressionResultVar: expressionResultVar,
|
|
|
|
|
savedPosVar: savedPosVar,
|
|
|
|
|
savedReportMatchFailuresVar: savedReportMatchFailuresVar,
|
|
|
|
|
resultVar: resultVar
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|