Expand description
Statement parser for cqlsh-rs.
Handles multi-line input buffering, semicolon-terminated statement detection, comment stripping, string literal handling, and routing between CQL statements and built-in shell commands.
Key design decisions (from SP4 and SP16 upstream fixes):
- Context-aware tokenization: NO regex preprocessing for comments (PR #150)
- Truly incremental parsing: O(n) total work via scan_offset tracking (PR #151)
StructsΒ§
- Statement
Parser - Incremental statement parser.
EnumsΒ§
- Input
Kind - Classification of a parsed input line.
- LexState π
- Lexer context states for tracking position within CQL input.
- Parse
Result - The result of feeding a line to the parser.
ConstantsΒ§
- SHELL_
COMMANDS π - Built-in shell commands that donβt require a semicolon terminator.
FunctionsΒ§
- classify_
input - Classify a complete input as a shell command, CQL statement, or empty.
- decode_
char_ πat - Decode the char at byte offset
iins, returning the char and its UTF-8 byte length. - ends_
with_ πapply_ batch - Return true if
textends with theAPPLY BATCHtoken pair. - is_
shell_ command - Check if the first line of input looks like a shell command.
- parse_
batch - Parse a complete input string (e.g., from
-eor-fbatch mode) into individual statements. - starts_
with_ πbegin_ batch - Return true if
textis the opening of a CQL BATCH block. - strip_
comments π - Strip comments from a CQL fragment (used on extracted statements).