Cscott has uploaded a new change for review. https://gerrit.wikimedia.org/r/130506
Change subject: De-lint pegTokenizer.pegjs.txt. ...................................................................... De-lint pegTokenizer.pegjs.txt. Right now we're eval()ing the tokenizer as soon as PEG generates it... but if you dumped it to a file you'd notice a few things that jshint doesn't like. Change-Id: Ie9fb221a3330167287f8ad215cee6223df1ab328 --- M lib/mediawiki.tokenizer.peg.js M lib/pegTokenizer.pegjs.txt 2 files changed, 10 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/06/130506/1 diff --git a/lib/mediawiki.tokenizer.peg.js b/lib/mediawiki.tokenizer.peg.js index 361556b..1cbd8b2 100644 --- a/lib/mediawiki.tokenizer.peg.js +++ b/lib/mediawiki.tokenizer.peg.js @@ -112,6 +112,8 @@ // add jshint config tokenizerSource = '/* jshint loopfunc:true, latedef:false, nonstandard:true */\n' + + '/* global Set: false */\n'+ + '"use strict";\n' + tokenizerSource + ';'; // eval is not evil in the case of a grammar-generated tokenizer. diff --git a/lib/pegTokenizer.pegjs.txt b/lib/pegTokenizer.pegjs.txt index a399e87..8d0bd7a 100644 --- a/lib/pegTokenizer.pegjs.txt +++ b/lib/pegTokenizer.pegjs.txt @@ -146,7 +146,7 @@ // XXX: The following code is short-circuited because it is stricter // than the standard parser: - +/* switch (isbn.length) { case 10: for (i = 0; i < 9; i++) { @@ -156,12 +156,13 @@ return (checksum % 11 === 0); case 13: for (i = 0; i < 13; i++) { - /* jshint bitwise:false */ + // jshint bitwise:false checksum += parseInt(isbn[i], 10) * ((i & 1) ? 3 : 1); } return (checksum % 10 === 0) && (/^97[89]/.test(isbn)); } return false; +*/ }; @@ -334,9 +335,9 @@ da.srcTagName = name; } - if ( endTag != '' ) { + if ( endTag !== '' ) { tok = new EndTagTk( lcName, attribs, da ); - } else if ( selfClose != '' ) { + } else if ( selfClose !== '' ) { da.selfClose = true; tok = new SelfclosingTagTk( lcName, attribs, da ); } else { @@ -515,7 +516,10 @@ } tokens = b; } else if (b.constructor === String && b.attribs === undefined) { + /*jshint -W053 */ + // we need to make a non-primitive string in order to add properties b = new String( b ); + /*jshint +W053 */ if (b.dataAttribs === undefined) { b.dataAttribs = {}; } -- To view, visit https://gerrit.wikimedia.org/r/130506 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie9fb221a3330167287f8ad215cee6223df1ab328 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Cscott <canan...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits