Expand some comments by Geoff's request

This commit is contained in:
Yuriy Taraday 2018-03-02 00:26:38 +04:00
parent 35cd6327cf
commit 8965adaafb
2 changed files with 14 additions and 1 deletions

View File

@ -564,6 +564,17 @@ func AddEnumVal(name, val string) error {
}
// AddEnumValMeta will add a new enum value with attached metadata to the list.
// Metadata is parsed from annotations in libvirt RPC description file that are
// in block comment preceding every function in enum, it looks like this:
// /**
// * @generate: both
// * @readstream: 1
// * @sparseflag: VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM
// * @acl: storage_vol:data_read
// */
// See full description of possible annotations in libvirt's src/remote/remote_protocol.x
// at the top of remote_procedure enum.
// We're parsing only @readstream and @writestream annotations at the moment.
func AddEnumValMeta(name, val, meta string) error {
ev, err := parseNumber(val)
if err != nil {

View File

@ -259,10 +259,12 @@ func lexText(l *Lexer) stateFn {
// lexBlockComment is used when we find a comment marker '/*' in the input.
func lexBlockComment(l *Lexer) stateFn {
// Double star is used only at the start of metadata comments
metadataComment := strings.HasPrefix(l.input[l.pos:], "/**")
for {
if strings.HasPrefix(l.input[l.pos:], "*/") {
// Found the end. Advance past the '*/' and discard the comment body.
// Found the end. Advance past the '*/' and discard the comment body
// unless it's a metadata comment
l.next()
l.next()
if metadataComment {