widlparser
widlparser copied to clipboard
Parser doesn't accept the correct syntax for `required [XAttr] typename attributename;`
Here are two fragments of WebCodecs WebIDL:
dictionary AudioDecoderConfig {
required DOMString codec;
[EnforceRange] required unsigned long sampleRate;
[EnforceRange] required unsigned long numberOfChannels;
BufferSource description;
};
and
dictionary AudioDecoderConfig {
required DOMString codec;
required [EnforceRange] unsigned long sampleRate;
required [EnforceRange] unsigned long numberOfChannels;
BufferSource description;
};
The former is incorrect per spec, and the latter is the correct way to do this. Chromium's parser accepts the correct syntax (https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/webcodecs/audio_decoder_config.idl;l=10-22?q=audiodecoderconfig&ss=chromium&start=11 is what they have in tree). Similarly, Firefox's WebIDL parser only accepts the correct syntax.
widlparser only seem to accept the syntax of the former example, and this is what we have in the spec today, but we'd like to merge https://github.com/w3c/webcodecs/pull/488 to align with actual implementations.