qapi: Fix to reject stray 't', 'f' and 'n'

Screwed up in commit e53188a.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Markus Armbruster 2015-06-10 08:24:58 +02:00
parent a136608727
commit e565d934d2

View file

@ -217,20 +217,18 @@ class QAPISchema:
return return
else: else:
string += ch string += ch
elif self.tok in "tfn": elif self.src.startswith("true", self.pos):
val = self.src[self.cursor - 1:] self.val = True
if val.startswith("true"): self.cursor += 3
self.val = True return
self.cursor += 3 elif self.src.startswith("false", self.pos):
return self.val = False
elif val.startswith("false"): self.cursor += 4
self.val = False return
self.cursor += 4 elif self.src.startswith("null", self.pos):
return self.val = None
elif val.startswith("null"): self.cursor += 3
self.val = None return
self.cursor += 3
return
elif self.tok == '\n': elif self.tok == '\n':
if self.cursor == len(self.src): if self.cursor == len(self.src):
self.tok = None self.tok = None