Confirmed users, Bureaucrats and Sysops emeriti
419
edits
Line 59: | Line 59: | ||
Informal subset EBNF grammar for an XHTML-like markup language, with embedded <i>semantics</i>, capitalized non-terminals, and quoted or lowercase terminals. Unquoted terminals stand for the obvious lexical nonterminals, e.g. <code>tagname</code> is any valid HTML tag name other than those quoted tagnames used in the grammar (<code>button</code>, <code>iframe</code>, <code>script</code>). | Informal subset EBNF grammar for an XHTML-like markup language, with embedded <i>semantics</i>, capitalized non-terminals, and quoted or lowercase terminals. Unquoted terminals stand for the obvious lexical nonterminals, e.g. <code>tagname</code> is any valid HTML tag name other than those quoted tagnames used in the grammar (<code>button</code>, <code>iframe</code>, <code>script</code>). | ||
Document ::= Content | |||
Markup ::= < tagname /> | Content ::= (text | Markup)* | ||
Markup ::= < tagname /> | |||
<i>doc.appendChild(new Node(tagname))</i> | |||
| < tagname > | |||
<i>doc.pushChild(new Node(tagname))</i> | |||
Content | |||
<i>doc.setChildren(Content)</i> | |||
</ tagname > | |||
<i>doc.popChild()</i> | |||
| < 'button' 'onclick' '=' string > text </ 'button' > | |||
<i>doc.appendChild(new Button(string, text))</i> | |||
| < 'iframe' 'src' '=' string /> | |||
<i>doc.appendChild(new IFrame(string))</i> | |||
| < 'script' > text </ 'script' > | |||
<i>doc.appendChild(new Script(text)); eval(text)</i> |