This pull request implements boolean expression evaluation of input in the 'Tags' field.
The new delimiters/operators are:
, : boolean OR (same as before)
| : boolean OR
&: boolean AND (this takes precedence over OR operators)
( and ): evaluate the expression within brackets first
For example, the tag input Trudeau & Trump blocks posts that contain both 'Trudeau' and 'Trump' in the same post, but allows posts that contain only 'Trudeau', or only 'Trump'.
Tag lists are no longer auto-prettified. i.e. spoiler alert ,force awakens,episode viii does not display as spoiler alert, force awakens, episode viii with spaces after the commas but remains as the user inputs it.
Implementation
User input is tokenized into literals, operators and parentheses (src/panel/common/internal/parser.js)
The tokenized output is converted to reverse polish notation for easier evaluation (src/panel/common/internal/parser.js) and stored in the spoilers array with the key tokensArr.
The token array is evaluated in src/logic/common/util/CommonUtils.js
Code problems
The enum TokenType resides only in parser.js. It is not shared across files, so other files compare the tokenType to a string with the same name as the TokenType enum.
This pull request implements boolean expression evaluation of input in the 'Tags' field.
The new delimiters/operators are:
,
: boolean OR (same as before)|
: boolean OR&
: boolean AND (this takes precedence over OR operators)(
and)
: evaluate the expression within brackets firstFor example, the tag input
Trudeau & Trump
blocks posts that contain both 'Trudeau' and 'Trump' in the same post, but allows posts that contain only 'Trudeau', or only 'Trump'.Tag lists are no longer auto-prettified. i.e.
spoiler alert ,force awakens,episode viii
does not display asspoiler alert, force awakens, episode viii
with spaces after the commas but remains as the user inputs it.Implementation
src/panel/common/internal/parser.js
)src/panel/common/internal/parser.js
) and stored in thespoilers
array with the keytokensArr
.src/logic/common/util/CommonUtils.js
Code problems The enum TokenType resides only in parser.js. It is not shared across files, so other files compare the tokenType to a string with the same name as the TokenType enum.