mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-25 12:04:21 +01:00
I noticed that the parse errors were a bit hard to read - only the nearest token and the line/col offsets were printed. I made a first attempt at improving the errors using [miette](https://github.com/zkat/miette). - Added derive for `miette::Diagnostic` to both the parser's error type and LimboError. - Added miette dependency to both sqlite3_parser and core. The `fancy` feature is only enabled for CLI. Some future improvements that can be made further: - Add spans to AST nodes so that errors can better point to the correct token. See upstream issue: https://github.com/gwenn/lemon-rs/issues/33 - Construct more errors with offset information. I noticed that most parser errors are constructed with `None` as the offset. Comparisons. Before: ``` ❯ cargo run --package limbo --bin limbo database.db --output-mode pretty ... limbo> selet * from a; [2025-01-05T11:22:55Z ERROR sqlite3Parser] near "Token([115, 101, 108, 101, 116])": syntax error Parse error: near "selet": syntax error at (1, 6) ``` After: ``` ❯ cargo run --package limbo --bin limbo database.db --output-mode pretty ... limbo> selet * from a; [2025-01-05T12:25:52Z ERROR sqlite3Parser] near "Token([115, 101, 108, 101, 116])": syntax error × near "selet": syntax error at (1, 6) ╭──── 1 │ selet * from a · ▲ · ╰── syntax error ╰──── ```
44 lines
1.0 KiB
TOML
44 lines
1.0 KiB
TOML
[package]
|
|
name = "sqlite3-parser"
|
|
version = "0.13.0"
|
|
edition = "2021"
|
|
authors = ["gwenn"]
|
|
description = "SQL parser (as understood by SQLite)"
|
|
documentation = "http://docs.rs/sqlite3-parser"
|
|
repository = "https://github.com/gwenn/lemon-rs"
|
|
readme = "README.md"
|
|
categories = ["parser-implementations"]
|
|
keywords = ["sql", "parser", "scanner", "tokenizer"]
|
|
license = "Apache-2.0/MIT"
|
|
build = "build.rs" # Lemon preprocessing
|
|
|
|
[badges]
|
|
maintenance = { status = "experimental" }
|
|
|
|
[features]
|
|
# FIXME: specific to one parser, not global
|
|
YYTRACKMAXSTACKDEPTH = []
|
|
YYNOERRORRECOVERY = []
|
|
YYCOVERAGE = []
|
|
NDEBUG = []
|
|
default = ["YYNOERRORRECOVERY", "NDEBUG"]
|
|
|
|
[dependencies]
|
|
phf = { version = "0.11", features = ["uncased"] }
|
|
log = "0.4.22"
|
|
memchr = "2.0"
|
|
fallible-iterator = "0.3"
|
|
bitflags = "2.0"
|
|
uncased = "0.9.10"
|
|
indexmap = "2.0"
|
|
miette = "7.4.0"
|
|
|
|
[dev-dependencies]
|
|
env_logger = { version = "0.11", default-features = false }
|
|
|
|
[build-dependencies]
|
|
cc = "1.0"
|
|
phf_shared = { version = "0.11", features = ["uncased"] }
|
|
phf_codegen = "0.11"
|
|
uncased = "0.9.10"
|