package parsekit_test import ( "fmt" "git.makaay.nl/mauricem/go-parsekit" ) func ExampleError() { err := &parsekit.Error{ Message: "it broke down", Line: 10, Column: 42, } fmt.Println(err.Error()) fmt.Printf("%s\n", err) fmt.Println(err.Full()) // Output: // it broke down // it broke down // it broke down at line 10, column 42 } func ExampleError_Error() { err := &parsekit.Error{ Message: "it broke down", Line: 10, Column: 42, } fmt.Println(err.Error()) fmt.Printf("%s\n", err) // Output: // it broke down // it broke down } func ExampleError_Full() { err := &parsekit.Error{ Message: "it broke down", Line: 10, Column: 42, } fmt.Println(err.Full()) // Output: // it broke down at line 10, column 42 } func ExampleMatchAnyRune() { // Easy access to the parsekit definitions. a := parsekit.A matches := []string{} stateHandler := func(p *parsekit.ParseAPI) { for p.On(a.AnyRune).Accept() { matches = append(matches, p.BufLiteral()) p.BufClear() } p.ExpectEndOfFile() } parser := parsekit.NewParser(stateHandler) err := parser.Execute("¡Any will dö!") fmt.Printf("Matches = %q, Error = %s\n", matches, err) // Output: // Matches = ["¡" "A" "n" "y" " " "w" "i" "l" "l" " " "d" "ö" "!"], Error = }