1
edit
Changes
→OSD600
== OSD600 ==
<u>09/25/2012:</u>
Over the weekend, I wrote a set of about 31 conformance tests for a webvtt parser ([[https://github.com/downloads/caitp/webvtt/caitp-cue_settings_tests-09232012.tgz here]], more recent ones should be posted [OSD600/webvtt/cue_settings|here]).
This is a relatively simple section of the draft, as far as I can tell. It can be illustrated essentially like this (BNF, no state machine diagram here) -- regular expressions have been included in some areas, eg /[0-9]+/. I'm not including the BNF for the other cue-settings here, this is just a start. The main point is that BNF will be helpful for writing scanners and parsers.
<pre>
<webvtt-delimiter> ::= U+0020
| U+0009
<webvtt-delimiters> ::= <webvtt-delimiter>
| <webvtt-delimiters> <webvtt-delimiter>
<vertical-value> ::= "rl"
| "lr"
<vertical-setting> ::= "vertical" ":" <vertical-value>
<line-value-pct> ::= /[0-9]+/ "%"
<line-value-num> ::= /[0-9]+/
| "-" /[0-9]+/
<line-value> ::= <line-value-pct>
| <line-value-num>
<line-setting> ::= "line" ":" <line-value>
<cue-setting> ::= <vertical-setting>
| <line-setting>
| <position-setting>
| <size-setting>
| <align-setting>
<cue-settings> ::= <cue-setting>
| <cue-settings> <webvtt-delimiters> <cue-setting>
</pre>
Some implementation details for the parser:
The spec allows for multiple cue-settings per line (as shown in the BNF), however, the same line setting may not be repeated twice, which would not be caught by a parser generator based on the BNF alone, and would have to be checked for in code.
<u>09/10/2012:</u>