AST: Remove the "rawText" property from "class" nodes

It isn't used anymore.
redux
David Majda 9 years ago
parent 35c8280743
commit e7d03825e0

@ -341,7 +341,6 @@
parts: filterEmptyStrings(parts),
inverted: inverted !== null,
ignoreCase: ignoreCase !== null,
rawText: text(),
location: location()
};
},

@ -79,13 +79,12 @@ describe("PEG.js grammar parser", function() {
);
}
function classGrammar(parts, inverted, ignoreCase, rawText) {
function classGrammar(parts, inverted, ignoreCase) {
return oneRuleGrammar({
type: "class",
parts: parts,
inverted: inverted,
ignoreCase: ignoreCase,
rawText: rawText
ignoreCase: ignoreCase
});
}
@ -360,7 +359,7 @@ describe("PEG.js grammar parser", function() {
/* Canonical PrimaryExpression is "\"abcd\"". */
it("parses PrimaryExpression", function() {
expect('start = "abcd"' ).toParseAs(trivialGrammar);
expect('start = [a-d]' ).toParseAs(classGrammar([["a", "d"]], false, false, '[a-d]'));
expect('start = [a-d]' ).toParseAs(classGrammar([["a", "d"]], false, false));
expect('start = .' ).toParseAs(anyGrammar());
expect('start = a' ).toParseAs(ruleRefGrammar("a"));
expect('start = &{ code }').toParseAs(oneRuleGrammar(semanticAnd));
@ -527,43 +526,38 @@ describe("PEG.js grammar parser", function() {
/* Canonical CharacterClassMatcher is "[a-d]". */
it("parses CharacterClassMatcher", function() {
expect('start = []').toParseAs(
classGrammar([], false, false, '[]')
classGrammar([], false, false)
);
expect('start = [a-d]').toParseAs(
classGrammar([["a", "d"]], false, false, '[a-d]')
classGrammar([["a", "d"]], false, false)
);
expect('start = [a]').toParseAs(
classGrammar(["a"], false, false, '[a]')
classGrammar(["a"], false, false)
);
expect('start = [a-de-hi-l]').toParseAs(
classGrammar(
[["a", "d"], ["e", "h"], ["i", "l"]],
false,
false,
'[a-de-hi-l]'
false
)
);
expect('start = [^a-d]').toParseAs(
classGrammar([["a", "d"]], true, false, '[^a-d]')
classGrammar([["a", "d"]], true, false)
);
expect('start = [a-d]i').toParseAs(
classGrammar([["a", "d"]], false, true, '[a-d]i')
classGrammar([["a", "d"]], false, true)
);
expect('start = [\\\n]').toParseAs(
classGrammar([], false, false, '[\\\n]')
classGrammar([], false, false)
);
});
/* Canonical ClassCharacterRange is "a-d". */
it("parses ClassCharacterRange", function() {
expect('start = [a-d]').toParseAs(
classGrammar([["a", "d"]], false, false, '[a-d]')
);
expect('start = [a-d]').toParseAs(classGrammar([["a", "d"]], false, false));
expect('start = [a-a]').toParseAs(
classGrammar([["a", "a"]], false, false, '[a-a]')
);
expect('start = [a-a]').toParseAs(classGrammar([["a", "a"]], false, false));
expect('start = [b-a]').toFailToParse({
message: "Invalid character range: b-a."
});
@ -571,15 +565,9 @@ describe("PEG.js grammar parser", function() {
/* Canonical ClassCharacter is "a". */
it("parses ClassCharacter", function() {
expect('start = [a]' ).toParseAs(
classGrammar(["a"], false, false, '[a]')
);
expect('start = [\\n]' ).toParseAs(
classGrammar(["\n"], false, false, '[\\n]')
);
expect('start = [\\\n]').toParseAs(
classGrammar([], false, false, '[\\\n]')
);
expect('start = [a]' ).toParseAs(classGrammar(["a"], false, false));
expect('start = [\\n]' ).toParseAs(classGrammar(["\n"], false, false));
expect('start = [\\\n]').toParseAs(classGrammar([], false, false));
expect('start = []]' ).toFailToParse();
expect('start = [\\]').toFailToParse();

@ -385,7 +385,6 @@ CharacterClassMatcher "character class"
parts: filterEmptyStrings(parts),
inverted: inverted !== null,
ignoreCase: ignoreCase !== null,
rawText: text(),
location: location()
};
}

Loading…
Cancel
Save