<Comment>/* test.js - test for javascript.xml syntax file */</Comment><br/>
<Comment>// Note: this script will not, and is not supposed to, compile in any js engine.</Comment><br/>
<Normal Text></Normal Text><br/>
<Comment>/* </Comment><br/>
<Comment>   </Comment><Alert Level 3>NOTE</Alert Level 3><Comment>: The words "todo", "fixme" and "note" should be rendered in a different style</Comment><br/>
<Comment>   within comments, match should be caseless (to test for regexp insensitive attribute).</Comment><br/>
<Comment>   The regex used for this rule is */</Comment><br/>
<Normal Text>   </Normal Text><Built-in Objects>String</Built-in Objects><Normal Text> </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Regular Expression>/</Regular Expression><Pattern Internal Operator>\b(?</Pattern Internal Operator><Regular Expression>:fixme</Regular Expression><Pattern Internal Operator>|</Pattern Internal Operator><Regular Expression>todo</Regular Expression><Pattern Internal Operator>|</Pattern Internal Operator><Regular Expression>note</Regular Expression><Pattern Internal Operator>)\b</Pattern Internal Operator><Regular Expression>/</Regular Expression><br/>
<Normal Text>   </Normal Text><Comment>/* Thus,  for example "Notebook" is not caught by</Comment><br/>
<Comment>   this rule. (the "?:" in the subpattern is there to avoid the regex engine wasting time</Comment><br/>
<Comment>   saving a backref, which is not used for anything. I do not know if the overhead of parsing</Comment><br/>
<Comment>   that is greater than the time saved by not capturing the text...)</Comment><br/>
<Comment>   The rule for catching these words is placed in a context "Comment common", which is used</Comment><br/>
<Comment>   by both comment contexts (single line, multiline) using the new "IncludeRules" item.</Comment><br/>
<Comment>*/</Comment><br/>
<Normal Text></Normal Text><br/>
<Comment>// test if regex support works - nice with new fallthrough prop in context:)</Comment><br/>
<Objects>somestring</Objects><Symbol>.</Symbol><Function Name>replace</Function Name><Normal Text>( </Normal Text><Regular Expression>/dooh/</Regular Expression><Normal Text> </Normal Text><Symbol>,</Symbol><Normal Text> </Normal Text><String>"bah!"</String><Normal Text>)</Normal Text><Symbol>;</Symbol><br/>
<Normal Text>re</Normal Text><Symbol>=</Symbol><Regular Expression>/foo/ig</Regular Expression><Symbol>;</Symbol><Normal Text> </Normal Text><Comment>// hehe</Comment><br/>
<Normal Text></Normal Text><br/>
<Objects>somestring</Objects><Symbol>.</Symbol><Function Name>search</Function Name><Normal Text>(</Normal Text><br/>
<Normal Text>       </Normal Text><Regular Expression>/</Regular Expression><Pattern Internal Operator>^</Pattern Internal Operator><Regular Expression>foo</Regular Expression><Pattern Character Class>\w</Pattern Character Class><Pattern Internal Operator>+</Pattern Internal Operator><Pattern Character Class>\s\d</Pattern Character Class><Pattern Internal Operator>{0,15}$</Pattern Internal Operator><Regular Expression>/</Regular Expression><br/>
<Normal Text>                  )</Normal Text><Symbol>;</Symbol><br/>
<Normal Text></Normal Text><br/>
<Normal Text>        re </Normal Text><Symbol>=</Symbol><br/>
<Normal Text>        </Normal Text><Regular Expression>/dooh/</Regular Expression><Symbol>;</Symbol><br/>
<Normal Text></Normal Text><br/>
<Comment>// This is supposedly legal:</Comment><br/>
<Normal Text>re </Normal Text><Symbol>=</Symbol><Normal Text> somebool </Normal Text><Symbol>?</Symbol><Normal Text> </Normal Text><Regular Expression>/foo/</Regular Expression><Normal Text> </Normal Text><Symbol>:</Symbol><Normal Text> </Normal Text><Regular Expression>/bar/</Regular Expression><Symbol>;</Symbol><br/>
<Normal Text></Normal Text><br/>
<Comment>// </Comment><Alert Level 3>NOTE</Alert Level 3><Comment> - Special case: an empty regex, not a comment.</Comment><br/>
<Comment>// The rule uses a positive lookahead assertion to catch it: "//(?=;)".</Comment><br/>
<Normal Text>re </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Comment>//;</Comment><br/>
<Normal Text>re </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Regular Expression>/a</Regular Expression><Pattern Internal Operator>|</Pattern Internal Operator><Regular Expression>b/</Regular Expression><Symbol>;</Symbol><br/>
<Normal Text></Normal Text><br/>
<Comment>/*</Comment><br/>
<Comment>   Tests for the regex parser.</Comment><br/>
<Comment>   It will parse classes, quanitfiers, special characters and regex operaters,</Comment><br/>
<Comment>   as specified in the netscape documentation for javascript.</Comment><br/>
<Comment>   Regexps are only parsed in their clean form, as the RegExp(string) constructor</Comment><br/>
<Comment>   is using a quoted string.</Comment><br/>
<Comment>   </Comment><Alert Level 2>TODO</Alert Level 2><Comment>: Find out if more regex feats should be supported.</Comment><br/>
<Comment>         Consider using more itemDatas - assertion, quantifier are options.</Comment><br/>
<Comment>*/</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text>re </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Regular Expression>/</Regular Expression><Pattern Internal Operator>^</Pattern Internal Operator><Regular Expression>text</Regular Expression><Pattern Character Class>\s</Pattern Character Class><Pattern Internal Operator>+</Pattern Internal Operator><Pattern Character Class>\d</Pattern Character Class><Pattern Internal Operator>+</Pattern Internal Operator><Pattern Character Class>\s</Pattern Character Class><Pattern Internal Operator>*$</Pattern Internal Operator><Regular Expression>/</Regular Expression><Symbol>;</Symbol><br/>
<Normal Text>re </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Regular Expression>/a pattern with caret </Regular Expression><Pattern Internal Operator>\(</Pattern Internal Operator><Regular Expression>^</Regular Expression><Pattern Internal Operator>\)</Pattern Internal Operator><Regular Expression> in it/</Regular Expression><Symbol>;</Symbol><br/>
<Normal Text>re </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Regular Expression>/</Regular Expression><Pattern Internal Operator>(</Pattern Internal Operator><Pattern Character Class>\d</Pattern Character Class><Pattern Internal Operator>{0,4})</Pattern Internal Operator><Pattern Character Class>\D</Pattern Character Class><Regular Expression>/</Regular Expression><Symbol>;</Symbol><br/>
<Normal Text>re </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Regular Expression>/</Regular Expression><Pattern Character Class>[a-zA-Z_]</Pattern Character Class><Pattern Internal Operator>+</Pattern Internal Operator><Regular Expression>/</Regular Expression><Symbol>;</Symbol><br/>
<Normal Text>re </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Regular Expression>/</Regular Expression><Pattern Character Class>[</Pattern Character Class><Pattern Internal Operator>^\d</Pattern Internal Operator><Pattern Character Class>^]</Pattern Character Class><Pattern Internal Operator>+</Pattern Internal Operator><Regular Expression>/</Regular Expression><Symbol>;</Symbol><br/>
<Normal Text>re </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Regular Expression>/</Regular Expression><Pattern Character Class>\s</Pattern Character Class><Pattern Internal Operator>+?</Pattern Internal Operator><Pattern Character Class>\w</Pattern Character Class><Pattern Internal Operator>+\.$</Pattern Internal Operator><Regular Expression>/</Regular Expression><Symbol>;</Symbol><br/>
<Normal Text>re </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Regular Expression>/</Regular Expression><Pattern Internal Operator>\/\/</Pattern Internal Operator><Regular Expression>/</Regular Expression><Symbol>;</Symbol><br/>
<Normal Text>re </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Regular Expression>/a</Regular Expression><Pattern Internal Operator>|</Pattern Internal Operator><Regular Expression>b/</Regular Expression><Symbol>;</Symbol><br/>
<Normal Text></Normal Text><br/>
<Comment>// the following are not regexps in E4X (=xml embedded into JavaScript)</Comment><br/>
<Keyword>var</Keyword><Normal Text> p </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Symbol><</Symbol><Normal Text>p</Normal Text><Symbol>></Symbol><Normal Text>Hello World</Normal Text><Symbol></</Symbol><Normal Text>p</Normal Text><Symbol>></Symbol><br/>
<Keyword>var</Keyword><Normal Text> p </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Regular Expression>/</</Regular Expression><br/>
<Keyword>var</Keyword><Normal Text> p </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Symbol>/>/</Symbol><br/>
<Normal Text></Normal Text><br/>
<Comment>// a test if #pop back from a comment will work</Comment><br/>
<Normal Text>re </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Comment>/*/foo/*/</Comment><Normal Text> </Normal Text><Regular Expression>/bar/</Regular Expression><Symbol>;</Symbol><br/>
<Comment>//           ^ POP</Comment><br/>
<Comment>//             ^ we got back after pop in comment, if there is regexp attribs here :-)</Comment><br/>
<Normal Text></Normal Text><br/>
<Comment>/*</Comment><br/>
<Comment>   Some tests if the fallthrough works.</Comment><br/>
<Comment>   The fallthrough happens if a regexp is not found in a possible (!) position,</Comment><br/>
<Comment>   which is after "search(" or "replace(" or "=" or "?" or ":" in version 0.1 of the xml file</Comment><br/>
<Comment>*/</Comment><br/>
<Normal Text></Normal Text><br/>
<Keyword>var</Keyword><Normal Text> foo </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><String>'bar'</String><Symbol>;</Symbol><br/>
<Comment>//        ^ fallthrough!</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text></Normal Text><br/>
<Objects>somestring</Objects><Symbol>.</Symbol><Function Name>replace</Function Name><Normal Text>( </Normal Text><Keyword>new</Keyword><Normal Text> </Normal Text><Built-in Objects>RegExp</Built-in Objects><Normal Text>(</Normal Text><String>"</String><Escape>\\</Escape><String>b</String><Escape>\\</Escape><String>w+</String><Escape>\\</Escape><String>b"</String><Normal Text>)</Normal Text><Symbol>,</Symbol><Normal Text> </Normal Text><String>"word: $1"</String><Normal Text>)</Normal Text><Symbol>;</Symbol><br/>
<Comment>//                  ^ fallthrough expected. ("new" whould be bold)</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text></Normal Text><br/>
<Objects>something</Objects><Symbol>.</Symbol><Object Member>method</Object Member><Normal Text> </Normal Text><Symbol>=</Symbol><br/>
<Normal Text>    </Normal Text><Keyword>function</Keyword><Normal Text> ( a</Normal Text><Symbol>,</Symbol><Normal Text> b</Normal Text><Symbol>,</Symbol><Normal Text> c ) { </Normal Text><Comment>/* ... */</Comment><Normal Text> }</Normal Text><br/>
<Comment>//  ^ fallthrough ?!</Comment><br/>
<Normal Text></Normal Text><br/>
<Objects>something</Objects><Symbol>.</Symbol><Object Member>other</Object Member><Normal Text> </Normal Text><Symbol>=</Symbol><br/>
<Keyword>function</Keyword><Normal Text> ( d</Normal Text><Symbol>,</Symbol><Normal Text> e</Normal Text><Symbol>,</Symbol><Normal Text> f ) { </Normal Text><Comment>/* ... */</Comment><Normal Text> }</Normal Text><br/>
<Comment>// fallthrough expected at col 0 ("function" should be bold)</Comment><br/>
<Normal Text></Normal Text><br/>
<Keyword>var</Keyword><Normal Text> ary </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Keyword>new</Keyword><Normal Text> </Normal Text><Built-in Objects>Array</Built-in Objects><Normal Text>(</Normal Text><Decimal>5</Decimal><Normal Text>)</Normal Text><Symbol>;</Symbol><br/>
<Comment>//        ^ fallthrough ? (if keyword is correctly rendered)</Comment><br/>
<Normal Text></Normal Text><br/>
<Keyword>var</Keyword><Normal Text> b </Normal Text><Symbol>=</Symbol><Normal Text> a </Normal Text><Symbol>?</Symbol><Normal Text> </Normal Text><Decimal>1</Decimal><Normal Text> </Normal Text><Symbol>:</Symbol><Normal Text> </Normal Text><Decimal>0</Decimal><Symbol>;</Symbol><br/>
<Comment>//          ^   ^ fallthroughs. numbers must be rendered correctly.</Comment><br/>
<Normal Text></Normal Text><br/>
<Keyword>var</Keyword><Normal Text> c </Normal Text><Symbol>=</Symbol><Normal Text> d </Normal Text><Symbol>?</Symbol><Normal Text> </Normal Text><Keyword>true</Keyword><Normal Text> </Normal Text><Symbol>:</Symbol><Normal Text> </Normal Text><Keyword>false</Keyword><Symbol>;</Symbol><br/>
<Normal Text></Normal Text><br/>
<Keyword>var</Keyword><Normal Text> conditinalstring </Normal Text><Symbol>=</Symbol><Normal Text> b </Normal Text><Symbol>?</Symbol><br/>
<Normal Text>  </Normal Text><String>"something"</String><Normal Text> </Normal Text><Symbol>:</Symbol><br/>
<Normal Text>  </Normal Text><String>"something else"</String><Symbol>;</Symbol><br/>
<Comment>// guess...</Comment><br/>
<Normal Text></Normal Text><br/>
<Normal Text></Normal Text><br/>
<Comment>/*</Comment><br/>
<Comment>   Normal program flow...</Comment><br/>
<Comment>*/</Comment><br/>
<Normal Text></Normal Text><br/>
<ControlFlow>if</ControlFlow><Normal Text> (something)</Normal Text><br/>
<Normal Text>  </Normal Text><Function Name>dostuff</Function Name><Normal Text>()</Normal Text><Symbol>;</Symbol><br/>
<ControlFlow>else</ControlFlow><br/>
<Normal Text>  </Normal Text><Function Name>dont</Function Name><Normal Text>()</Normal Text><Symbol>;</Symbol><br/>
<Normal Text></Normal Text><br/>
<Normal Text>  </Normal Text><ControlFlow>return</ControlFlow><Symbol>;</Symbol><br/>
<Normal Text></Normal Text><br/>
<ControlFlow>try</ControlFlow><Normal Text> { </Normal Text><Function Name>bla</Function Name><Normal Text>() } </Normal Text><ControlFlow>catch</ControlFlow><Normal Text> (e) { </Normal Text><Function Name>alert</Function Name><Normal Text>(</Normal Text><String>"ERROR! : "</String><Normal Text> </Normal Text><Symbol>+</Symbol><Normal Text> e) }</Normal Text><br/>
<Normal Text></Normal Text><br/>
<ControlFlow>for</ControlFlow><Normal Text> (int i</Normal Text><Symbol>=</Symbol><Decimal>0</Decimal><Symbol>;</Symbol><Normal Text> i </Normal Text><Symbol><</Symbol><Normal Text> j</Normal Text><Symbol>;</Symbol><Normal Text> i</Normal Text><Symbol>++</Symbol><Normal Text>)</Normal Text><br/>
<Normal Text>  </Normal Text><Built-in Objects>document</Built-in Objects><Symbol>.</Symbol><Object Method (Built-in)>write</Object Method (Built-in)><Normal Text>(</Normal Text><String>"i is"</String><Normal Text> </Normal Text><Symbol>+</Symbol><Normal Text> i </Normal Text><Symbol>+</Symbol><Normal Text> </Normal Text><String>"<br>"</String><Normal Text>)</Normal Text><Symbol>;</Symbol><br/>
<Normal Text></Normal Text><br/>
<ControlFlow>while</ControlFlow><Normal Text> (something)</Normal Text><br/>
<Normal Text>{</Normal Text><br/>
<Normal Text>  </Normal Text><Function Name>block</Function Name><Normal Text>()</Normal Text><Symbol>;</Symbol><br/>
<Normal Text>  </Normal Text><JSON>picky</JSON><Symbol>:</Symbol><br/>
<Normal Text>    </Normal Text><ControlFlow>if</ControlFlow><Normal Text> (</Normal Text><Symbol>!</Symbol><Decimal>1</Decimal><Normal Text>)</Normal Text><br/>
<Normal Text>      </Normal Text><ControlFlow>break</ControlFlow><Symbol>;</Symbol><br/>
<Normal Text>    </Normal Text><ControlFlow>else</ControlFlow><br/>
<Normal Text>      </Normal Text><ControlFlow>continue</ControlFlow><Symbol>;</Symbol><br/>
<Normal Text>}</Normal Text><br/>
<Normal Text></Normal Text><br/>
<ControlFlow>with</ControlFlow><Normal Text> (a) {</Normal Text><br/>
<Normal Text>  </Normal Text><ControlFlow>do</ControlFlow><Normal Text> {</Normal Text><br/>
<Normal Text>    </Normal Text><Function Name>stuff</Function Name><Normal Text>( b )</Normal Text><Symbol>;</Symbol><Normal Text> </Normal Text><Comment>// a.b if it exists</Comment><br/>
<Normal Text>  } </Normal Text><ControlFlow>while</ControlFlow><Normal Text> (itmakessense)</Normal Text><Symbol>;</Symbol><br/>
<Normal Text>}</Normal Text><br/>
<Normal Text></Normal Text><br/>
<ControlFlow>switch</ControlFlow><Normal Text> (i) {</Normal Text><br/>
<Normal Text>  </Normal Text><ControlFlow>case</ControlFlow><Normal Text> </Normal Text><Decimal>0</Decimal><Symbol>:</Symbol><br/>
<Normal Text>  </Normal Text><Function Name>f</Function Name><Normal Text>()</Normal Text><Symbol>;</Symbol><br/>
<Normal Text>  </Normal Text><ControlFlow>break</ControlFlow><Symbol>;</Symbol><br/>
<Normal Text>  </Normal Text><ControlFlow>default</ControlFlow><Symbol>:</Symbol><br/>
<Normal Text>  </Normal Text><ControlFlow>break</ControlFlow><Symbol>;</Symbol><br/>
<Normal Text>}</Normal Text><br/>
<Normal Text></Normal Text><br/>
<Comment>// Numerics</Comment><br/>
<Keyword>var</Keyword><Normal Text> a </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Hex>0xA</Hex><Symbol>;</Symbol><br/>
<Keyword>var</Keyword><Normal Text> b </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Binary>0b1</Binary><Symbol>;</Symbol><br/>
<Keyword>var</Keyword><Normal Text> c </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Octal>0o7</Octal><Symbol>;</Symbol><br/>
<Keyword>var</Keyword><Normal Text> d </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Float>1.1E+3</Float><Symbol>;</Symbol><br/>
<Keyword>var</Keyword><Normal Text> e </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Float>1.E+3</Float><Symbol>;</Symbol><br/>
<Keyword>var</Keyword><Normal Text> f </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Float>.1E+3</Float><Symbol>;</Symbol><br/>
<Keyword>var</Keyword><Normal Text> g </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Float>1E+3</Float><Symbol>;</Symbol><br/>
<Keyword>var</Keyword><Normal Text> h </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Float>1.1</Float><Symbol>;</Symbol><br/>
<Keyword>var</Keyword><Normal Text> i </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Float>1.</Float><Symbol>;</Symbol><br/>
<Keyword>var</Keyword><Normal Text> j </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Float>.1</Float><Symbol>;</Symbol><br/>
<Keyword>var</Keyword><Normal Text> k </Normal Text><Symbol>=</Symbol><Normal Text>  </Normal Text><Decimal>1</Decimal><Symbol>;</Symbol><br/>
<Comment>// Bigint</Comment><br/>
<Keyword>const</Keyword><Normal Text> binBig </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Binary>0b101</Binary><Normal Text>n</Normal Text><Symbol>;</Symbol><br/>
<Keyword>const</Keyword><Normal Text> octBig </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Octal>0o567</Octal><Normal Text>n</Normal Text><Symbol>;</Symbol><br/>
<Keyword>const</Keyword><Normal Text> hexBig </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Hex>0xC0B</Hex><Normal Text>n</Normal Text><Symbol>;</Symbol><br/>
<Keyword>const</Keyword><Normal Text> decBig </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Decimal>123</Decimal><Normal Text>n</Normal Text><Symbol>;</Symbol><br/>
<Comment>// Invalid numbers</Comment><br/>
<Keyword>var</Keyword><Normal Text> l </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Error>0xA1t</Error><Symbol>;</Symbol><br/>
<Keyword>var</Keyword><Normal Text> m </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Error>0b0123</Error><Symbol>;</Symbol><br/>
<Keyword>var</Keyword><Normal Text> n </Normal Text><Symbol>=</Symbol><Normal Text> </Normal Text><Error>0o29</Error><Symbol>;</Symbol><br/>
