Comparing version 12.0.1 to 12.0.2
@@ -36,2 +36,3 @@ "use strict"; | ||
.forEach(m => { | ||
var _a; | ||
const idx = +m.sourceFile.filename; | ||
@@ -57,6 +58,12 @@ const error = { | ||
paramToError.set(paramName, error); | ||
return; | ||
} | ||
else { | ||
report(error); | ||
if (m.code === grammarkdown_1.Diagnostics.Cannot_find_name_0_.code && | ||
spec.biblio.byProductionName((_a = m.messageArguments) === null || _a === void 0 ? void 0 : _a[0]) != null) { | ||
// grammarkdown assumes it has the whole grammar in scope | ||
// but some productions might be defined in an external biblio | ||
// TODO: thread the actual grammar through to grammarkdown so it has appropriate context, instead of surpressing this error | ||
return; | ||
} | ||
report(error); | ||
}); | ||
@@ -90,2 +97,8 @@ } | ||
if (originalRhses === undefined) { | ||
if (spec.biblio.byProductionName(name) != null) { | ||
// in an ideal world we'd keep the full grammar in the biblio so we could check for a matching RHS, not just a matching LHS | ||
// but, we're not in that world | ||
// https://github.com/tc39/ecmarkup/issues/431 | ||
continue; | ||
} | ||
const { line, column } = (0, utils_1.getLocationInGrammar)(grammar, production.pos); | ||
@@ -92,0 +105,0 @@ report({ |
@@ -32,2 +32,3 @@ "use strict"; | ||
let lists = []; | ||
let warned = false; | ||
for (const child of node.children) { | ||
@@ -37,4 +38,10 @@ if (child.nodeName === 'EMU-GRAMMAR') { | ||
if (lists.length === 0) { | ||
// TODO soft errors | ||
throw new Error('unrecognized structure for early errors: grammar without errors'); | ||
spec.warn({ | ||
type: 'node', | ||
node: grammar, | ||
ruleId: 'early-error-shape', | ||
message: 'unrecognized structure for early errors: multiple consecutive <emu-grammar>s without intervening <ul> of errors', | ||
}); | ||
warned = true; | ||
break; | ||
} | ||
@@ -48,3 +55,10 @@ earlyErrors.push({ grammar, lists }); | ||
if (grammar === null) { | ||
throw new Error('unrecognized structure for early errors: errors without corresponding grammar'); | ||
spec.warn({ | ||
type: 'node', | ||
node: child, | ||
ruleId: 'early-error-shape', | ||
message: 'unrecognized structure for early errors: <ul> without preceding <emu-grammar>', | ||
}); | ||
warned = true; | ||
break; | ||
} | ||
@@ -55,8 +69,24 @@ lists.push(child); | ||
if (grammar === null) { | ||
throw new Error('unrecognized structure for early errors: no grammars'); | ||
if (!warned) { | ||
spec.warn({ | ||
type: 'node', | ||
node, | ||
ruleId: 'early-error-shape', | ||
message: 'unrecognized structure for early errors: no <emu-grammar>', | ||
}); | ||
} | ||
} | ||
if (lists.length === 0) { | ||
throw new Error('unrecognized structure for early errors: grammar without errors'); | ||
else if (lists.length === 0) { | ||
if (!warned) { | ||
spec.warn({ | ||
type: 'node', | ||
node, | ||
ruleId: 'early-error-shape', | ||
message: 'unrecognized structure for early errors: no <ul> of errors', | ||
}); | ||
} | ||
} | ||
earlyErrors.push({ grammar, lists }); | ||
else { | ||
earlyErrors.push({ grammar, lists }); | ||
} | ||
} | ||
@@ -63,0 +93,0 @@ } |
{ | ||
"name": "ecmarkup", | ||
"version": "12.0.1", | ||
"version": "12.0.2", | ||
"description": "Custom element definitions and core utilities for markup that specifies ECMAScript and related technologies.", | ||
@@ -5,0 +5,0 @@ "main": "lib/ecmarkup.js", |
Sorry, the diff of this file is too big to display
419877
11236