Renamed "humanName" to "displayName".

redux
David Majda 14 years ago
parent bdfc2a57e7
commit 00a258d246

@ -64,9 +64,9 @@ PEG.Grammar.GrammarError.prototype = Error.prototype;
/* ===== PEG.Grammar.* ===== */
PEG.Grammar.Rule = function(name, humanName, expression) {
PEG.Grammar.Rule = function(name, displayName, expression) {
this._name = name;
this._humanName = humanName;
this._displayName = displayName;
this._expression = expression;
};
@ -239,7 +239,7 @@ PEG.Compiler = {
PEG.Grammar.Rule.prototype.compile = function() {
var resultVar = PEG.Compiler.generateUniqueIdentifier("result");
if (this._humanName !== null) {
if (this._displayName !== null) {
var setReportMatchFailuresCode = PEG.Compiler.formatCode(
"var savedReportMatchFailures = context.reportMatchFailures;",
"context.reportMatchFailures = false;"
@ -249,10 +249,10 @@ PEG.Grammar.Rule.prototype.compile = function() {
);
var reportMatchFailureCode = PEG.Compiler.formatCode(
"if (context.reportMatchFailures && ${resultVar} === null) {",
" this._matchFailed(new PEG.Parser.NamedRuleMatchFailure(${humanName|string}));",
" this._matchFailed(new PEG.Parser.NamedRuleMatchFailure(${displayName|string}));",
"}",
{
humanName: this._humanName,
displayName: this._displayName,
resultVar: resultVar
}
);

@ -218,10 +218,12 @@ PEG.Parser.AnyMatchFailure.prototype = {
/* Stores information about a failure to match a named rule. */
PEG.Parser.NamedRuleMatchFailure = function(humanName) { this._humanName = humanName; }
PEG.Parser.NamedRuleMatchFailure = function(displayName) {
this._displayName = displayName;
}
PEG.Parser.NamedRuleMatchFailure.prototype = {
toString: function() { return this._humanName; }
toString: function() { return this._displayName; }
};
/* ===== PEG.Parser.SyntaxError ===== */

Loading…
Cancel
Save