jenkins-bot has submitted this change and it was merged.

Change subject: T112631: Attempt to match tpl(arg) brace precedence
......................................................................


T112631: Attempt to match tpl(arg) brace precedence

 * The php parser's preprocessToXml does this from the inside, outward,
   so it doesn't seem this will work in some unmatched cases.

Change-Id: I3af9d86618ebadef46e5971799a7ba7f6a98bf5b
---
M lib/pegTokenizer.pegjs.txt
M tests/parserTests-blacklist.js
2 files changed, 5 insertions(+), 8 deletions(-)

Approvals:
  Subramanya Sastry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/pegTokenizer.pegjs.txt b/lib/pegTokenizer.pegjs.txt
index 06395f4..9113b5f 100644
--- a/lib/pegTokenizer.pegjs.txt
+++ b/lib/pegTokenizer.pegjs.txt
@@ -613,12 +613,9 @@
         return false;
       }
     }
-    r:( & '{{{{{{{' ob:'{' tpl:tplarg_or_template eb:'}' { return [ob, tpl, 
eb]; }
-      / & ( '{{{' &'{{{' tplarg ) r:tplarg { return r; }
-      // tplarg in template
-      / & ( '{{' &'{{{' tplarg )  r:template { return r; }
-      / tplarg
-      / template
+    r:( &('{{' &('{{{'+ !'{') tplarg) a:template { return a; }
+      / a:$('{' &('{{{'+ !'{'))? b:tplarg { return [a].concat(b); }
+      / a:$('{' &('{{' !'{'))? b:template { return [a].concat(b); }
     ) {
       stops.dec('templatedepth');
       return r;
@@ -629,7 +626,7 @@
     = tplarg_or_template / broken_template
 
 tplarg_or_template_or_bust "tplarg_or_template_or_bust"
-    = (tplarg_or_template / .)+
+    = r:(tplarg_or_template / .)+ { return tu.flattenIfArray(r); }
 
 broken_template
   = v:( '{{' space_or_newline+ '}}' / ( '{{{' / '}}}' / '{{' / '}}' )+ )
diff --git a/tests/parserTests-blacklist.js b/tests/parserTests-blacklist.js
index b7a4961..5e870a4 100644
--- a/tests/parserTests-blacklist.js
+++ b/tests/parserTests-blacklist.js
@@ -181,7 +181,7 @@
 add("wt2html", "Self closed html pairs (bug 5487)", "<center 
data-parsoid='{\"stx\":\"html\",\"dsr\":[0,47,8,9]}'><font id=\"bug\" 
data-parsoid='{\"stx\":\"html\",\"selfClose\":true,\"dsr\":[8,25,17,0]}'></font>Centered
 text</center>\n<div 
data-parsoid='{\"stx\":\"html\",\"dsr\":[48,88,5,6]}'><font id=\"bug2\" 
data-parsoid='{\"stx\":\"html\",\"selfClose\":true,\"dsr\":[53,71,18,0]}'></font>In
 div text</div>");
 add("wt2html", "Fuzz testing: Parser14", "<h2 
data-parsoid='{\"dsr\":[0,18,2,2]}'> onmouseover= </h2>\n<p 
data-parsoid='{\"dsr\":[19,33,0,0]}'><a rel=\"mw:ExtLink\" 
href=\"http://__TOC__\"; 
data-parsoid='{\"stx\":\"url\",\"dsr\":[19,33,0,0]}'>http://__TOC__</a></p>");
 add("wt2html", "Fuzz testing: Parser14-table", "<h2 
data-parsoid='{\"dsr\":[0,5,2,2]}'>a</h2>\n<table style=\"__TOC__\" 
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[6,22,16,0]}'></table>");
-add("wt2html", "Fuzz testing: Parser24", "<p 
data-parsoid='{\"fostered\":true,\"autoInsertedEnd\":true,\"dsr\":[0,0]}'><span 
typeof=\"mw:Nowiki\" 
data-parsoid='{\"src\":\"{{{\",\"dsr\":[3,6,0,0]}'>{{{</span>|\n<u class=\"|\" 
about=\"#mwt2\" typeof=\"mw:ExpandedAttrs\" 
data-parsoid='{\"stx\":\"html\",\"a\":{\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}\":null},\"sa\":{\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}\":\"\"},\"autoInsertedEnd\":true,\"dsr\":[8,0,74,0]}'
 
data-mw='{\"attribs\":[[{\"txt\":\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}\",\"html\":\"&lt;span
 about=\\\"#mwt1\\\" typeof=\\\"mw:Param\\\" 
data-parsoid=\\\"{&amp;quot;dsr&amp;quot;:[20,79,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}&amp;quot;}\\\">{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--&amp;gt;}}}&lt;/span>}\"},{\"html\":\"\"}]]}'>\n<br
 style=\"onmouseover='alert(document.cookie);' \" 
data-parsoid='{\"stx\":\"html\",\"selfClose\":true,\"dsr\":[83,0,53,0]}'/></u></p><p
 data-parsoid='{\"fostered\":true,\"autoInsertedEnd\":true,\"dsr\":[0,0]}'><u 
class=\"|\" about=\"#mwt2\" typeof=\"mw:ExpandedAttrs\" 
data-parsoid='{\"stx\":\"html\",\"a\":{\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}\":null},\"sa\":{\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}\":\"\"},\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[-37,0,0,0]}'
 
data-mw='{\"attribs\":[[{\"txt\":\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}\",\"html\":\"&lt;span
 about=\\\"#mwt1\\\" typeof=\\\"mw:Param\\\" 
data-parsoid=\\\"{&amp;quot;dsr&amp;quot;:[20,79,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}&amp;quot;}\\\">{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--&amp;gt;}}}&lt;/span>}\"},{\"html\":\"\"}]]}'>MOVE
 YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table 
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[0,177,2,0]}'>\n\n\n\n<tbody 
data-parsoid='{\"dsr\":[176,177,0,0]}'><tr 
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[176,177,0,0]}'><td
 
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[176,177,1,0]}'></td></tr></tbody></table>");
+add("wt2html", "Fuzz testing: Parser24", "<p 
data-parsoid='{\"fostered\":true,\"autoInsertedEnd\":true,\"dsr\":[0,0]}'><span 
typeof=\"mw:Nowiki\" 
data-parsoid='{\"src\":\"{{{\",\"dsr\":[3,6,0,0]}'>{{{</span>|\n<u class=\"|\" 
about=\"#mwt2\" typeof=\"mw:ExpandedAttrs\" 
data-parsoid='{\"stx\":\"html\",\"a\":{\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}\":null},\"sa\":{\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}\":\"\"},\"autoInsertedEnd\":true,\"dsr\":[8,0,74,0]}'
 
data-mw='{\"attribs\":[[{\"txt\":\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}\",\"html\":\"{&lt;span
 about=\\\"#mwt1\\\" typeof=\\\"mw:Param\\\" 
data-parsoid=\\\"{&amp;quot;dsr&amp;quot;:[21,79,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}&amp;quot;}\\\">{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--&amp;gt;}}}&lt;/span>}\"},{\"html\":\"\"}]]}'>\n<br
 style=\"onmouseover='alert(document.cookie);' \" 
data-parsoid='{\"stx\":\"html\",\"selfClose\":true,\"dsr\":[83,0,53,0]}'/></u></p><p
 data-parsoid='{\"fostered\":true,\"autoInsertedEnd\":true,\"dsr\":[0,0]}'><u 
class=\"|\" about=\"#mwt2\" typeof=\"mw:ExpandedAttrs\" 
data-parsoid='{\"stx\":\"html\",\"a\":{\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}\":null},\"sa\":{\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}}\":\"\"},\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[-37,0,0,0]}'
 
data-mw='{\"attribs\":[[{\"txt\":\"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->}}}}\",\"html\":\"{&lt;span
 about=\\\"#mwt1\\\" typeof=\\\"mw:Param\\\" 
data-parsoid=\\\"{&amp;quot;dsr&amp;quot;:[21,79,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx-->&lt;noinclude>}}}&amp;quot;}\\\">{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--&amp;gt;}}}&lt;/span>}\"},{\"html\":\"\"}]]}'>MOVE
 YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table 
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[0,177,2,0]}'>\n\n\n\n<tbody 
data-parsoid='{\"dsr\":[176,177,0,0]}'><tr 
data-parsoid='{\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[176,177,0,0]}'><td
 
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[176,177,1,0]}'></td></tr></tbody></table>");
 add("wt2html", "Fuzz testing: Parser25 (bug 6055)", "<li class=\"\" 
about=\"#mwt1\" typeof=\"mw:Param\" 
data-parsoid='{\"stx\":\"html\",\"srcTagName\":\"LI\",\"a\":{\"||\":null},\"sa\":{\"||\":\"\"},\"autoInsertedEnd\":true,\"dsr\":[0,110,15,0],\"src\":\"{{{\\n|
 \\n&lt;LI CLASS=||\\n >\\n}}}blah\\\" onmouseover=\\\"alert(&#39;hello 
world&#39;);\\\" align=\\\"left\\\"&#39;&#39;&#39;MOVE MOUSE CURSOR OVER 
HERE\"}'>\n<p data-parsoid='{\"dsr\":[26,110,0,0]}'>blah\" 
onmouseover=\"alert('hello world');\" align=\"left\"<b 
data-parsoid='{\"autoInsertedEnd\":true,\"dsr\":[80,110,3,0]}'>MOVE MOUSE 
CURSOR OVER HERE</b></p></li>");
 add("wt2html", "Inline HTML vs wiki block nesting", "<p 
data-parsoid='{\"dsr\":[0,17,0,0]}'><b 
data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[0,17,3,0]}'>Bold
 paragraph</b></p><b 
data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"autoInsertedStart\":true,\"dsr\":[17,37,0,0]}'>\n\n<p
 data-parsoid='{\"dsr\":[19,37,0,0]}'>New wiki paragraph</p></b>");
 add("wt2html", "Special page transclusion", "<p about=\"#mwt1\" 
typeof=\"mw:Transclusion\" data-parsoid='{\"dsr\":[0,30,0,0],\"pi\":[[]]}' 
data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"Special:Prefixindex/Xyzzyx\",\"function\":\"special\"},\"params\":{},\"i\":0}}]}'>Parser
 function implementation for pf_special missing in Parsoid.</p>");

-- 
To view, visit https://gerrit.wikimedia.org/r/239842
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3af9d86618ebadef46e5971799a7ba7f6a98bf5b
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to