generate: Add comments to protocol data structures, tests

This commit is contained in:
2025-10-13 14:15:59 -04:00
parent 5a3d0e19ea
commit e991b5af67
5 changed files with 50 additions and 18 deletions

View File

@@ -21,7 +21,7 @@ func Parse(lx parse.Lexer) (*Protocol, error) {
func defaultProtocol() Protocol {
return Protocol {
Messages: make(map[uint16] Message),
Types: map[string] Type { },
Types: map[string] Typedef { },
}
}
@@ -72,6 +72,7 @@ func (this *parser) parseMessage() error {
if err != nil { return err }
this.protocol.Messages[uint16(method)] = Message {
Name: name,
// TODO: doc
Type: typ,
}
return nil
@@ -85,7 +86,10 @@ func (this *parser) parseTypedef() error {
if err != nil { return err }
typ, err := this.parseType()
if err != nil { return err }
this.protocol.Types[name] = typ
this.protocol.Types[name] = Typedef {
// TODO: doc
Type: typ,
}
return nil
}
@@ -192,6 +196,7 @@ func (this *parser) parseField() (uint16, Field, error) {
if err != nil { return 0, Field { }, err }
return uint16(key), Field {
Name: name,
// TODO: doc
Type: typ,
}, nil
}