9 Commits

Author SHA1 Message Date
amery cd35c83125 Unmarshal: WIP
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-30 02:16:25 +00:00
amery 1b236f3638 Decoder: WIP
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-30 02:16:25 +00:00
amery 76659d2326 basic: WIP
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-30 02:16:25 +00:00
amery 7a5dc59929 parser: WIP
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-30 02:15:55 +00:00
amery 7c0688e3b1 parser: emitError
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-30 02:15:40 +00:00
amery e0155b5103 parser: callbacks [WIP]
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-30 02:12:35 +00:00
amery 8f34cdf891 build-sys: use local asciigoat.org/core [DO-NOT-MERGE]
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-30 02:11:26 +00:00
amery 70c8ed1d34 parser: implement initial tokeniser
only logging position, errors and non-whitespace elements

Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-30 02:10:37 +00:00
amery 00fcde4c5b parser: add placeholder for ini Parser
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-30 02:06:31 +01:00
2 changed files with 3 additions and 17 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ go 1.19
replace asciigoat.org/core => ../core
require (
asciigoat.org/core v0.3.6
asciigoat.org/core v0.3.4
github.com/mgechev/revive v1.3.3
)
+2 -16
View File
@@ -13,24 +13,10 @@ 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 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.
OnField func(pos lexer.Position, key, value string) error
OnComment func(pos lexer.Position, comment string) 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
OnError func(pos lexer.Position, content string, err error) error
}
func defaultOnSection(_ lexer.Position, _, _ string, _ bool) error { return nil }