4 days ago · 8 min read1514 words · Tech · hide · 0 comments

home tools rss | bitty Better nom Error Messages with nom_locate August 2026 UPDATE: The original version of this post only passed the name of the last parser in the chain. This version is updated to show all the parsers that lead to the error. Parsing Parser Errors I designed a note taking format called NeoDocnd. It currently exists only as an embedded feature of my personal static site generator. I'm in the process of extracting it to its own library. That means digging into the nomnom parser/combinator and its cryptic as hell error messages. "Just how cryptic?" you ask. Let me give you an example. A First Look This codes makes a tiny rust app that uses nom's alt feature to attempt to use two child parsers to process a piece of text. Cargo.toml [package] name = "default_errors" version = "0.1.0" edition = "2024" [dependencies] nom = "8.0.0" use nom::branch::alt; use nom::bytes::complete::tag; use nom::{IResult, Parser}; use std::fs; fn main() { let input = "target"; let result =…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.