From: Luke Kenneth Casson Leighton Date: Fri, 27 Oct 2023 14:45:52 +0000 (+0100) Subject: look for and allow blank lines in pseudocode as well X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4e376f117a137feab64ca092251b005619935263;p=openpower-isa.git look for and allow blank lines in pseudocode as well as english description. remove use of regex (too complex to understand) --- diff --git a/src/openpower/decoder/pseudo/pagereader.py b/src/openpower/decoder/pseudo/pagereader.py index ed647a6d..e0c6cf20 100644 --- a/src/openpower/decoder/pseudo/pagereader.py +++ b/src/openpower/decoder/pseudo/pagereader.py @@ -52,7 +52,7 @@ import os import re opfields = ("desc", "form", "opcode", "regs", "pcode", "sregs", "page", - "extra_uninit_regs") + "extra_uninit_regs", "english") Ops = namedtuple("Ops", opfields) @@ -77,15 +77,37 @@ def operands(opcode, desc): if operand: yield operand -def get_indented_lines(lines): - """gets a set of indented lines, plus a blank line as termination + +def get_indented_lines(lines, pagename, expect=None): + """gets a set of indented lines, plus a blank line as termination. + blank lines are permitted inside the block, but this requires a lookahead + at the next line to see if the next section is coming up (expected). + but... Description is currently *optional* sigh therefore it is + necessary to look for *either* "Special" *or* "Description" sigh + TODO: simplify once all Descriptions are added """ li = [] while lines: l = lines.pop(0).rstrip() + # grrrr skip comments + if l.strip().startswith('", l) - if re_match: - for i in re_match[1].split(' '): - if i != "": - extra_uninit_regs.add(i) - li.append("") - continue - if l.strip().startswith('