diff options
Diffstat (limited to 'protoParse.go')
| -rw-r--r-- | protoParse.go | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/protoParse.go b/protoParse.go index ba1ff4c..79f36df 100644 --- a/protoParse.go +++ b/protoParse.go @@ -54,6 +54,7 @@ func (pf *File) protoParse() error { if curmsg == nil { // log.Info("curmsg == nil", line) // can't contiue on nil below here + // TODO: look for and format enum structs here continue } // log.Info("curmsg != nil", line) @@ -153,6 +154,7 @@ func parseMsgVar(line string) *MsgVar { func (pf *File) parseForMessage(line string) *MsgName { fields := strings.Fields(line) if len(fields) == 0 || fields[0] != "message" { + // this line doesn't start with message return nil } var msg *MsgName @@ -189,10 +191,28 @@ func (pf *File) parseForMessage(line string) *MsgName { msg.DoMarshal = true // log.Info("Added Marshal=true:", msg.Name) } - if strings.Contains(line, "autogenpb:gui") { + if strings.Contains(line, "`autogenpb:gui") { log.Info("got autogenpb:gui") pf.DoGui = true - // os.Exit(-1) + msg.DoGui = true + parts := strings.Split(line, "autogenpb:gu") + if len(parts) != 2 { + log.Info("len(parts) != 2", line) + os.Exit(-1) + } + log.Info("line =", line) + log.Info("end =", parts[1]) + end := strings.Split(parts[1], "`") + if end[0] != "i" { + varname := strings.TrimPrefix(end[0], "i:") + msg.GuiVarName = varname + log.Info("varname =", varname) + } else { + if strings.HasSuffix(msgName, "s") { + varname := strings.TrimSuffix(msgName, "s") + msg.GuiVarName = varname + } + } } return msg } |
