XIMPEL playlist rules and syntax
Overview
Precedence:
- video leadsto has precedence over subject leadsto
- video repeat has precedence over video leadsto
- <video> is shorthand for <item type="video">
The syntax of augmented Backus-Naur Form (BNF), as described in rfc2616 by the The Internet Society (1999), is used to describe the XIMPEL syntax. The augmented BNF includes the following constructs:
- name = definition
The name of a rule is simply the name itself (without any enclosing "<" and ">") and is separated from its definition by the equal "=" character. White space is only significant in that indentation of continuation lines is used to indicate a rule definition that spans more than one line. Certain basic rules are in uppercase, such as SP, LWS, HT, CRLF, DIGIT, ALPHA, etc. Angle brackets are used within definitions whenever their presence will facilitate discerning the use of rule names. - "literal"
Quotation marks surround literal text. Unless stated otherwise, the text is case-sensitive. - rule1 | rule2
Elements separated by a bar ("|") are alternatives, e.g., "yes | no" will accept yes or no. - (rule1 rule2)
Elements enclosed in parentheses are treated as a single element. Thus, "(elem (foo | bar) elem)" allows the token sequences "elem foo elem" and "elem bar elem". - *rule
The character "*" preceding an element indicates repetition. The full form is "<n>*<m>element" indicating at least <n> and at most <m> occurrences of element. Default values are 0 and infinity so that "*(element)" allows any number, including zero; "1*element" requires at least one; and "1*2element" allows one or two. - [rule]
Square brackets enclose optional elements; "[foo bar]" is equivalent to "*1(foo bar)". - N rule
Specific repetition: "<n>(element)" is equivalent to "<n>*<n>(element)"; that is, exactly <n> occurrences of (element). Thus 2DIGIT is a 2-digit number, and 3ALPHA is a string of three alphabetic characters. - #rule
A construct "#" is defined, similar to "*", for defining lists of elements. The full form is "<n>#<m>element" indicating at least <n> and at most <m> elements, each separated by one or more commas (",") and OPTIONAL linear white space (LWS). This makes the usual form of lists very easy; a rule such as
( *LWS element *( *LWS "," *LWS element ))
can be shown as
1#element
Wherever this construct is used, null elements are allowed, but do not contribute to the count of elements present. That is, "(element), , (element) " is permitted, but counts as only two elements. Therefore, where at least one element is required, at least one non-null element MUST be present. Default values are 0 and infinity so that "#element" allows any number, including zero; "1#element" requires at least one; and "1#2element" allows one or two. - ; comment
A semi-colon, set off some distance to the right of rule text, starts a comment that continues to the end of line. This is a simple way of including useful notes in parallel with the specifications. - implied *LWS
The grammar described by this specification is word-based. Except where noted otherwise, linear white space (LWS) can be included between any two adjacent words (token or quoted-string), and between adjacent words and separators, without changing the interpretation of a field. At least one delimiter (LWS and/or separators) MUST exist between any two tokens (for the definition of "token" below), since they would otherwise be interpreted as a single token.
PLAYLIST = "<ximpel>" 1*SUBJECT "</ximpel>"
SUBJECT = "<subject" ID [LEADSTO] [EVENT_CALLBACK] ">" DESCRIPTION *SCORE MEDIA
"</subject>"
DESCRIPTION = "<description>" 1*CHAR "</description>"
SCORE = "<score" [NAME] VALUE "/>"
MEDIA = "<media" [ORDER] ">" 1*(ITEM|VIDEO) "</media>"
ITEM = "<item" TYPE [EXTRA] [LEADSTO] *ATTRIBUTE ">"
[BRANCHQUESTION] [QUIZ] [OVERLAYS] *CHAR "</item>"
VIDEO = "<video" FILE [EXTRA] [LEADSTO] [REPEAT] ">"
[BRANCHQUESTION] [QUIZ] [OVERLAYS] "</video>"
BRANCHQUESTION = "<branchquestion>" 1*CHAR "</branchquestion>"
QUIZ = QUIZQUESTION ANSWER
QUIZQUESTION = "<question" [STARTTIME] [DURATION] ">" 1*CHAR "</question>"
ANSWER = "<rightanswer>" BOOL "</rightanswer>"
OVERLAYS = "<overlays>" 1*OVERLAY "</overlays>"
OVERLAY = "<overlay" [STARTTIME] [DURATION] ">" 1*25OVERLAYCEL "</overlay>"
OVERLAYCEL = "<overlaycel" XPOS YPOS WIDTH HEIGHT LEADSTO [DESCRIPTION_ATTR]
[ALPHA_ATTR] [HOVER_ALPHA_ATTR] [COLOR_ATTR] [HOVER_COLOR_ATTR]
[IMAGE] [HOVER_IMAGE] [TEXT] [HOVER_TEXT] [TEXTCOLOR]
[HOVER_TEXTCOLOR] [TEXTSIZE] [HOVER_TEXTSIZE] [TEXTFONT]
[HOVER_TEXTFONT] "/>"
; everything following a "=" sign must be enclosed in quotes
ATTRIBUTE = 1*CHAR "="" 1*CHAR """
ALPHA_ATTR = "alpha="" ALPHA """
COLOR_ATTR = "color="" COLOR """
DESCRIPTION_ATTR = "description="" 1*CHAR """
DURATION = "duration="" 1*DIGIT """
EVENT_CALLBACK = EVENT [EVENT_PARAM]
EVENT = "event="" 1*CHAR """
EVENT_PARAM = "eventparam="" 1*CHAR """
EXTRA = "extra="" BOOL """
FILE = "file="" 1*CHAR """
HEIGHT = "height="" 1*DIGIT """
HOVER_ALPHA_ATTR = "hover_alpha="" ALPHA """
HOVER_COLOR_ATTR = "hover_color="" COLOR """
HOVER_IMAGE = "hover_image="" 1*CHAR """
HOVER_TEXT = "hover_text="" 1*CHAR """
HOVER_TEXTCOLOR = "hover_textcolor="" COLOR """
HOVER_TEXTFONT = "hover_textfont="" 1*CHAR """
HOVER_TEXTSIZE = "hover_textsize="" 1*DIGIT """
ID = "id="" 1*CHAR """
IMAGE = "image="" 1*CHAR """
LEADSTO = "leadsto="" 1*CHAR """
NAME = "name="" 1*CHAR """
ORDER = "order="" ("default" | ("random" [1*DIGIT])) """
REPEAT = "repeat="" BOOL """
TEXT = "text="" 1*CHAR """
TEXTCOLOR = "textcolor="" COLOR """
TEXTFONT = "textfont="" 1*CHAR """
TEXTSIZE = "textsize="" 1*DIGIT """
STARTTIME = "starttime="" 1*DIGIT """
TYPE = "type="" 1*CHAR """
VALUE = "value="" 1*CHAR """
WIDTH = "width="" 1*DIGIT """
XPOS = "x="" 1*DIGIT """
YPOS = "y="" 1*DIGIT """
CHAR = <any US-ASCII character (octets 0 - 127)>
UPALPHA = <any US-ASCII uppercase letter "A".."Z">
LOALPHA = <any US-ASCII lowercase letter "a".."z">
ALPHA = UPALPHA | LOALPHA
DIGIT = <any US-ASCII digit "0".."9">
HEX = "A" | "B" | "C" | "D" | "E" | "F"
| "a" | "b" | "c" | "d" | "e" | "f" | DIGIT
BOOL = "true" | "false"
ALPHA = ("0." 1*DIGIT) | ("1.0")
COLOR = "#" 6HEX