PoC for a CLI & REPL. It should be considered experimental, subject to change, etc.
In its current state, it largely exists to test parser interface & types from the perspective of an external application. Probably the the mietter::Diagnostic stuff should be refactored and moved to the main parser crate.
help
: print the CLI's help message and supported commandsrepl
: launches the REPLast -T<format> "<query>"
: outputs a rendered version of the parsed AST (see Visualization):
<format>
:json
: pretty-print to stdout in a json dumpdot
: pretty-print to stdout in Graphviz dot formatsvg
: print to stdout a Graphviz rendered svg xml documentpng
: print to stdout a Graphviz rendered png bitmapdisplay
: display a Graphviz rendered png bitmap directly in supported terminalsquery
: the PartiQL query textThe REPL currently assumes most of the input line is a PartiQL query, which it will attempt to parse.
- For an invalid query, errors are pretty printed to the output.
- For a valid query,
- with no prefix, Parse OK!
is printed to the output
- if prefixed by \ast
, a rendered AST tree image is printed to the output (see Visualization)
Features:
- Syntax highlighting of query input
- User-friendly error reporting
- Readling/editing
- CTRL-D
/CTRL-C
to quit.
In order to use any of the Graphviz-based visualizations, you will need the graphviz libraries
installed on your machine (e.g. brew install graphviz
or similar).