From 27686e19ae354d40cba8a74de9cb32d8e952f6ab Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 27 Oct 2023 15:45:52 +0100 Subject: [PATCH] look for and allow blank lines in pseudocode as well as english description. remove use of regex (too complex to understand) --- src/openpower/decoder/pseudo/pagereader.py | 60 ++++++++++++---------- 1 file changed, 34 insertions(+), 26 deletions(-) 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('