-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
760 lines (682 loc) · 16.9 KB
/
main.js
File metadata and controls
760 lines (682 loc) · 16.9 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
/**
* Uses software parts from boolean.py (https://github.com/bastikr/boolean.py):
* Copyright (c) 2009-2020 Sebastian Kraemer, basti.kr@gmail.com and others SPDX-License-Identifier: BSD-2-Clause
*/
const {isEqual, uniqWith, get, sortBy, some, concat, groupBy, forOwn, uniq, isObject} = require("lodash");
const TOKEN_AND = 1;
const TOKEN_OR = 2;
const TOKEN_NOT = 3;
const TOKEN_LPAR = 4;
const TOKEN_RPAR = 5;
const TOKEN_TRUE = 6;
const TOKEN_FALSE = 7;
const TOKEN_SYMBOL = 8;
const TOKEN_TYPES = {
TOKEN_AND: 'AND',
TOKEN_OR: 'OR',
TOKEN_NOT: 'NOT',
TOKEN_LPAR: '(',
TOKEN_RPAR: ')',
TOKEN_TRUE: 'TRUE',
TOKEN_FALSE: 'FALSE',
TOKEN_SYMBOL: 'SYMBOL',
};
// parsing error code and messages
const PARSE_UNKNOWN_TOKEN = 1;
const PARSE_UNBALANCED_CLOSING_PARENS = 2;
const PARSE_INVALID_EXPRESSION = 3;
const PARSE_INVALID_NESTING = 4;
const PARSE_INVALID_SYMBOL_SEQUENCE = 5;
const PARSE_INVALID_OPERATOR_SEQUENCE = 6;
const PARSE_ERRORS = {
PARSE_UNKNOWN_TOKEN: 'Unknown token',
PARSE_UNBALANCED_CLOSING_PARENS: 'Unbalanced parenthesis',
PARSE_INVALID_EXPRESSION: 'Invalid expression',
PARSE_INVALID_NESTING: 'Invalid expression nesting such as (AND xx)',
PARSE_INVALID_SYMBOL_SEQUENCE: 'Invalid symbols sequence such as (A B)',
PARSE_INVALID_OPERATOR_SEQUENCE: 'Invalid operator sequence without symbols such as AND OR or OR OR',
};
const ALLOWED_IN_TOKEN = ['.', ':', '_'];
const tokenize = (expr) => {
const TOKENS = {
'+': TOKEN_AND,
'|': TOKEN_OR, '/': TOKEN_OR,
'-': TOKEN_NOT,
'(': TOKEN_LPAR, ')': TOKEN_RPAR,
//'[': TOKEN_LPAR, ']': TOKEN_RPAR,
'1': TOKEN_TRUE,
'0': TOKEN_FALSE,
};
let position = 0;
let length = expr.length;
let res = [];
while (position < length) {
let tok = expr[position];
let sym = /^[a-z0-9]+$/i.test(tok) || tok === '_';
if (sym) {
position += 1;
while (position < length) {
let char = expr[position];
if (/^[a-z0-9]+$/i.test(char) || ALLOWED_IN_TOKEN.includes(char)) {
position += 1;
tok += char;
} else {
break;
}
}
position -= 1;
}
if(TOKENS[tok.toLowerCase()]) {
res.push({
token: TOKENS[tok.toLowerCase()],
tok,
position
});
} else {
if(sym) {
res.push({
token: TOKEN_SYMBOL,
tok,
position
});
} else if(![' ', '\t', '\r', '\n'].includes(tok)) {
throw new Error(PARSE_UNKNOWN_TOKEN + " TOKEN:" + tok);
}
}
position++;
}
return res;
};
const is_sym = (t) => {
return [TOKEN_TRUE, TOKEN_FALSE, TOKEN_SYMBOL].includes(t);
};
const is_operator = (t) => {
return [TOKEN_AND, TOKEN_OR].includes(t);
};
const parse = (tok) => {
let prev_token = null;
let exp = {};
let and = [exp];
let or = [and];
let brackets = [{or, and}];
tok.map(({token, tok, position}) => {
if(prev_token) {
if(is_sym(prev_token.token) && is_sym(token)) {
throw new Error(PARSE_INVALID_SYMBOL_SEQUENCE);
}
if(is_operator(prev_token.token) && is_operator(token)) {
throw new Error(PARSE_INVALID_OPERATOR_SEQUENCE);
}
} else {
if(is_operator(token)) {
throw new Error(PARSE_INVALID_OPERATOR_SEQUENCE);
}
}
prev_token = {token, tok, position};
if(token===TOKEN_NOT) {
if(exp.sym) {
exp = {};
and.push(exp);
}
exp.not = true;
} else if(token===TOKEN_SYMBOL) {
exp.sym = {type: TOKEN_SYMBOL, value: tok};
} else if(token===TOKEN_TRUE) {
exp.sym = {type: TOKEN_TRUE};
} else if(token===TOKEN_FALSE) {
exp.sym = {type: TOKEN_FALSE};
} else if(token===TOKEN_AND) {
exp = {};
and.push(exp);
} else if(token===TOKEN_OR) {
exp = {};
and = [exp];
or.push(and);
} else if(token===TOKEN_LPAR) {
let newExp = {};
brackets.push({and, or});
and = [newExp];
or = [and];
exp.brack = or;
exp = newExp;
} else if(token===TOKEN_RPAR) {
if(brackets.length===1) {
throw new Error(PARSE_UNBALANCED_CLOSING_PARENS);
}
let obj = brackets.pop();
and = obj.and;
or = obj.or;
exp = {};
and.push(exp);
}
});
if(brackets.length>1) {
throw new Error(PARSE_UNBALANCED_CLOSING_PARENS);
}
return or;
};
let literal = (exp) => {
if(exp.not && exp.sym.type===TOKEN_FALSE) {
return {not: false, sym:{type: TOKEN_TRUE}};
}
if(exp.not && exp.sym.type===TOKEN_TRUE) {
return {not: false, sym:{type: TOKEN_FALSE}};
}
return exp;
};
let demorgan_ands_to_ors = or => {
let newOr = [];
if(or.length!==1) {
throw new Error("PARSE ERRROR DE MORGAN");
}
or[0].map(el=>{
el.not = !el.not;
newOr.push([el]);
});
return newOr;
};
let is_negation = (obja, objb) => {
obja.not = !obja.not;
objb.not = !!objb.not;
if(isEqual(obja, objb)) {
obja.not = !obja.not;
return true;
}
obja.not = !obja.not;
return false;
};
let simplify = or => {
let ors = or;
ors = or.map(and=>{
let ands = and.filter(i=>!isEqual(i,{})).map(el=>{
if(el.brack) {
return {not: el.not, brack: simplify(el.brack)};
}
return literal(el);
});
let res = false;
// search for and true
if(ands.length>1) {
ands = ands.filter(i=>!(i.sym && i.sym.type===TOKEN_TRUE));
}
// Search for and False
ands.map(i=>{
if(i.sym && i.sym.type===TOKEN_FALSE) {
res = true;
}
});
if(res) {
return [{not: false, sym: {type: TOKEN_FALSE}}];
} else {
// filter duplicates
ands = uniqWith(ands, isEqual);
return ands;
}
});
let res = false;
ors = ors.filter(and=>and.filter(i=>!isEqual(i,{})).length!==0).filter(and=>and.length!==0);
// filter ors for empty brackets
ors = ors.filter(i=>(i.length!==0 && !(i.length===1 && i[0].brack && i[0].brack.length===0)));
// if only inner bracket, then return inner bracket
for(let a=0; a<ors.length; a++) {
for(let b=0; b<ors[a].length; b++) {
//if(ors[a].length===1) {
if(ors[a][b].brack) {
if(ors[a][b].not && ors[a][b].brack && ors[a][b].brack.length===1 && ors[a][b].brack[0].length===1) {
// double not
if(ors[a][b].brack[0][0].not) {
let res = ors[a][b].brack[0][0];
res.not = false;
ors[a][b] = res;
} else {
// not false
if(ors[a][b].brack[0][0].sym && ors[a][b].brack[0][0].sym.type===TOKEN_FALSE) {
ors[a][b] = {not: false, sym: {type: TOKEN_TRUE}};
}
/*if(!ors[a][b].not) {
ors[a][b].brack = simplify(ors[a][b].brack);
}*/
}
}
if(ors[a][b].brack) {
if(!ors[a][b].not) {
//return ors[a][b].brack;
// Unpack only ands
if(ors[a][b].brack.length===1) {
ors[a][b].brack[0].map(e=>ors[a].push(e));
ors[a][b] = {};
}
/*if(ors[a][b].brack.length===1&&ors[a][b].brack[0].length===1) {
ors[a][b] = ors[a][b].brack[0][0];
}*/
} else {
// if only ands then perform de morgan
if(ors[a][b].brack.length===1) {
if(ors[a][b].brack[0].length===1) {
ors[a][b].brack[0][0].not = ors[a][b].brack[0][0].not ? (ors[a][b].not ? false : true) : ors[a][b].not;
ors[a][b] = ors[a][b].brack[0][0];
ors[a][b] = literal(ors[a][b]);
} else {
if(ors.length===1) {
return demorgan_ands_to_ors(ors[a][b].brack);
} else {
ors[a][b].brack = demorgan_ands_to_ors(ors[a][b].brack);
ors[a][b].not = !ors[a][b].not;
}
}
}
}
}
}
}
ors[a] = ors[a].filter(i=>!isEqual(i, {}));
}
ors = ors.map(ands=>{
let res = false;
// search for and true
if(ands.length>1) {
ands = ands.filter(i=>!(i.sym && i.sym.type===TOKEN_TRUE));
}
// Search for and False
ands.map(i=>{
if(i.sym && i.sym.type===TOKEN_FALSE) {
res = true;
}
});
if(res) {
return [{not: false, sym: {type: TOKEN_FALSE}}];
} else {
// filter duplicates
ands = uniqWith(ands, isEqual);
return ands;
}
});
// Search for or False
if(ors.length>1) {
ors = ors.filter(i=>!(i.length===1 && i[0].sym && i[0].sym.type===TOKEN_FALSE));
}
// Search for or True
ors.map(i=>{
if(i.length!==1)
return;
if(i[0].sym && i[0].sym.type===TOKEN_TRUE) {
res = true;
}
});
if(res) {
return [[{not: false, sym: {type: TOKEN_TRUE}}]];
}
// sort
ors = ors.map(and => sortBy(and, i=>get(i, "sym.value")));
// filter duplicates
ors = ors.map(and=>{
return uniqWith(and, (x,y)=>{
x.not = !!x.not;
y.not = !!y.not;
return isEqual(x,y);
});
});
ors = uniqWith(ors, isEqual);
// search for a and not a
let anotares = false;
ors.map(i=>{
if(i.length!==uniqWith(i, is_negation).length) {
anotares = true;
}
});
if(anotares) {
return [[{not: false, sym: {type: TOKEN_FALSE}}]];
}
// search for a or not a
if(ors.length !== uniqWith(ors, (a,b)=>{
if(a.length!==1 || b.length!==1)
return false;
return is_negation(a[0], b[0])
}).length) {
return [[{not: false, sym: {type: TOKEN_TRUE}}]];
}
// check for includes
for(let a=0; a<ors.length; a++)
for(let b=0; b<ors.length; b++) {
if(a===b) continue;
// Is A a superset of B?
let res = true;
if(ors[a].length===1 && ors[b].length===1 && ors[a][0].brack && ors[b][0].brack && ors[a][0].brack.length===1 && ors[b][0].brack.length===1) {
ors[a][0].brack[0].map(and => {
if(!some(ors[b][0].brack[0], (e)=>isEqual(e,and))) {
res = false;
}
});
} else {
ors[a].map(and => {
if(!some(ors[b], (e)=>{
and.not = !!and.not;
e.not = !!e.not;
return isEqual(e,and);
})) {
res = false;
}
});
}
if(res) {
ors[b] = [{not: false, sym: {type: TOKEN_FALSE}}];
}
}
// Search for or False
if(ors.length>1) {
ors = ors.filter(i=>!(i.length===1 && i[0].sym && i[0].sym.type===TOKEN_FALSE));
}
return ors;
};
function forceDisjunctive2(or, not=false) {
let or2 = or;
if(not) {
or2 = [or2.map(i=>{
return {brack: i.filter(j=>!isEqual(j,{})).map(j=>{
if(isObject(j)) {
j.not = !j.not
} else {
j = j.map(k=>{
k.not = !k.not
})
}
return [j]
})}
})]
not = false
}
let res = []
or2.map(and=>{
let orsFromAnd = []
and.filter(i=>!isEqual(i,{})).map(an => {
if(an.sym) {
let symObj = {...an, not: an.not};
if(symObj.not && get(symObj, "sym.type")===TOKEN_TRUE) {
symObj.not = false
symObj.sym.type = TOKEN_FALSE
} else if(symObj.not && get(symObj, "sym.type")===TOKEN_FALSE) {
symObj.not = false
symObj.sym.type = TOKEN_TRUE
}
if(orsFromAnd.length===0)
orsFromAnd.push([symObj]);
else {
orsFromAnd.map(a=>{
a.push(symObj)
return a
})
}
} else if(an.brack) {
let brackRes = forceDisjunctive2(an.brack, an.not)
if(orsFromAnd.length===0) {
orsFromAnd = brackRes
} else {
let newOrsFromAnd = []
brackRes.map(b => {
orsFromAnd.map(a=>{
let addElement = uniq([...a, ...b]);
newOrsFromAnd.push(addElement)
})
})
newOrsFromAnd = cleanSameLiteral(newOrsFromAnd)
orsFromAnd = newOrsFromAnd
}
} else {
throw new Error("Unexpected type");
}
})
res = [...res, ...orsFromAnd]
})
res = cleanTrivialLiterals(res)
return res;
}
function cleanSameLiteral(ors) {
return ors.map(and=>{
return uniqWith(and, (i,j)=>(!!i.not==!!j.not && get(i, "sym.value")===get(j, "sym.value")))
})
}
function removeOrTrue(ors) {
let res = ors
res = res.filter(i=>i.length!==1 || get(i, "[0].sym.type")!==TOKEN_TRUE)
return res
}
function cleanOrTrue(ors) {
let res = ors
let foundOrTrue = false
res = res.map(r => {
if(r.length===1 && get(r, "[0].sym.type")===TOKEN_TRUE) {
foundOrTrue = true
}
return r
})
if(foundOrTrue) {
return [[{sym: {type: TOKEN_TRUE}}]]
}
return res
}
function cleanTrivialLiterals(ors) {
let res = ors
if(ors.length>1)
res = cleanOrTrue(res)
res = res.filter(and => {
let foundAndFalse = false
and.map(r => {
if(get(r, "sym.type")===TOKEN_FALSE) {
foundAndFalse = true
}
})
if(foundAndFalse) {
return false
}
return true
})
res = res.filter(i => i.length!==1 || get(i, "[0].sym.type")!==TOKEN_FALSE)
res = res.map(i=>{
if(i.length===1) return i
if(i.length<2) return i
let a = i.filter(j => get(j, "sym.type")!==TOKEN_TRUE);
if(a.length===0) {
return [{sym:{type: TOKEN_TRUE}}]
}
return a;
})
if(res.length===0 || res[0].length===0) {
res = [[{sym: {type: TOKEN_FALSE}}]]
}
return res
}
function cleanNotSatisfiableAndInDisj(ors) {
return ors.filter(and=>{
let good = true;
let bla = groupBy(and, i=>get(i, "sym.value"))
forOwn(bla, (v)=>{
let prev = get(v, "[0].not")
v.map(i=>{
if(get(i, "not")!=prev) {
good = false
}
})
})
return good;
})
}
function sortAnds(ors) {
return ors.map(and => {
return sortBy(and, i=>get(i, "sym.value"))
})
}
let stringify = (or) => {
return or.map(and=>{
let r = (and.length===1 || or.length===1) ? "" : "(";
r += and.map(el=>{
let s = el.not ? "-" : "";
if(el.sym) {
if(el.sym.type===TOKEN_TRUE) {
s += "1";
} else if(el.sym.type===TOKEN_FALSE) {
s += "0";
} else if(el.sym.type===TOKEN_SYMBOL) {
s += el.sym.value;
} else {
throw new Error(PARSE_INVALID_NESTING);
}
return s;
} else if(el.brack) {
return s+
"("+
stringify(el.brack)+
")";
} else {
throw new Error(PARSE_INVALID_NESTING);
}
}).join("+");
r += (and.length===1 || or.length===1) ? "" : ")";
return r;
}).join("|");
};
let simp = (expr) => {
return stringify(simplify(parse(tokenize(expr))));
};
let disj = (expr) => {
let res = forceDisjunctive2(parse(tokenize(expr)));
res = cleanNotSatisfiableAndInDisj(res)
res = cleanSameLiteral(res)
res = sortAnds(res)
res = stringify(res)
return res;
}
let impl = (expr) => {
let res = forceDisjunctive2(parse(tokenize(expr)));
res = cleanNotSatisfiableAndInDisj(res)
res = cleanSameLiteral(res)
res = sortAnds(res)
res = cleanDuplicates(res)
res = cleanImply(res)
res = stringify(res)
return res;
}
let cleanImply = (expr) => {
let a = expr.map(()=>0)
for(let i=0; i<expr.length; i+=1) {
for(let j=0; j<expr.length; j++) {
if(i===j) continue
let syms = expr[i].map(r=>((r.not)?"-":"")+get(r, "sym.value"))
let syms2 = expr[j].map(r=>((r.not)?"-":"")+get(r, "sym.value"))
if(syms.filter(r=>!syms2.includes(r)).length===0) {
a[j]++
}
}
}
return expr.filter((i, idx) => a[idx]===0)
}
let implies = (a,b) => {
let syms = a.map(r=>((r.not)?"-":"")+get(r, "sym.value"))
let syms2 = b.map(r=>((r.not)?"-":"")+get(r, "sym.value"))
if(syms.filter(r=>!syms2.includes(r)).length===0) {
return true
}
return false
}
let cleanDuplicates = (ors) => {
return uniqWith(ors, (a,b)=>stringify([a])===stringify([b]))
}
let lcrCode = (expr) => {
let res = forceDisjunctive2(parse(tokenize(expr)));
res = cleanNotSatisfiableAndInDisj(res)
res = cleanSameLiteral(res)
res = sortAnds(res)
res = cleanDuplicates(res)
return res
}
let lcr = (rule, otherRules) => {
let rl = lcrCode(rule)
if(otherRules.length===0) {
return stringify([[{sym: {type: TOKEN_TRUE}}]])
}
let othr = otherRules.map(e=>lcrCode(e))
let literals = []
othr.map(i=>i.map(o=>literals.push(o)))
literals = removeOrTrue(literals)
rl = removeOrTrue(rl)
if(rl.length===1 && rl[0].length===1 && get(rl[0][0], "sym.type") === TOKEN_TRUE) {
rl = []
}
rl.map(ij=>{
literals = literals.filter(kl => {
let res = [ij, kl]
res = cleanDuplicates(res)
res = cleanImply(res)
const stra = stringify(res)
const strb = stringify([kl])
return stra !== strb
//return !implies(ij, kl)
})
})
let ltr = literals.map(i=>{
return {not: true, brack: [i]}
})
let res
if(rl.length===0) {
res = [ltr]
} else {
res = rl.map(ij=>{
return [...ij, ...ltr]
})
}
res = forceDisjunctive2(res);
res = cleanNotSatisfiableAndInDisj(res)
res = cleanSameLiteral(res)
res = sortAnds(res)
res = cleanDuplicates(res)
res = cleanImply(res)
res = stringify(res)
return res
}
let replaceToVal = (ors, truthy = [], falsy = [], makeOthers = null) => {
let res = ors.map(and => {
return and.map(el => {
if(el && get(el, "sym.type")===TOKEN_SYMBOL) {
let sym = get(el, "sym.value");
let not = get(el, "not", false)
if(truthy.includes(sym)) {
return {not, sym: {type: TOKEN_TRUE}}
} else if(falsy.includes(sym)) {
return {not, sym: {type: TOKEN_FALSE}}
} else if(makeOthers) {
if(makeOthers===TOKEN_TRUE) {
return {not, sym: {type: TOKEN_TRUE}}
} else if(makeOthers===TOKEN_FALSE) {
return {not, sym: {type: TOKEN_FALSE}}
}
}
} else if(el && el.brack) {
return replaceToVal(el.brack, truthy, falsy, makeOthers)
}
return el
}
)
})
return res;
}
let eval = (expr, truthy = [], falsy= [], makeOthers = null) => {
let res = forceDisjunctive2(parse(tokenize(expr)));
res = replaceToVal(res, truthy, falsy, makeOthers);
res = forceDisjunctive2(res);
res = cleanNotSatisfiableAndInDisj(res)
res = cleanSameLiteral(res)
res = sortAnds(res)
res = cleanDuplicates(res)
res = cleanImply(res)
res = stringify(res)
return res;
}
exports.tokenize = tokenize;
exports.parse = parse;
exports.default = simp;
exports.disj = disj;
exports.impl = impl;
exports.lcr = lcr;
exports.eval = eval;
exports.evaluate = eval;
exports.TOKEN_FALSE = TOKEN_FALSE;
exports.TOKEN_TRUE = TOKEN_TRUE;