diff --git a/common/content/autocommands.js b/common/content/autocommands.js index a8e97bcd..29a12cc3 100644 --- a/common/content/autocommands.js +++ b/common/content/autocommands.js @@ -22,52 +22,52 @@ const AutoCommands = Module("autocommands", { /** * Adds a new autocommand. *cmd* will be executed when one of the specified - * *events* occurs and the URL of the applicable buffer matches *regex*. + * *events* occurs and the URL of the applicable buffer matches *regexp*. * * @param {Array} events The array of event names for which this * autocommand should be executed. - * @param {string} regex The URL pattern to match against the buffer URL. + * @param {string} regexp The URL pattern to match against the buffer URL. * @param {string} cmd The Ex command to run. */ - add: function (events, regex, cmd) { + add: function (events, regexp, cmd) { events.forEach(function (event) { - this._store.push(AutoCommand(event, Option.parseRegex(regex), cmd)); + this._store.push(AutoCommand(event, Option.parseRegexp(regexp), cmd)); }, this); }, /** - * Returns all autocommands with a matching *event* and *regex*. + * Returns all autocommands with a matching *event* and *regexp*. * * @param {string} event The event name filter. - * @param {string} regex The URL pattern filter. + * @param {string} regexp The URL pattern filter. * @returns {AutoCommand[]} */ - get: function (event, regex) { - return this._store.filter(function (autoCmd) AutoCommands.matchAutoCmd(autoCmd, event, regex)); + get: function (event, regexp) { + return this._store.filter(function (autoCmd) AutoCommands.matchAutoCmd(autoCmd, event, regexp)); }, /** - * Deletes all autocommands with a matching *event* and *regex*. + * Deletes all autocommands with a matching *event* and *regexp*. * * @param {string} event The event name filter. - * @param {string} regex The URL pattern filter. + * @param {string} regexp The URL pattern filter. */ - remove: function (event, regex) { - this._store = this._store.filter(function (autoCmd) !AutoCommands.matchAutoCmd(autoCmd, event, regex)); + remove: function (event, regexp) { + this._store = this._store.filter(function (autoCmd) !AutoCommands.matchAutoCmd(autoCmd, event, regexp)); }, /** - * Lists all autocommands with a matching *event* and *regex*. + * Lists all autocommands with a matching *event* and *regexp*. * * @param {string} event The event name filter. - * @param {string} regex The URL pattern filter. + * @param {string} regexp The URL pattern filter. */ - list: function (event, regex) { + list: function (event, regexp) { let cmds = {}; // XXX this._store.forEach(function (autoCmd) { - if (AutoCommands.matchAutoCmd(autoCmd, event, regex)) { + if (AutoCommands.matchAutoCmd(autoCmd, event, regexp)) { cmds[autoCmd.event] = cmds[autoCmd.event] || []; cmds[autoCmd.event].push(autoCmd); } @@ -124,22 +124,22 @@ const AutoCommands = Module("autocommands", { } } }, { - matchAutoCmd: function (autoCmd, event, regex) { - return (!event || autoCmd.event == event) && (!regex || String(autoCmd.pattern) == regex); + matchAutoCmd: function (autoCmd, event, regexp) { + return (!event || autoCmd.event == event) && (!regexp || String(autoCmd.pattern) == regexp); } }, { commands: function () { commands.add(["au[tocmd]"], "Execute commands automatically on events", function (args) { - let [event, regex, cmd] = args; + let [event, regexp, cmd] = args; let events = []; try { - Option.parseRegex(regex); + Option.parseRegexp(regexp); } catch (e) { - dactyl.assert(false, "E475: Invalid argument: " + regex); + dactyl.assert(false, "E475: Invalid argument: " + regexp); } if (event) { @@ -154,7 +154,7 @@ const AutoCommands = Module("autocommands", { if (args.length > 2) { // add new command, possibly removing all others with the same event/pattern if (args.bang) - autocommands.remove(event, regex); + autocommands.remove(event, regexp); if (args["-javascript"]) { cmd = dactyl.userFunc("args", "with(args) {" + cmd + "}"); cmd.toString = function toString() "-javascript " + cmd.source; @@ -165,7 +165,7 @@ const AutoCommands = Module("autocommands", { cmd.toString = function toString() cmd.source; } cmd.source = args[2]; - autocommands.add(events, regex, cmd); + autocommands.add(events, regexp, cmd); } else { if (event == "*") @@ -174,10 +174,10 @@ const AutoCommands = Module("autocommands", { if (args.bang) { // TODO: "*" only appears to work in Vim when there is a {group} specified if (args[0] != "*" || args.length > 1) - autocommands.remove(event, regex); // remove all + autocommands.remove(event, regexp); // remove all } else - autocommands.list(event, regex); // list all + autocommands.list(event, regexp); // list all } }, { bang: true, diff --git a/common/content/buffer.js b/common/content/buffer.js index c93562b9..1d3a280e 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -567,11 +567,11 @@ const Buffer = Module("buffer", { yield elem; let res = util.evaluateXPath(path, frame.document); - for (let regex in values(regexps)) { + for (let regexp in values(regexps)) { for (let i in util.range(res.snapshotLength, 0, -1)) { let elem = res.snapshotItem(i); - if (regex.test(elem.textContent) === regex.result || regex.test(elem.title) === regex.result || - Array.some(elem.childNodes, function (child) regex.test(child.alt) === regex.result)) + if (regexp.test(elem.textContent) === regexp.result || regexp.test(elem.title) === regexp.result || + Array.some(elem.childNodes, function (child) regexp.test(child.alt) === regexp.result)) yield elem; } } @@ -1745,13 +1745,13 @@ const Buffer = Module("buffer", { options: function () { options.add(["nextpattern"], "Patterns to use when guessing the 'next' page in a document sequence", - "regexlist", UTF8("'\\bnext\\b',^>$,^(>>|»)$,^(>|»),(>|»)$,'\\bmore\\b'"), - { regexFlags: "i" }); + "regexplist", UTF8("'\\bnext\\b',^>$,^(>>|»)$,^(>|»),(>|»)$,'\\bmore\\b'"), + { regexpFlags: "i" }); options.add(["previouspattern"], "Patterns to use when guessing the 'previous' page in a document sequence", - "regexlist", UTF8("'\\bprev|previous\\b',^<$,^(<<|«)$,^(<|«),(<|«)$"), - { regexFlags: "i" }); + "regexplist", UTF8("'\\bprev|previous\\b',^<$,^(<<|«)$,^(<|«),(<|«)$"), + { regexpFlags: "i" }); options.add(["pageinfo", "pa"], "Desired info in the :pageinfo output", diff --git a/common/content/commandline.js b/common/content/commandline.js index 8aad710a..1e7b81d3 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -1657,7 +1657,7 @@ const CommandLine = Module("commandline", { // At the moment, adding "" breaks tab completion. Adding // "" has no effect. // TODO: Make non-keyword recognition smarter so that there need not - // be two lists of the same characters (one here and a regex in + // be two lists of the same characters (one here and a regexp in // mappings.js) mappings.add(myModes, ["", '"', "'"], "Expand command line abbreviation", diff --git a/common/content/completion.js b/common/content/completion.js index 06c28e1d..4db53b97 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -833,7 +833,7 @@ const Completion = Module("completion", { function (tok) contains(item.url, tok) || contains(item.title, tok))); - let re = RegExp(tokens.filter(util.identity).map(util.escapeRegex).join("|"), "g"); + let re = RegExp(tokens.filter(util.identity).map(util.escapeRegexp).join("|"), "g"); function highlight(item, text, i) process[i].call(this, item, template.highlightRegexp(text, re)); let process = context.process; context.process = [ @@ -895,7 +895,7 @@ const Completion = Module("completion", { options.add(["autocomplete", "au"], "Automatically update the completion list on any key press", - "regexlist", ".*"); + "regexplist", ".*"); options.add(["complete", "cpt"], "Items which are completed at the :open prompts", @@ -906,11 +906,11 @@ const Completion = Module("completion", { options.add(["wildanchor", "wia"], "Regexp list defining which contexts require matches anchored to the beginning of the result", - "regexlist", "!/ex/(back|buffer|ext|forward|help|undo)"); + "regexplist", "!/ex/(back|buffer|ext|forward|help|undo)"); options.add(["wildcase", "wic"], "Completion case matching mode", - "regexmap", ".?:smart", + "regexpmap", ".?:smart", { completer: function () [ ["smart", "Case is significant when capital letters are typed"], @@ -926,7 +926,7 @@ const Completion = Module("completion", { options.add(["wildsort", "wis"], "Regexp list of which contexts to sort", - "regexlist", ".*"); + "regexplist", ".*"); } }); diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 80f978ec..7339b9f2 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -1211,8 +1211,8 @@ const Dactyl = Module("dactyl", { "string", "intro"); options.add(["loadplugins", "lpl"], - "A regex list that defines which plugins are loaded at startup and via :loadplugins", - "regexlist", "'\\.(js|" + config.fileExtension + ")$'"); + "A regexp list that defines which plugins are loaded at startup and via :loadplugins", + "regexplist", "'\\.(js|" + config.fileExtension + ")$'"); options.add(["titlestring"], "Change the title of the window", @@ -1221,7 +1221,7 @@ const Dactyl = Module("dactyl", { setter: function (value) { let win = document.documentElement; function updateTitle(old, current) { - document.title = document.title.replace(RegExp("(.*)" + util.escapeRegex(old)), "$1" + current); + document.title = document.title.replace(RegExp("(.*)" + util.escapeRegexp(old)), "$1" + current); } // TODO: remove this FF3.5 test when we no longer support 3.0 @@ -1247,7 +1247,7 @@ const Dactyl = Module("dactyl", { }); options.add(["urlseparator", "us"], - "Set the separator regex used to separate multiple URL args", + "Set the separator regexp used to separate multiple URL args", "string", "\\|"); options.add(["verbose", "vbs"], diff --git a/common/content/finder.js b/common/content/finder.js index 9360fce8..673e93c3 100644 --- a/common/content/finder.js +++ b/common/content/finder.js @@ -27,7 +27,7 @@ const RangeFinder = Module("rangefinder", { let highlighted = this.rangeFind && this.rangeFind.highlighted; let selections = this.rangeFind && this.rangeFind.selections; - let regex = false; + let regexp = false; let matchCase = !(options["ignorecase"] || options["smartcase"] && !/[A-Z]/.test(str)); let linksOnly = options["linksearch"]; @@ -41,9 +41,9 @@ const RangeFinder = Module("rangefinder", { else if (n1 == "L") linksOnly = false; else if (n1 == "r") - regex = true; + regexp = true; else if (n1 == "R") - regex = false; + regexp = false; else return m; return ""; @@ -54,13 +54,13 @@ const RangeFinder = Module("rangefinder", { if (!this.rangeFind || this.rangeFind.window.get() != window || linksOnly != !!this.rangeFind.elementPath - || regex != this.rangeFind.regex + || regexp != this.rangeFind.regex || matchCase != this.rangeFind.matchCase || !!backward != this.rangeFind.reverse) { if (this.rangeFind) this.rangeFind.cancel(); - this.rangeFind = RangeFind(matchCase, backward, linksOnly && options["hinttags"], regex); + this.rangeFind = RangeFind(matchCase, backward, linksOnly && options["hinttags"], regexp); this.rangeFind.highlighted = highlighted; this.rangeFind.selections = selections; } @@ -259,14 +259,14 @@ const RangeFinder = Module("rangefinder", { * large amounts of data are concerned (e.g., for API documents). */ const RangeFind = Class("RangeFind", { - init: function (matchCase, backward, elementPath, regex) { + init: function (matchCase, backward, elementPath, regexp) { this.window = Cu.getWeakReference(window); this.elementPath = elementPath || null; this.reverse = Boolean(backward); this.finder = services.create("find"); this.matchCase = Boolean(matchCase); - this.regex = Boolean(regex); + this.regexp = Boolean(regexp); this.ranges = this.makeFrameList(window.content); @@ -282,8 +282,8 @@ const RangeFind = Class("RangeFind", { get matchCase() this.finder.caseSensitive, set matchCase(val) this.finder.caseSensitive = Boolean(val), - get regex() this.finder.regularExpression || false, - set regex(val) { + get regexp() this.finder.regularExpression || false, + set regexp(val) { try { return this.finder.regularExpression = Boolean(val); } diff --git a/common/content/hints.js b/common/content/hints.js index d5efa1e1..e3a27060 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -630,7 +630,7 @@ const Hints = Module("hints", { */ function wordStartsWithMatcher(hintString, allowWordOverleaping) { //{{{ let hintStrings = tokenize(/\s+/, hintString); - let wordSplitRegex = RegExp(options["wordseparators"]); + let wordSplitRegexp = RegExp(options["wordseparators"]); /** * Match a set of characters to the start of words. @@ -728,7 +728,7 @@ const Hints = Module("hints", { if (hintStrings.length == 1 && hintStrings[0].length == 0) return true; - let words = tokenize(wordSplitRegex, linkText); + let words = tokenize(wordSplitRegexp, linkText); if (hintStrings.length == 1) return charsAtBeginningOfWords(hintStrings[0], words, allowWordOverleaping); else @@ -1119,7 +1119,7 @@ const Hints = Module("hints", { options.add(["extendedhinttags", "eht"], "XPath string of hintable elements activated by ';'", - "regexmap", "[iI]:" + Option.quote(util.makeXPath(["img"])) + + "regexpmap", "[iI]:" + Option.quote(util.makeXPath(["img"])) + ",[OTivVWy]:" + Option.quote(util.makeXPath( ["{a,area}[@href]", "{img,iframe}[@src]"])) + ",[S]:" + Option.quote(util.makeXPath( diff --git a/common/content/io.js b/common/content/io.js index e3a87c4b..83362f39 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -761,7 +761,7 @@ lookup: options.add(["wildignore", "wig"], "List of file patterns to ignore when completing files", - "regexlist", ""); + "regexplist", ""); } }); diff --git a/common/content/options.js b/common/content/options.js index 0bf7b987..a9439a62 100644 --- a/common/content/options.js +++ b/common/content/options.js @@ -255,9 +255,9 @@ const Option = Class("Option", { * "number" - Integer, e.g., 1 * "string" - String, e.g., "Pentadactyl" * "charlist" - Character list, e.g., "rb" - * "regexlist" - Regex list, e.g., "^foo,bar$" + * "regexplist" - Regexp list, e.g., "^foo,bar$" * "stringmap" - String map, e.g., "key:v,foo:bar" - * "regexmap" - Regex map, e.g., "^key:v,foo$:bar" + * "regexpmap" - Regexp map, e.g., "^key:v,foo$:bar" */ type: null, @@ -384,28 +384,28 @@ const Option = Class("Option", { toggleAll: function toggleAll() toggleAll.supercall(this, "all") ^ !!toggleAll.superapply(this, arguments), }, - parseRegex: function (value, result, flags) { + parseRegexp: function (value, result, flags) { let [, bang, val] = /^(!?)(.*)/.exec(value); let re = RegExp(Option.dequote(val), flags); re.bang = bang; re.result = result !== undefined ? result : !bang; - re.toString = function () Option.unparseRegex(this); + re.toString = function () Option.unparseRegexp(this); return re; }, - unparseRegex: function (re) re.bang + Option.quote(re.source.replace(/\\(.)/g, function (m, n1) n1 == "/" ? n1 : m), /^!|:/) + + unparseRegexp: function (re) re.bang + Option.quote(re.source.replace(/\\(.)/g, function (m, n1) n1 == "/" ? n1 : m), /^!|:/) + (typeof re.result === "string" ? ":" + Option.quote(re.result) : ""), getKey: { stringlist: function (k) this.value.indexOf(k) >= 0, get charlist() this.stringlist, - regexlist: function (k, default_) { + regexplist: function (k, default_) { for (let re in values(this.value)) if (re.test(k)) return re.result; return arguments.length > 1 ? default_ : null; }, - get regexmap() this.regexlist + get regexpmap() this.regexplist }, stringify: { @@ -415,8 +415,8 @@ const Option = Class("Option", { stringmap: function (vals) [Option.quote(k, /:/) + ":" + Option.quote(v) for ([k, v] in Iterator(vals))].join(","), - regexlist: function (vals) vals.join(","), - get regexmap() this.regexlist + regexplist: function (vals) vals.join(","), + get regexpmap() this.regexplist }, parse: { @@ -428,9 +428,9 @@ const Option = Class("Option", { stringlist: function (value) (value === "") ? [] : Option.splitList(value), - regexlist: function (value) (value === "") ? [] : + regexplist: function (value) (value === "") ? [] : Option.splitList(value, true) - .map(function (re) Option.parseRegex(re, undefined, this.regexFlags), this), + .map(function (re) Option.parseRegexp(re, undefined, this.regexpFlags), this), stringmap: function (value) array.toObject( Option.splitList(value, true).map(function (v) { @@ -438,18 +438,18 @@ const Option = Class("Option", { return [key, Option.dequote(v.substr(count + 1))] })), - regexmap: function (value) + regexpmap: function (value) Option.splitList(value, true).map(function (v) { let [count, re, quote] = Commands.parseArg(v, /:/, true); v = Option.dequote(v.substr(count + 1)); if (count === v.length) [v, re] = [re, ".?"]; - return Option.parseRegex(re, v, this.regexFlags); + return Option.parseRegexp(re, v, this.regexpFlags); }, this) }, testValues: { - regexmap: function (vals, validator) vals.every(function (re) validator(re.result)), + regexpmap: function (vals, validator) vals.every(function (re) validator(re.result)), stringlist: function (vals, validator) vals.every(validator, this), stringmap: function (vals, validator) array(values(vals)).every(validator, this) }, @@ -557,8 +557,8 @@ const Option = Class("Option", { return null; }, get charlist() this.stringlist, - get regexlist() this.stringlist, - get regexmap() this.stringlist, + get regexplist() this.stringlist, + get regexpmap() this.stringlist, string: function (operator, values, scope, invert) { switch (operator) { @@ -593,7 +593,7 @@ const Option = Class("Option", { let res = context.fork("", 0, this, this.completer); if (!res) res = context.allItems.items.map(function (item) [item.text]); - if (this.type == "regexmap") + if (this.type == "regexpmap") return Array.concat(values).every(function (re) res.some(function (item) item[0] == re.result)); return Array.concat(values).every(function (value) res.some(function (item) item[0] == value)); }, @@ -1168,13 +1168,13 @@ const Options = Module("options", { if (!completer) completer = function () [["true", ""], ["false", ""]]; break; - case "regexlist": + case "regexplist": newValues = Option.splitList(context.filter); // Fallthrough case "stringlist": break; case "stringmap": - case "regexmap": + case "regexpmap": let vals = Option.splitList(context.filter); let target = vals.pop() || ""; let [count, key, quote] = Commands.parseArg(target, /:/, true); diff --git a/common/locale/en-US/index.xml b/common/locale/en-US/index.xml index 19a2c28e..600b90fd 100644 --- a/common/locale/en-US/index.xml +++ b/common/locale/en-US/index.xml @@ -424,7 +424,7 @@ This file contains a list of all available commands, mappings and options.
strictfocus
Prevent scripts from focusing input elements without user intervention
suggestengines
Engine Alias which has a feature of suggest
titlestring
Change the title of the window
-
urlseparator
Set the separator regex used to separate multiple URL args
+
urlseparator
Set the separator regexp used to separate multiple URL args
usermode
Show current website with a minimal style sheet to make it easily accessible
verbose
Define which info messages are displayed
visualbell
Use visual bell instead of beeping on errors
diff --git a/common/locale/en-US/options.xml b/common/locale/en-US/options.xml index 43718186..d682733e 100644 --- a/common/locale/en-US/options.xml +++ b/common/locale/en-US/options.xml @@ -46,8 +46,8 @@
stringmap
A comma-separated list of key-value pairs, e.g., key:val,foo:bar
-
-
regexlist
+
+
regexplist
A comma-separated list of regular expressions. Expressions may be prefixed with a !, in which case the match will be negated. A @@ -58,10 +58,10 @@ \, will not be treated as an item separator.
-
-
regexmap
+
+
regexpmap
- A combination of a stringmap and a regexlist. Each key + A combination of a stringmap and a regexplist. Each key in the key:value pair is a regexp. If the regexp begins with a !, the sense of the match is negated, such that a non-matching expression will be considered a match and vice versa. @@ -360,7 +360,7 @@ 'au' 'autocomplete' 'autocomplete' 'au' - regexlist + regexplist .*

@@ -602,7 +602,7 @@ 'eht' 'extendedhinttags' 'extendedhinttags' 'eht' - regexmap + regexpmap [iI]:'//img | //xhtml:img', [OTivVWy]:'//a[@href] | //xhtml:a[@href] | //area[@href] | //xhtml:area[@href] | @@ -947,7 +947,7 @@ 'nolpl' 'lpl' 'noloadplugins' 'loadplugins' 'loadplugins' 'lpl' - regexlist + regexplist '\.(js|&dactyl.fileExt;)$'

@@ -974,7 +974,7 @@

Note that in the first expression of the latter example you don't need parentheses, as the ! negates the whole of the - following expression (cf. regexlist). + following expression (cf. regexplist).

See also :runtime. @@ -1459,7 +1459,7 @@ 'wia' 'wildanchor' 'wildanchor' 'wia' - regexlist + regexplist !'/ex/(back|buffer|ext|forward|help|undo)'

@@ -1477,12 +1477,12 @@ 'wic' 'wildcase' 'wildcase' 'wic' - regexmap + regexpmap .?:smart

Defines how completions are matched with regard to character case. - Keys in the regexmap refer to completion context names (see + Keys in the regexpmap refer to completion context names (see :contexts) for which the value applies. Possible values are:

@@ -1498,7 +1498,7 @@ 'wildignore' 'wig' 'wildignore' 'wig' - regexlist + regexplist

@@ -1553,7 +1553,7 @@ 'wis' 'wildsort' 'wildsort' 'wis' - regexlist + regexplist .*

diff --git a/common/locale/en-US/repeat.xml b/common/locale/en-US/repeat.xml index 2581d7b1..4067bb8e 100644 --- a/common/locale/en-US/repeat.xml +++ b/common/locale/en-US/repeat.xml @@ -64,7 +64,7 @@

List recorded macros matching the optional regular expression - pat. If no regex is given, list all macros. + pat. If no regexp is given, list all macros.

diff --git a/common/modules/storage.jsm b/common/modules/storage.jsm index 3e1dd1d6..6c55e9f1 100644 --- a/common/modules/storage.jsm +++ b/common/modules/storage.jsm @@ -511,7 +511,7 @@ const File = Class("File", { // expand ~ // Yuck. - if (!relative && RegExp("~(?:$|[/" + util.escapeRegex(File.PATH_SEP) + "])").test(path)) { + if (!relative && RegExp("~(?:$|[/" + util.escapeRegexp(File.PATH_SEP) + "])").test(path)) { // Try $HOME first, on all systems let home = services.get("environment").get("HOME"); diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 8d144a2f..8b96e031 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -330,7 +330,7 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]) * @param {string} str * @returns {string} */ - escapeRegex: function escapeRegex(str) { + escapeRegexp: function escapeRegexp(str) { return str.replace(/([\\{}()[\].?*+])/g, "\\$1"); },