* feat: Reimplement keywords as BTreeSet for more efficient lookup
Added a `Token` type to perform case-insensitive comparisons to avoid
allocations when performing lookups in the set.
Also introduced new `keyword` combinator to replace use of
`tag_no_case`. This is necessary to prevent eagerly recognising tags
without the appropriate separator. For example, `tag_no_case("OR")`
will recognise `ORDER` in a conditional expression.
The new combinator a `keyword` follows the pattern:
```
keyword ::= (a..z | A..Z)* keyword_separator
keyword_separator ::= ' ' | '(' | ')' | ';' | ',' | '=' |
'\n' | '\t'
```
* fix: Allow quoted time; using more efficient case-insensitive comparison
* fix: Digits to right of decimal point are optional
* fix: More idiomatic use of zip
* fix: Use `keyword` combinator and adjust whitespace handling
* fix: <> is a valid alias for the != operator
* fix: Special handling of DISTINCT identifier for function call name
* chore: Add tests
* chore: Feedback to remove unnecessary comments
* chore: Switch from BTreeSet to HashSet – thanks @domodwyer!
* feat: Partition implementation of Visitable for InfluxQL AST
* feat: Added consistent structures for each clause to simplify visitor
Continued to expand `accept` and `pre` / `post` visit implementations.
* feat: Added insta and tests using snapshots (thanks @crepererum)
The insta crate simplifies the process of validating the combination of
visitor and accept implementations are called and in the correct order.
* chore: Run cargo hakari tasks
* feat: Added remaining snapshot tests
Some tests are failing as some minor type changes must be added along
with the addition of related visitor functions.
* feat: Add types to represent each clause in numerous statements
These clauses permit distinct visit functions on the `Visitor` type.
* chore: Reformat `SELECT`
* chore: Explicitly specify access to export selected types only
This required completing all the missing documentation for the exported
types.
* chore: Update Cargo.lock
* chore: macro to implement common traits and hide 0th tuple element
Co-authored-by: CircleCI[bot] <circleci@influxdata.com>
* feat: Identifier → VarRef, which represents a tag or field reference
InfluxQL calls these variables, so the Rust parser will follow
precedent.
* chore: Add docs
* chore: Separate arithmetic and conditional expression parsing
This is necessary to ensure conditional expressions are only supported
in a `WHERE` clause and arithmetic expressions in `SELECT` field
projection list
* feat: Add a `verify` API to transform combinator functions to errors
This is useful to preform additional validation on a valid result.
* feat: Add customisation for operand parsing to arithmetic expressions
This permits narrowing of valid function calls in `WHERE` clauses
and to customise valid operands in a `SELECT` projection, such as a
wildcard (`*`)
* chore: move logic to appropriate modules.
* feat: Add wildcard discriminator to Expr enum required for `SELECT`
* chore: Remove dead_code attribute
* feat: Add `DISTINCT` operator
* chore: Add `distinct` macro; simplify existing macros
* chore: add assert_matches; parse Field and Field list; refactor literal
* feat: Add a new type to parse a separated_list1 into a specialised type
* chore: Refactor types using `separated_list1`
* chore: Ensure items in a list can be preceded by a space
* chore: Refactor IN clause to use OneOrMore
* feat: Parse `GROUP BY` clause
* chore: appease clippy
* chore: refactor number parsing to share code; add signed Number type
* feat: completed `SELECT` statement parser.
* chore: Consistent error messages when expecting tokens
* chore: Add recommended derive implementations
* feat: Add `SELECT` statement to `statement` combinator
* chore: Refactor OneOrMore::separated_list1 to a single error message
* chore: More tests and cleanup 🧹
* chore: More tests
* chore: Appease broken doc links checker
* chore: remove remaining `dead_code` attributes 🥳
* chore: Address PR feedback
* https://github.com/influxdata/influxdb_iox/pull/5692#discussion_r982559420
* https://github.com/influxdata/influxdb_iox/pull/5692#discussion_r982527476
* chore: Address PR feedback
* https://github.com/influxdata/influxdb_iox/pull/5692#discussion_r982626857
* https://github.com/influxdata/influxdb_iox/pull/5692#discussion_r982569760
* chore: Address PR feedback for Display implementations
Also removed duplicate test case