X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Fspv%2Fbinary-parser-generator;h=ccae0e474e42c3f773249311e83ee469b672f2cc;hb=0394b56ed72885ec7a9dec776c1c676768e7c01a;hp=a62456c4b3498a22316ce465eac03cc351ff388d;hpb=5805214e9bb9e2a4705ada8cdf5f5d0f1814db0e;p=pspp diff --git a/src/output/spv/binary-parser-generator b/src/output/spv/binary-parser-generator index a62456c4b3..ccae0e474e 100644 --- a/src/output/spv/binary-parser-generator +++ b/src/output/spv/binary-parser-generator @@ -104,6 +104,13 @@ def get_token(): elif line.startswith('...'): token = (line[:3], ) line = line[3:] + elif line.startswith('"'): + n = 1 + while n < len(line) and (line[n] != '"'): + n += 1 + s = line[1:n].encode() + line = line[n+1:] + token = ('bytes', struct.pack('%s%s == %s) {' % ( indent, '} else ' if i else '', accessor, item.name, value_name)) - + print_free_items(name, choice, indent + ' ', accessor + choice_name + '.', ctx) i += 1 @@ -764,7 +773,7 @@ def print_print_items(name, production, indent, accessor, ctx): print('%s%sif (p->%s%s == %s) {' % ( indent, '} else ' if i else '', accessor, item.name, value_name)) - + print_print_items(name, choice, indent + ' ', accessor + choice_name + '.', ctx) i += 1 @@ -797,7 +806,7 @@ void def name_to_id(s): return s[0].lower() + ''.join(['_%c' % x.lower() if x.isupper() else x for x in s[1:]]).replace('-', '_') - + if __name__ == "__main__": argv0 = sys.argv[0]