jenkins-bot has submitted this change and it was merged. Change subject: Fix sol production to accept newline in non-sol context ......................................................................
Fix sol production to accept newline in non-sol context * Bug introduced in commit cef0e2c3 * Bug exposed by the changes to wikitext escaping tokenizing in commit e03a2ec0 -- that removed the "_" prefix trick for parsing strings in non-sol position and directly set SOL state in the tokenizer. * In non-sol position "\na" was not getting accepted by the tokenizer. It was failing. * This in turn crashed the serializer that used the tokenizer for wikitext escaping. * This bug led to a crasher during RT testing. http://parsoid.wmflabs.org:8001/result/2c45ade9723ea06f538ff5b2255dcb5d1fbbd601/ru/%D0%90%D0%BD%D0%B0%D1%82%D0%BE%D0%BB%D0%B8%D0%B9_%D0%90%D0%BB%D0%B5%D0%BA%D1%81%D0%B0%D0%BD%D0%B4%D1%80%D0%BE%D0%B2%D0%B8%D1%87_%D0%A2%D0%B8%D0%BC%D0%BE%D1%89%D1%83%D0%BA * This patch fixes the crasher. No change in any parser tests. Change-Id: I72b52fa7bc0b5765b5a3873f8775d21e5f56aa4d --- M js/lib/pegTokenizer.pegjs.txt 1 file changed, 10 insertions(+), 11 deletions(-) Approvals: GWicke: Looks good to me, approved jenkins-bot: Verified diff --git a/js/lib/pegTokenizer.pegjs.txt b/js/lib/pegTokenizer.pegjs.txt index d6f8ddc..5ca3314 100644 --- a/js/lib/pegTokenizer.pegjs.txt +++ b/js/lib/pegTokenizer.pegjs.txt @@ -2185,17 +2185,16 @@ // Start of line sol - = & { - // Use saved sol-state only at start of input - if (pos === 0) { - // If we have saved state of not being in sol posn, fail the production - if (pegArgs.pegTokenizer.savedSOL === false) { - return false; - } - } - return true; - } - nl:(newlineToken / & { return pos === 0; } { return []; }) + = nl:( + newlineToken + / & { + // Use saved sol-state only at start of input + // If we have saved state of not being in sol posn, fail the production + // NOTE: Explicitly check for 'false' and not a falsy value + return pos === 0 && pegArgs.pegTokenizer.savedSOL !== false; + } + { return []; } + ) // Eat multi-line comment, so that syntax after still matches as if it // was actually preceded by a newline cn:( c:comment n:newlineToken? { -- To view, visit https://gerrit.wikimedia.org/r/62134 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I72b52fa7bc0b5765b5a3873f8775d21e5f56aa4d Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Parsoid Gerrit-Branch: master Gerrit-Owner: Subramanya Sastry <[email protected]> Gerrit-Reviewer: GWicke <[email protected]> Gerrit-Reviewer: Subramanya Sastry <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
