Factor out common URL regular expression code

This also eliminates the differences between the regular expressions.
This commit is contained in:
Richard Hansen 2020-12-11 15:55:13 -05:00 committed by John McLear
parent 66d0eb9a1f
commit 7e8de5540f
4 changed files with 74 additions and 73 deletions

View file

@ -19,6 +19,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const padutils = require('./pad_utils').padutils;
let _, $, jQuery, plugins, Ace2Common;
const browser = require('./browser');
if (browser.msie) {
@ -2806,13 +2809,9 @@ function Ace2Inner() {
}
}
// set of "letter or digit" chars is based on section 20.5.16 of the original Java Language Spec
const REGEX_WORDCHAR = /[\u0030-\u0039\u0041-\u005A\u0061-\u007A\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u1FFF\u3040-\u9FFF\uF900-\uFDFF\uFE70-\uFEFE\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFDC]/;
const REGEX_SPACE = /\s/;
function isWordChar(c) {
return !!REGEX_WORDCHAR.exec(c);
}
const isWordChar = (c) => padutils.wordCharRegex.test(c);
editorInfo.ace_isWordChar = isWordChar;
function isSpaceChar(c) {