diff options
Diffstat (limited to 'nexgb/xgbgen/context.go')
-rw-r--r-- | nexgb/xgbgen/context.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nexgb/xgbgen/context.go b/nexgb/xgbgen/context.go index 32dee58..b35bc5a 100644 --- a/nexgb/xgbgen/context.go +++ b/nexgb/xgbgen/context.go @@ -6,6 +6,7 @@ import ( "fmt" "log" "sort" + "strings" ) // Context represents the protocol we're converting to Go, and a writer @@ -34,6 +35,13 @@ func (c *Context) Put(format string, v ...interface{}) { } } +// PutComment writes each line of comment commented out to 'out'. +func (c *Context) PutComment(comment string) { + for _, line := range strings.Split(comment, "\n") { + c.Putln("// %s", line) + } +} + // Morph is the big daddy of them all. It takes in an XML byte slice, // parse it, transforms the XML types into more usable types, // and writes Go code to the 'out' buffer. |