source: trip-planner-front/node_modules/ret/lib/sets.js@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.2 KB
Line 
1var types = require('./types');
2
3var INTS = function() {
4 return [{ type: types.RANGE , from: 48, to: 57 }];
5};
6
7var 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
15var 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
46var 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.
56exports.words = function() {
57 return { type: types.SET, set: WORDS(), not: false };
58};
59
60exports.notWords = function() {
61 return { type: types.SET, set: WORDS(), not: true };
62};
63
64exports.ints = function() {
65 return { type: types.SET, set: INTS(), not: false };
66};
67
68exports.notInts = function() {
69 return { type: types.SET, set: INTS(), not: true };
70};
71
72exports.whitespace = function() {
73 return { type: types.SET, set: WHITESPACE(), not: false };
74};
75
76exports.notWhitespace = function() {
77 return { type: types.SET, set: WHITESPACE(), not: true };
78};
79
80exports.anyChar = function() {
81 return { type: types.SET, set: NOTANYCHAR(), not: true };
82};
Note: See TracBrowser for help on using the repository browser.