Eric Blake <[email protected]> writes: > On 07/26/2013 06:39 AM, Markus Armbruster wrote: >> Signed-off-by: Markus Armbruster <[email protected]> >> --- >> scripts/qapi.py | 29 +++++++++++++++++++++++++++-- >> tests/qapi-schema/test-qapi.py | 2 ++ >> tests/qapi-schema/unclosed-string.err | 2 +- >> 3 files changed, 30 insertions(+), 3 deletions(-) > >> >> +class QAPISchemaError(Exception): >> + def __init__(self, schema, msg): >> + self.fp = schema.fp >> + self.msg = msg >> + self.line = self.col = 1 >> + for ch in schema.src[0:schema.pos]: >> + if ch == '\n': >> + self.line += 1 >> + self.col = 1 >> + elif ch == '\t': >> + self.col = (self.col + 7) % 8 + 1 > > Do we even want to allow TABs in the schema files? Right now, they are > tab-free; if you error out here instead of futzing with tab width, we > could forcefully maintain that property.
I'm not volunteering for the TAB police, but if y'all want the parser to reject TABs, I can do that. >> + else: >> + self.col += 1 > > Does python support ++ as shorthand for += 1? It doesn't, sadly. > Reviewed-by: Eric Blake <[email protected]>
