forked from galacean/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtils.ts
42 lines (38 loc) · 1.07 KB
/
Utils.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
export default class LexerUtils {
static isNum(charCode: number) {
return charCode >= 48 && charCode <= 57;
}
static isLetter(charCode: number) {
return (
charCode === 95 || // _
(charCode >= 48 && charCode <= 57) || // 0 - 9
(charCode >= 65 && charCode <= 90) || // A - Z
(charCode >= 97 && charCode <= 122) // a - z
);
}
static isAlpha(charCode: number) {
return (
charCode === 95 || // _
(charCode >= 65 && charCode <= 90) || // A - Z
(charCode >= 97 && charCode <= 122) // a - z
);
}
static isPpCharactors(charCode: number) {
return (
charCode === 35 || // #
charCode === 46 || // .
charCode === 95 || // _
(charCode >= 48 && charCode <= 57) || // 0 - 9
(charCode >= 65 && charCode <= 90) || // A - Z
(charCode >= 97 && charCode <= 122) // a - z
);
}
static isSpace(charCode: number) {
return (
charCode === 9 || // Tab
charCode === 10 || // Line break - /n
charCode === 13 || // Carriage return -/r
charCode === 32 // Space
);
}
}