Syntax error messages: Use Oxford comma
In general PEG.js uses American English, where Oxford comma is prevalent. Part of #371.
This commit is contained in:
parent
ec8ede5bbe
commit
b3a90de020
|
@ -868,11 +868,18 @@ function generateJS(ast, options) {
|
|||
' descriptions.length = j;',
|
||||
' }',
|
||||
'',
|
||||
' return descriptions.length > 1',
|
||||
' ? descriptions.slice(0, -1).join(", ")',
|
||||
' + " or "',
|
||||
' + descriptions[descriptions.length - 1]',
|
||||
' : descriptions[0];',
|
||||
' switch (descriptions.length) {',
|
||||
' case 1:',
|
||||
' return descriptions[0];',
|
||||
'',
|
||||
' case 2:',
|
||||
' return descriptions[0] + " or " + descriptions[1];',
|
||||
'',
|
||||
' default:',
|
||||
' return descriptions.slice(0, -1).join(", ")',
|
||||
' + ", or "',
|
||||
' + descriptions[descriptions.length - 1];',
|
||||
' }',
|
||||
' }',
|
||||
'',
|
||||
' function describeFound(found) {',
|
||||
|
|
|
@ -1401,7 +1401,7 @@ describe("generated parser behavior", function() {
|
|||
var parser = peg.generate('start = "a" / "b" / "c"', options);
|
||||
|
||||
expect(parser).toFailToParse("d", {
|
||||
message: 'Expected "a", "b" or "c" but "d" found.'
|
||||
message: 'Expected "a", "b", or "c" but "d" found.'
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1433,7 +1433,7 @@ describe("generated parser behavior", function() {
|
|||
var parser = peg.generate('start = "c" / "b" / "a"', options);
|
||||
|
||||
expect(parser).toFailToParse("d", {
|
||||
message: 'Expected "a", "b" or "c" but "d" found.'
|
||||
message: 'Expected "a", "b", or "c" but "d" found.'
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue