Feat: add structured diagnostics with yansi colors

Introduces fluxc/src/diagnostics.rs with Level (Critical, Error,
Warning, Note), Label (Primary/Secondary with optional message), and
Diagnostic types. Diagnostic::render(src, filename) produces
rustc-style output: colored header, --> file:line:col pointer, source
line with gutter, and ^ / - underlines aligned to the offending span.

Replaces the flat ParseError struct in the parser; all five error
sites now emit Diagnostic values with source-pointing labels.
This commit is contained in:
2026-03-10 18:42:40 +01:00
parent a82b7e4633
commit 5bf4a494cb
7 changed files with 365 additions and 41 deletions

7
fluxc/Cargo.lock generated
View File

@@ -7,6 +7,7 @@ name = "fluxc"
version = "0.1.0"
dependencies = [
"unicode-xid",
"yansi",
]
[[package]]
@@ -14,3 +15,9 @@ name = "unicode-xid"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "yansi"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"