porffor 0.0.0-b5da8c4 → 0.0.0-b78ef90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/rhemyn/parse.js +8 -8
package/package.json
CHANGED
package/rhemyn/parse.js
CHANGED
@@ -18,33 +18,33 @@ const getArg = (name, def) => {
|
|
18
18
|
};
|
19
19
|
|
20
20
|
// full is spec-compliant but slower. not needed most of the time. (evil)
|
21
|
-
const DotChars = (
|
21
|
+
const DotChars = ({
|
22
22
|
full: [ '\n', '\r', '\u2028', '\u2029' ],
|
23
23
|
simple: [ '\n', '\r' ],
|
24
24
|
fast: [ '\n' ]
|
25
25
|
})[getArg('regex-dot', 'fast')];
|
26
26
|
|
27
|
-
const WordChars = (
|
27
|
+
const WordChars = ({
|
28
28
|
full: [ [ 'a', 'z' ], [ 'A', 'Z' ], [ '0', '9' ], '_' ],
|
29
29
|
fast: [ [ '_', 'z' ], [ 'A', 'Z' ], [ '0', '9' ] ] // skip individual _ with _-z BUT it also matches '`'
|
30
30
|
})[getArg('regex-word', 'full')];
|
31
31
|
|
32
|
-
const WhitespaceChars = (
|
32
|
+
const WhitespaceChars = ({
|
33
33
|
full: [ ' ', '\t', '\n', '\r', '\u2028', '\u2029' ],
|
34
34
|
simple: [ ' ', '\t', '\n', '\r' ]
|
35
35
|
})[getArg('regex-ws', 'simple')];
|
36
36
|
|
37
37
|
const Metachars = {
|
38
38
|
unescaped: {
|
39
|
-
'.': [ DotChars
|
39
|
+
'.': [ DotChars, true ], // dot
|
40
40
|
},
|
41
41
|
escaped: {
|
42
42
|
d: [ [ [ '0', '9' ] ], false ], // digit
|
43
43
|
D: [ [ [ '0', '9' ] ], true ], // not digit
|
44
|
-
w: [ WordChars
|
45
|
-
W: [ WordChars
|
46
|
-
s: [ WhitespaceChars
|
47
|
-
S: [ WhitespaceChars
|
44
|
+
w: [ WordChars, false ], // word
|
45
|
+
W: [ WordChars, true ], // not word
|
46
|
+
s: [ WhitespaceChars, false ], // whitespace
|
47
|
+
S: [ WhitespaceChars, true ], // not whitespace
|
48
48
|
}
|
49
49
|
};
|
50
50
|
|