private static class LogicalExpressionConverter.Lexer
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private boolean |
caseSensitive
Should matches be checked case-sensitively?
|
private java.util.regex.Pattern |
charsToSkip
Regex pattern for characters to be skipped by readNextToken()
|
private LogicalExpressionConverter.EToken |
current
Token most recently read from the expression
|
private boolean |
hasDelim
Flag indicating if the last char(s) read was a word delimiter.
|
private int |
ord
The ordinal for a next found term
|
private java.io.Reader |
reader
String reader stream
|
private static java.lang.String |
SPECIAL_DELIMS
A list o special delimiters used like: "&" (AND), "|" (OR)
|
private java.util.Map<java.lang.String,LogicalExpressionConverter.Term> |
terms
Distinct terms found in the expression
|
| Modifier | Constructor and Description |
|---|---|
private |
Lexer(java.io.Reader reader,
java.lang.String delims,
boolean caseSensitive)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
consume()
Mark the current token as having been consumed.
|
private boolean |
isToBeSkipped(char c)
Check if a character is to be skipped when reading the next token.
|
private void |
readNextToken()
Read the next token from the match expression.
|
(package private) LogicalExpressionConverter.EToken |
token()
Return the most recently read token, or
null if no more tokens are
available. |
private void |
wildcardError()
Record or throw an error about incorrect wildcard syntax.
|
private final java.io.Reader reader
private final boolean caseSensitive
private static final java.lang.String SPECIAL_DELIMS
private java.util.regex.Pattern charsToSkip
private LogicalExpressionConverter.EToken current
private boolean hasDelim
private final java.util.Map<java.lang.String,LogicalExpressionConverter.Term> terms
private int ord
private Lexer(java.io.Reader reader,
java.lang.String delims,
boolean caseSensitive)
reader - Reader stream on the match expression text.delims - A regex list for delimiters to use when splitting a word.caseSensitive - true to perform word match comparisons
case-sensitively, false to ignore case.LogicalExpressionConverter.EToken token() throws java.io.IOException
null if no more tokens are
available.null.java.io.IOException - if there is an I/O error reading from the stream.void consume()
private boolean isToBeSkipped(char c)
throws java.io.IOException
true if c is a delimiter, but not one of [-,.&|^!()],
characters in [-,.] are part of a word only if followed by a digit;
false if c is a part of a word or a special delimiterc - the character to be checked.java.io.IOException - if there is an I/O error reading from the stream.private void readNextToken()
throws java.io.IOException
java.io.IOException - if there is an I/O error reading from the stream.private void wildcardError()
ErrorConditionException - always.