Build with Naz : Comprehensive guide to nom parsing

This tutorial and video are a comprehensive guide to parsing with nom. We cover the basics of parsing and how to use nom to parse a string into a data structure. And more complex topics like human readable error reporting, and building up complex parsers. We will create a variety of different examples ranging from parsing simple CSS like syntax to a full blown Markdown parser. Article: https://developerlife.com/2023/02/20/... For comments and feedback please use these: Repo: https://github.com/nazmulidris/rust-s... Issues: https://github.com/nazmulidris/rust-s... Chapters: 00:00:00 Intro 00:01:22 No copy, fast parsing 00:02:28 Combinatorial functional parser 00:02:50 Important types - Parser trait and IResult 00:04:00 Nominomicon and nom repo examples 00:05:37 Accompanying blog post on developerlife.com 00:05:50 Create a new crate for live coding video 00:06:30 Create the first example - parse a hex color string to a Color 00:08:53 Output type Color 00:09:30 Implement the parser for a 2 digit hex segment string, eg "FF" 00:11:11 IResult, Input, Output, Error types 00:14:15 take_while_m_n() 00:18:30 What are the types returned by take_while_m_n()? 00:20:44 Use map_res() to parse the hex string to a u8 00:21:39 Refactor to get the types, lots of higher order functions 00:25:28 Test the hex segment parser so far 00:30:00 Combine the parse_hex_seg() with tag() to parse a full hex color string 00:31:36 Test the full hex color string parser 00:32:48 Now that we have a parser, let's re-implemented in many different ways 00:33:30 Variant of hex parser using preceded() and tuple() 00:37:28 Test the variant that uses preceded() and tuple() 00:42:00 Make another variant which is a function that returns a function to do the parsing 00:43:50 Get a better understanding of the types for higher order functions 00:47:00 Function that returns a function, with all the types, even for Errors 00:51:00 Use this high order function variant to understand the Parser trait 00:54:30 Refactor existing simplistic variant with tuple() 00:56:00 Many different ways to call tuple() 00:58:34 Why can’t we parse “🌜_2F14DF🔅”? 00:59:43 Make a parser that can parse “🌜_2F14DF🔅” 01:12:33 Touching on nom::error::VerboseError 01:14:17 Error handling & human readable output 01:15:26 VerboseError 01:19:08 context 01:26:51 convert_error 01:31:38 Show case different types of human readable nom errors 01:34:34 Implement a simple CSS parser 01:59:53 Implement a simple natural language parser 02:14:35 Simple markdown parser example 02:17:36 Production markdown parser code 02:19:00 Outro