-
Notifications
You must be signed in to change notification settings - Fork 0
/
enums.ts
139 lines (133 loc) · 2.25 KB
/
enums.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/**
* What Mode a tag should operate in.
*/
export enum BBMode {
/**
* Swap BBCode tags with HTML tags.
*/
SIMPLE = 0,
/**
* Use provided callback function or method.
*/
CALLBACK = 1,
/**
* Use internal callback function.
*/
INTERNAL = 2,
/**
* Use library callback function.
*/
LIBRARY = 3,
/**
* Insert BBCode input into the provided HTML template.
*/
ENHANCED = 4
}
/**
* The data that gets stored in each stack entry.
*/
export enum BBStack {
/**
* Stack node: Token type
*/
TOKEN = 0,
/**
* Stack node: HTML text content
*/
TEXT = 1,
/**
* Stack node: Tag contents (array)
*/
TAG = 2,
/**
* Stack node: Classname
*/
CLASS = 3
}
/**
* The types of token a stack entry can be.
*/
export enum BBToken {
/**
* Token: End-of-input
*/
EOI = 0,
/**
* Token: Non-newline whitespace
*/
WS = 1,
/**
* Token: A single newline
*/
NL = 2,
/**
* Token: Non-whitespace non-tag plain text
*/
TEXT = 3,
/**
* Token: A [start tag] or [empty tag]
*/
TAG = 4,
/**
* Token: An [/end tag]
*/
ENDTAG = 5
}
/**
* How to handle content
*/
export enum BBType {
/**
* Content type: Content may not be provided by user.
*/
PROHIBIT = -1,
/**
* Content type: Content is permitted but not required.
*/
OPTIONAL = 0,
/**
* Content type: Content may not be empty or whitespace.
*/
REQUIRED = 1,
/**
* Content type: Content is not processed as BBCode.
*/
VERBATIM = 2
}
/**
* What action is being performed on a function
*/
export enum BBAction {
/**
* Callback operation: Check validitity of input
*/
CHECK = 1,
/**
* Callback operation: Generate HTML output
*/
OUTPUT = 2
}
/**
* Next Token Type for the Lexer
*/
export enum LexState {
/**
* Lexer: Next token is plain text.
*/
TEXT = 0,
/**
* Lexer: Next token is non-text element.
*/
TAG = 1
}
/**
* Levels of output for logging
*/
export enum DebugLevel {
all = 0,
debug = 1,
info = 2,
warn = 3,
error = 4,
none = 5
}