Jump to: navigation, search

User:Dylan Potter

1,754 bytes added, 16:10, 25 September 2012
== OSD600 ==
Over the weekend, I wrote a set of about 31 conformance tests for a webvtt parser ([[ 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.
<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>
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.

Navigation menu