2 # QAPI frontend source file info
4 # Copyright (c) 2019 Red Hat Inc.
9 # This work is licensed under the terms of the GNU GPL, version 2.
10 # See the COPYING file in the top-level directory.
16 class QAPISchemaPragma:
18 # Are documentation comments required?
19 self.doc_required = False
20 # Whitelist of commands allowed to return a non-dictionary
21 self.returns_whitelist = []
22 # Whitelist of entities allowed to violate case conventions
23 self.name_case_whitelist = []
27 def __init__(self, fname, line, parent):
31 self.pragma = parent.pragma if parent else QAPISchemaPragma()
35 def set_defn(self, meta, name):
40 info = copy.copy(self)
45 if self.fname is None:
48 if self.line is not None:
49 ret += ':%d' % self.line
54 return "%s: In %s '%s':\n" % (self.fname,
55 self.defn_meta, self.defn_name)
58 def include_path(self):
62 ret = 'In file included from %s:\n' % parent.loc() + ret
63 parent = parent.parent
67 return self.include_path() + self.in_defn() + self.loc()