// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: XML Shallow Parsing with Regular Expressions es5id: 15.10.2_A1_T1 description: "See bug http://bugzilla.mozilla.org/show_bug.cgi?id=103087" ---*/ // REX/Javascript 1.0 // Robert D. Cameron "REX: XML Shallow Parsing with Regular Expressions", // Technical Report TR 1998-17, School of Computing Science, Simon Fraser // University, November, 1998. // Copyright (c) 1998, Robert D. Cameron. // The following code may be freely used and distributed provided that // this copyright and citation notice remains intact and that modifications // or additions are clearly identified. var TextSE = "[^<]+"; var UntilHyphen = "[^-]*-"; var Until2Hyphens = UntilHyphen + "([^-]" + UntilHyphen + ")*-"; var CommentCE = Until2Hyphens + ">?"; var UntilRSBs = "[^\\]]*\\]([^\\]]+\\])*\\]+"; var CDATA_CE = UntilRSBs + "([^\\]>]" + UntilRSBs + ")*>"; var S = "[ \\n\\t\\r]+"; var NameStrt = "[A-Za-z_:]|[^\\x00-\\x7F]"; var NameChar = "[A-Za-z0-9_:.-]|[^\\x00-\\x7F]"; var Name = "(" + NameStrt + ")(" + NameChar + ")*"; var QuoteSE = '"[^"]' + "*" + '"' + "|'[^']*'"; var DT_IdentSE = S + Name + "(" + S + "(" + Name + "|" + QuoteSE + "))*"; var MarkupDeclCE = "([^\\]\"'><]+|" + QuoteSE + ")*>"; var S1 = "[\\n\\r\\t ]"; var UntilQMs = "[^?]*\\?+"; var PI_Tail = "\\?>|" + S1 + UntilQMs + "([^>?]" + UntilQMs + ")*>"; var DT_ItemSE = "<(!(--" + Until2Hyphens + ">|[^-]" + MarkupDeclCE + ")|\\?" + Name + "(" + PI_Tail + "))|%" + Name + ";|" + S; var DocTypeCE = DT_IdentSE + "(" + S + ")?(\\[(" + DT_ItemSE + ")*\\](" + S + ")?)?>?"; var DeclCE = "--(" + CommentCE + ")?|\\[CDATA\\[(" + CDATA_CE + ")?|DOCTYPE(" + DocTypeCE + ")?"; var PI_CE = Name + "(" + PI_Tail + ")?"; var EndTagCE = Name + "(" + S + ")?>?"; var AttValSE = '"[^<"]' + "*" + '"' + "|'[^<']*'"; var ElemTagCE = Name + "(" + S + Name + "(" + S + ")?=(" + S + ")?(" + AttValSE + "))*(" + S + ")?/?>?"; var MarkupSPE = "<(!(" + DeclCE + ")?|\\?(" + PI_CE + ")?|/(" + EndTagCE + ")?|(" + ElemTagCE + ")?)"; var XML_SPE = TextSE + "|" + MarkupSPE; /// //// ///// var __patterns = [TextSE,UntilHyphen,Until2Hyphens,CommentCE,UntilRSBs,CDATA_CE,S,NameStrt, NameChar, Name, QuoteSE, DT_IdentSE, MarkupDeclCE, S1,UntilQMs, PI_Tail, DT_ItemSE, DocTypeCE, DeclCE, PI_CE, EndTagCE, AttValSE, ElemTagCE, MarkupSPE, XML_SPE]; var __html=""+ '\n' + '
\n' + ' More about ellipses\n' + '
\n' + '\n' + ' More about rectangles\n' + '
\n' + 'Last Modified February 13, 2000
\n' + ' \n' + ''; ////////////////////////////////////////////////////////////////////////////// try { for(var index=0; index<__patterns.length; index++) { var __re = new RegExp(__patterns[index]); __re.test(__html); } } catch (e) { throw new Test262Error('#'+index+": XML Shallow Parsing with Regular Expression: "+__patterns[index]); } // ////////////////////////////////////////////////////////////////////////////// // TODO: Convert to assert.throws() format. reportCompare(0, 0);