[6a3a178] | 1 | var types = require('./types');
|
---|
| 2 |
|
---|
| 3 | var INTS = function() {
|
---|
| 4 | return [{ type: types.RANGE , from: 48, to: 57 }];
|
---|
| 5 | };
|
---|
| 6 |
|
---|
| 7 | var WORDS = function() {
|
---|
| 8 | return [
|
---|
| 9 | { type: types.CHAR, value: 95 },
|
---|
| 10 | { type: types.RANGE, from: 97, to: 122 },
|
---|
| 11 | { type: types.RANGE, from: 65, to: 90 }
|
---|
| 12 | ].concat(INTS());
|
---|
| 13 | };
|
---|
| 14 |
|
---|
| 15 | var WHITESPACE = function() {
|
---|
| 16 | return [
|
---|
| 17 | { type: types.CHAR, value: 9 },
|
---|
| 18 | { type: types.CHAR, value: 10 },
|
---|
| 19 | { type: types.CHAR, value: 11 },
|
---|
| 20 | { type: types.CHAR, value: 12 },
|
---|
| 21 | { type: types.CHAR, value: 13 },
|
---|
| 22 | { type: types.CHAR, value: 32 },
|
---|
| 23 | { type: types.CHAR, value: 160 },
|
---|
| 24 | { type: types.CHAR, value: 5760 },
|
---|
| 25 | { type: types.CHAR, value: 6158 },
|
---|
| 26 | { type: types.CHAR, value: 8192 },
|
---|
| 27 | { type: types.CHAR, value: 8193 },
|
---|
| 28 | { type: types.CHAR, value: 8194 },
|
---|
| 29 | { type: types.CHAR, value: 8195 },
|
---|
| 30 | { type: types.CHAR, value: 8196 },
|
---|
| 31 | { type: types.CHAR, value: 8197 },
|
---|
| 32 | { type: types.CHAR, value: 8198 },
|
---|
| 33 | { type: types.CHAR, value: 8199 },
|
---|
| 34 | { type: types.CHAR, value: 8200 },
|
---|
| 35 | { type: types.CHAR, value: 8201 },
|
---|
| 36 | { type: types.CHAR, value: 8202 },
|
---|
| 37 | { type: types.CHAR, value: 8232 },
|
---|
| 38 | { type: types.CHAR, value: 8233 },
|
---|
| 39 | { type: types.CHAR, value: 8239 },
|
---|
| 40 | { type: types.CHAR, value: 8287 },
|
---|
| 41 | { type: types.CHAR, value: 12288 },
|
---|
| 42 | { type: types.CHAR, value: 65279 }
|
---|
| 43 | ];
|
---|
| 44 | };
|
---|
| 45 |
|
---|
| 46 | var NOTANYCHAR = function() {
|
---|
| 47 | return [
|
---|
| 48 | { type: types.CHAR, value: 10 },
|
---|
| 49 | { type: types.CHAR, value: 13 },
|
---|
| 50 | { type: types.CHAR, value: 8232 },
|
---|
| 51 | { type: types.CHAR, value: 8233 },
|
---|
| 52 | ];
|
---|
| 53 | };
|
---|
| 54 |
|
---|
| 55 | // Predefined class objects.
|
---|
| 56 | exports.words = function() {
|
---|
| 57 | return { type: types.SET, set: WORDS(), not: false };
|
---|
| 58 | };
|
---|
| 59 |
|
---|
| 60 | exports.notWords = function() {
|
---|
| 61 | return { type: types.SET, set: WORDS(), not: true };
|
---|
| 62 | };
|
---|
| 63 |
|
---|
| 64 | exports.ints = function() {
|
---|
| 65 | return { type: types.SET, set: INTS(), not: false };
|
---|
| 66 | };
|
---|
| 67 |
|
---|
| 68 | exports.notInts = function() {
|
---|
| 69 | return { type: types.SET, set: INTS(), not: true };
|
---|
| 70 | };
|
---|
| 71 |
|
---|
| 72 | exports.whitespace = function() {
|
---|
| 73 | return { type: types.SET, set: WHITESPACE(), not: false };
|
---|
| 74 | };
|
---|
| 75 |
|
---|
| 76 | exports.notWhitespace = function() {
|
---|
| 77 | return { type: types.SET, set: WHITESPACE(), not: true };
|
---|
| 78 | };
|
---|
| 79 |
|
---|
| 80 | exports.anyChar = function() {
|
---|
| 81 | return { type: types.SET, set: NOTANYCHAR(), not: true };
|
---|
| 82 | };
|
---|