'QType': 'QTYPE_QSTRING',
}
+# Are documentation comments required?
+doc_required = False
+
# Whitelist of commands allowed to return a non-dictionary
returns_whitelist = [
# From QMP:
"Value of 'include' must be a string")
self._include(include, info, os.path.dirname(abs_fname),
previously_included)
+ elif "pragma" in expr:
+ if len(expr) != 1:
+ raise QAPISemError(info, "Invalid 'pragma' directive")
+ pragma = expr['pragma']
+ if not isinstance(pragma, dict):
+ raise QAPISemError(
+ info, "Value of 'pragma' must be a dictionary")
+ for name, value in pragma.iteritems():
+ self._pragma(name, value, info)
else:
expr_elem = {'expr': expr,
'info': info}
self.exprs.extend(exprs_include.exprs)
self.docs.extend(exprs_include.docs)
+ def _pragma(self, name, value, info):
+ global doc_required
+ if name == 'doc-required':
+ if not isinstance(value, bool):
+ raise QAPISemError(info,
+ "Pragma 'doc-required' must be boolean")
+ doc_required = value
+ else:
+ raise QAPISemError(info, "Unknown pragma '%s'" % name)
+
def accept(self, skip_comment=True):
while True:
self.tok = self.src[self.cursor]
expr = expr_elem['expr']
info = expr_elem['info']
- if 'doc' not in expr_elem:
+ if 'doc' not in expr_elem and doc_required:
raise QAPISemError(info,
"Expression missing documentation comment")