Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bfbf7861cb | |||
| 75d79f3d3d | |||
| 36da7c086e | |||
| 5514583962 | |||
| 8e98b927dd | |||
| 72d69a2b48 | |||
| 27ca07b8a0 | |||
| 235c8ad85c | |||
| 1dba6d6b48 |
@@ -5,7 +5,7 @@ go 1.19
|
||||
replace asciigoat.org/core => ../core
|
||||
|
||||
require (
|
||||
asciigoat.org/core v0.3.4
|
||||
asciigoat.org/core v0.3.6
|
||||
github.com/mgechev/revive v1.3.3
|
||||
)
|
||||
|
||||
|
||||
+16
-2
@@ -13,10 +13,24 @@ type Parser struct {
|
||||
|
||||
pos lexer.Position
|
||||
|
||||
// OnSection is called after a [section] is parsed.
|
||||
// Returning an error will abort the process.
|
||||
OnSection func(pos lexer.Position, name, subname string, hasSubname bool) error
|
||||
OnField func(pos lexer.Position, key, value string) error
|
||||
|
||||
// OnField is called after a `key = value` entry is parsed
|
||||
// Returning an error will abort the process.
|
||||
OnField func(pos lexer.Position, key, value string) error
|
||||
|
||||
// OnComment is called after a comment is parsed
|
||||
// Returning an error will abort the process.
|
||||
OnComment func(pos lexer.Position, comment string) error
|
||||
OnError func(pos lexer.Position, content string, err error) error
|
||||
|
||||
// OnError is called after each parsing error, which you are allowed to
|
||||
// override.
|
||||
// OnError is called for EOF as well, but this error isn't returned as such by
|
||||
// Parser.Run(). The caller will receive (nil, nil) instead indicating the
|
||||
// processes terminated correctly.
|
||||
OnError func(pos lexer.Position, content string, err error) error
|
||||
}
|
||||
|
||||
func defaultOnSection(_ lexer.Position, _, _ string, _ bool) error { return nil }
|
||||
|
||||
Reference in New Issue
Block a user