mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-10-20 14:58:16 +02:00
qapi: Rename class QAPISchema to QAPISchemaParser
I want to name a new class QAPISchema. While there, make it a new-style class. Backports commit a4bcb2080d5c1d08bab512d76fb260296e2cae74 from qemu
This commit is contained in:
parent
fe90a5c914
commit
448a2e95ac
@ -103,7 +103,7 @@ class QAPIExprError(Exception):
|
|||||||
return error_path(self.info['parent']) + \
|
return error_path(self.info['parent']) + \
|
||||||
"%s:%d: %s" % (self.info['file'], self.info['line'], self.msg)
|
"%s:%d: %s" % (self.info['file'], self.info['line'], self.msg)
|
||||||
|
|
||||||
class QAPISchema:
|
class QAPISchemaParser(object):
|
||||||
|
|
||||||
def __init__(self, fp, previously_included = [], incl_info = None):
|
def __init__(self, fp, previously_included = [], incl_info = None):
|
||||||
abs_fname = os.path.abspath(fp.name)
|
abs_fname = os.path.abspath(fp.name)
|
||||||
@ -149,8 +149,8 @@ class QAPISchema:
|
|||||||
except IOError, e:
|
except IOError, e:
|
||||||
raise QAPIExprError(expr_info,
|
raise QAPIExprError(expr_info,
|
||||||
'%s: %s' % (e.strerror, include))
|
'%s: %s' % (e.strerror, include))
|
||||||
exprs_include = QAPISchema(fobj, previously_included,
|
exprs_include = QAPISchemaParser(fobj, previously_included,
|
||||||
expr_info)
|
expr_info)
|
||||||
self.exprs.extend(exprs_include.exprs)
|
self.exprs.extend(exprs_include.exprs)
|
||||||
else:
|
else:
|
||||||
expr_elem = {'expr': expr,
|
expr_elem = {'expr': expr,
|
||||||
@ -753,7 +753,7 @@ def check_exprs(exprs):
|
|||||||
|
|
||||||
def parse_schema(fname):
|
def parse_schema(fname):
|
||||||
try:
|
try:
|
||||||
schema = QAPISchema(open(fname, "r"))
|
schema = QAPISchemaParser(open(fname, "r"))
|
||||||
return check_exprs(schema.exprs)
|
return check_exprs(schema.exprs)
|
||||||
except (QAPISchemaError, QAPIExprError), e:
|
except (QAPISchemaError, QAPIExprError), e:
|
||||||
print >>sys.stderr, e
|
print >>sys.stderr, e
|
||||||
|
Loading…
Reference in New Issue
Block a user