in src/permissions/permissions-cache.ts [123:167]
lex(query?: string | null | undefined) {
const lexems = [];
if (query) {
let currentIdentifier = '';
for (let i = 0; i < query.length; i++) {
switch (query.charAt(i)) {
case ' ':
case '\t':
case '\n':
case '\r':
// Finish current token
if (currentIdentifier) {
lexems.push(currentIdentifier);
currentIdentifier = '';
}
// Skip space
break;
case '(':
case ')':
case '&':
case '|':
case '!':
// Finish current token
if (currentIdentifier) {
lexems.push(currentIdentifier);
currentIdentifier = '';
}
// Append operator
lexems.push(query.charAt(i));
break;
default:
currentIdentifier += query.charAt(i);
break;
}
}
if (currentIdentifier) {
lexems.push(currentIdentifier);
}
}
return lexems;
}