### Seq Combinator for Sequential Matching Source: https://context7.com/vektah/goparsify/llms.txt Shows how the `Seq` combinator matches multiple parsers in order, storing their results in `Child`. Includes an example of mapping results to a custom type and handling sequence failures. ```go package main import ( "fmt" . "github.com/vektah/goparsify" ) func main() { // Match key=value pairs kvParser := Seq(Chars("a-zA-Z"), "=", Chars("a-zA-Z0-9")).Map(func(n *Result) { n.Result = map[string]string{ n.Child[0].Token: n.Child[2].Token, } }) result, err := Run(kvParser, "color=blue") if err != nil { panic(err) } fmt.Println(result) // map[color:blue] // If any parser in the sequence fails, the whole Seq fails and Pos is restored _, err2 := Run(kvParser, "color") fmt.Println(err2) // offset 5: expected = } ``` -------------------------------- ### Example Debug Output from HTML Parser Test Source: https://github.com/vektah/goparsify/blob/master/readme.md This output shows the detailed step-by-step execution of the HTML parser when run with debugging enabled. It logs the state of the parser, tokens found, and expected tokens. ```text adam:goparsify(master)$ go test -tags debug ./html -v === RUN TestParse hTml.go:48 |
hellohello
hello
hello
hello
hello
hello
hello
hello
found > hTml.go:43 | hello
] hTml.go:24 | hello
hTml.go:48 |
| < found < hTml.go:20 | color="blue">w | identifier found p hTml.go:33 | color="blue">w | attrs { hTml.go:32 | color="blue">w | attr { hTml.go:20 | ="blue">world | identifier found color hTml.go:32 | "blue">world | = found = hTml.go:32 | >world
worldworldworldworldworld found > hTml.go:43 | world