Package net.hydromatic.filtex.parse
Class FiltexParserImpl
java.lang.Object
net.hydromatic.filtex.parse.FiltexParserImpl
- All Implemented Interfaces:
FiltexParser,FiltexParserImplConstants
Parser for filter expressions, generated from FiltexParser.jj by JavaCC.
-
Field Summary
FieldsModifier and TypeFieldDescriptionNext token.Current token.Generated Token Manager.Fields inherited from interface net.hydromatic.filtex.parse.FiltexParserImplConstants
AFTER, AGO, AND, BANG_EQ, BEFORE, BOX, CHAR_LITERAL, COMMA, DATE_SEP, DD, DEFAULT, DOUBLE_LBRACE, DOUBLE_QUOTE, DOUBLE_RBRACE, EOF, EQ, FEET, FOR, FRIDAY, FROM, FY_YEAR, FY_YEAR_QUARTER, HH, HH_MM_SS, INSIDE, KILOMETERS, LAST, LT_GT, METERS, MI, MILES, MM, MONDAY, NEVER, NEXT, NOT, NOW, NULL, NUMBER_LITERAL, NUMBER_LITERAL0, OR, POSITIVE_INTEGER, QUOTED_STRING, SATURDAY, SS, SUNDAY, THIS, THURSDAY, TIME_SEP, TO, TODAY, tokenImage, TOMORROW, TUESDAY, WEDNESDAY, WHITESPACE, YEAR_MONTH, YEAR_QUARTER, YESTERDAY, YYYY, YYYY_MM_DD -
Constructor Summary
ConstructorsConstructorDescriptionFiltexParserImpl(InputStream stream) Constructor with InputStream.FiltexParserImpl(InputStream stream, String encoding) Constructor with InputStream and supplied encodingFiltexParserImpl(Reader stream) Constructor.Constructor with generated Token Manager. -
Method Summary
Modifier and TypeMethodDescriptionfinal AstNodefinal voidaddDateTerm(List<AstNode> list) Adds a date term to a list.final voidAdds a term to a list.final AstNodeanywhere()final booleanfinal AstNodebox()final AstNodecircle()final Datedate()final AstNodeParses a date expression.final AstNodeParses a date filter expression followed by end-of-file.final AstNodedateTerm()Parses a date term.final Datedatetime()final DatetimeUnitdateUnit()final AstNodefinal Stringfinal Stringfinal voidDisable tracing.final voidEnable tracing.final AstNodefinal AstNodeGenerate ParseException.final TokenGet the next Token.final TokengetToken(int index) Get the specific Token.final AstNodeinterval(boolean is) final AstNodeintervalComp1(boolean is) Special interval, ">= 7 AND <80.44" becomes "(7, 80.44)", and ">=80.44 OR <.1" becomes "(0.01, 80.44]".final AstNodeintervalComp2(boolean is) Special interval, second kind; "<=80.44 AND >.1" becomes "(0.01, 80.44]", and "<= 7 OR >80.44" becomes "[7, 80.44)".final booleanfinal DatetimeUnitfinal booleanis()Reads an optional prefix ("not", "<>", "!=") and returns whether the following term should be negated.final AstNodelast()final Locationlocation()final AstNodeParses a location expression.final AstNodeParses a location filter expression followed by end-of-file.final Ast.Intervalfinal AstNodenulls()final BigDecimalnumber()final AstNodeParses a numeric expression.final AstNodeParses a numeric filter expression followed by end-of-file.final AstNodepos()Returns the position of the last token returned by the parser.final BigDecimalvoidReInit(InputStream stream) Reinitialise.voidReInit(InputStream stream, String encoding) Reinitialise.voidReinitialise.voidReinitialise.final AstNodevoidsetTabSize(int tabSize) final AstNodeterm()Parses a numeric term.final AstNodethisNext()final Opfinal AstNodefinal Timetime()final DatetimeUnittimeUnit()final AstNodeto(boolean is) Parses a range (such as "5 to 10", "to 10", "5 to"), and also a numeric literal (such as "5").final booleanTrace enabled.final Unitunit()final AstNodefinal AstNodeyear()final AstNodefinal AstNodevoidSets the current file, and sets the current line to zero.
-
Field Details
-
token_source
Generated Token Manager. -
token
Current token. -
jj_nt
Next token.
-
-
Constructor Details
-
FiltexParserImpl
Constructor with InputStream. -
FiltexParserImpl
Constructor with InputStream and supplied encoding -
FiltexParserImpl
Constructor. -
FiltexParserImpl
Constructor with generated Token Manager.
-
-
Method Details
-
setTabSize
public void setTabSize(int tabSize) -
pos
Description copied from interface:FiltexParserReturns the position of the last token returned by the parser.- Specified by:
posin interfaceFiltexParser
-
zero
Description copied from interface:FiltexParserSets the current file, and sets the current line to zero.- Specified by:
zeroin interfaceFiltexParser
-
dateExpressionEof
Parses a date filter expression followed by end-of-file.- Throws:
ParseException
-
locationExpressionEof
Parses a location filter expression followed by end-of-file.- Throws:
ParseException
-
numericExpressionEof
Parses a numeric filter expression followed by end-of-file.- Throws:
ParseException
-
dateExpression
Parses a date expression.Accepts expressions like: TODO
- Throws:
ParseException
-
addDateTerm
Adds a date term to a list.- Throws:
ParseException
-
dateTerm
Parses a date term.- Throws:
ParseException
-
nInterval
- Throws:
ParseException
-
positiveInteger
- Throws:
ParseException
-
dayExpression
- Throws:
ParseException
-
dayKeyword
- Throws:
ParseException
-
dayOfWeekKeyword
- Throws:
ParseException
-
year
- Throws:
ParseException
-
fiscalYear
- Throws:
ParseException
-
fiscalQuarter
- Throws:
ParseException
-
yearMonth
- Throws:
ParseException
-
yearQuarter
- Throws:
ParseException
-
intervalUnit
- Throws:
ParseException
-
timeUnit
- Throws:
ParseException
-
dateUnit
- Throws:
ParseException
-
thisNext
- Throws:
ParseException
-
last
- Throws:
ParseException
-
thisRange
- Throws:
ParseException
-
intervalType
- Throws:
ParseException
-
relativeRange
- Throws:
ParseException
-
beforeAfter
- Throws:
ParseException
-
absoluteBeforeAfter
- Throws:
ParseException
-
thisNextLast
- Throws:
ParseException
-
onDatetime
- Throws:
ParseException
-
datetime
- Throws:
ParseException
-
date
- Throws:
ParseException
-
time
- Throws:
ParseException
-
locationExpression
Parses a location expression.Accepts expressions like: "
36.97, -122.03", "40 miles from 36.97, -122.03", "inside box from 72.33, -173.14 to 14.39, -61.70"- Throws:
ParseException
-
anywhere
- Throws:
ParseException
-
nulls
- Throws:
ParseException
-
box
- Throws:
ParseException
-
circle
- Throws:
ParseException
-
location
- Throws:
ParseException
-
unit
- Throws:
ParseException
-
numericExpression
Parses a numeric expression.Accepts expressions like "not 66, 99, 4", "1 to 100" and returns an AST. See https://docs.looker.com/reference/filter-expressions#number
A top-level numeric expression is a comma-separated list of terms.
- Throws:
ParseException
-
addTerm
Adds a term to a list.- Throws:
ParseException
-
term
Parses a numeric term.- Throws:
ParseException
-
is
Reads an optional prefix ("not", "<>", "!=") and returns whether the following term should be negated.- Throws:
ParseException
-
intervalComp1
Special interval, ">= 7 AND <80.44" becomes "(7, 80.44)", and ">=80.44 OR <.1" becomes "(0.01, 80.44]". Also parses comparison, "> 10".- Throws:
ParseException
-
intervalComp2
Special interval, second kind; "<=80.44 AND >.1" becomes "(0.01, 80.44]", and "<= 7 OR >80.44" becomes "[7, 80.44)". Also parses comparison, "< 10".- Throws:
ParseException
-
to
Parses a range (such as "5 to 10", "to 10", "5 to"), and also a numeric literal (such as "5").- Throws:
ParseException
-
interval
- Throws:
ParseException
-
userAttribute
- Throws:
ParseException
-
number
- Throws:
ParseException
-
ReInit
Reinitialise. -
ReInit
Reinitialise. -
ReInit
Reinitialise. -
ReInit
Reinitialise. -
getNextToken
Get the next Token. -
getToken
Get the specific Token. -
generateParseException
Generate ParseException. -
trace_enabled
public final boolean trace_enabled()Trace enabled. -
enable_tracing
public final void enable_tracing()Enable tracing. -
disable_tracing
public final void disable_tracing()Disable tracing.
-