| 1 | package astxscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src go1.24 fmt/" |
| 5 | "testingscip-go gomod github.com/golang/go/src go1.24 testing/" |
| 6 | |
| 7 | "github.com/goccmack/gocc/example/errorrecovery/astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/ast`/" |
| 8 | "github.com/goccmack/gocc/example/errorrecovery/errorsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/errors`/" |
| 9 | "github.com/goccmack/gocc/example/errorrecovery/lexerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/lexer`/" |
| 10 | "github.com/goccmack/gocc/example/errorrecovery/parserscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/parser`/" |
| 11 | ) |
| 12 | |
| 13 | func TestFailscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery`/TestFail().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) { |
| 14 | sml, err := testscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery`/test().([]byte("a b ; d e f")) |
| 15 | if err != nil { |
| 16 | t.Failscip-go gomod github.com/golang/go/src go1.24 testing/common#Fail().() |
| 17 | } |
| 18 | fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Printscip-go gomod github.com/golang/go/src go1.24 fmt/Print().("output: [\n") |
| 19 | for _, s := range sml { |
| 20 | switch sym := s.(type) { |
| 21 | case *errorsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/errors`/.Errorscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/errors`/Error#: |
| 22 | fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Printfscip-go gomod github.com/golang/go/src go1.24 fmt/Printf().("%s\n", sym) |
| 23 | default: |
| 24 | fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Printfscip-go gomod github.com/golang/go/src go1.24 fmt/Printf().("\t%v\n", sym) |
| 25 | } |
| 26 | } |
| 27 | fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.24 fmt/Println().("]") |
| 28 | } |
| 29 | |
| 30 | func testscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery`/test().(src []byte) (astree astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/ast`/.StmtListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/ast`/StmtList#, err error) { |
| 31 | fmtscip-go gomod github.com/golang/go/src go1.24 fmt/.Printfscip-go gomod github.com/golang/go/src go1.24 fmt/Printf().("input: %s\n", src) |
| 32 | s := lexerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/lexer`/.NewLexerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/lexer`/NewLexer().(src) |
| 33 | p := parserscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/parser`/.NewParserscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/parser`/NewParser().() |
| 34 | a, err := p.Parsescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/parser`/Parser#Parse().(s) |
| 35 | if err == nil { |
| 36 | astree = a.(astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/ast`/.StmtListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/example/errorrecovery/ast`/StmtList#) |
| 37 | } |
| 38 | return |
| 39 | } |