From: Jacob Lifshay Date: Fri, 5 May 2023 00:34:27 +0000 (-0700) Subject: verify fields.txt forms' field separators ('|') line up with headers' X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=496c01f81a9afda2edca268e93d5f0fa785a220a;p=openpower-isa.git verify fields.txt forms' field separators ('|') line up with headers' --- diff --git a/openpower/isatables/fields.text b/openpower/isatables/fields.text index 451fb57d..89ad7530 100644 --- a/openpower/isatables/fields.text +++ b/openpower/isatables/fields.text @@ -140,7 +140,7 @@ # 1.6.7.1 DCT-FORM - |0 |6 |11 |16 |21 |26 |31 | + |0 |6 |11 |16 |21 |26 |31 | | PO | FRT | FRA | FRB | // | XO | Rc | # 1.6.8 XL-FORM @@ -212,7 +212,7 @@ | PO | RT | IT | CVM | FRB | OE | XO | Rc | # 1.6.17 A-FORM - |0 |6 |11 |16 |21 |26 |31 | + |0 |6 |11 |16 |21 |26 |31 | | PO | FRT | FRA | FRB | FRC | XO |Rc | | PO | FRT | FRA | FRB | /// | XO |Rc | | PO | FRT | FRA | /// | FRC | XO |Rc | diff --git a/src/openpower/decoder/power_fields.py b/src/openpower/decoder/power_fields.py index b0f17909..892af1d8 100644 --- a/src/openpower/decoder/power_fields.py +++ b/src/openpower/decoder/power_fields.py @@ -489,7 +489,7 @@ class DecodeFields: #print ("decode", txt) forms = {} reading_data = False - for l in txt: + for lineno, l in enumerate(txt): l = l.strip() if len(l) == 0: continue @@ -497,7 +497,20 @@ class DecodeFields: if l[0] == '#': reading_data = False else: - forms[heading].append(l) + form = forms[heading] + form.append(l) + if len(form) <= 1: + continue + for i, ch in enumerate(l): + if ch != '|': + continue + if i >= len(form[0]) or form[0][i] != '|': + col = len(txt[lineno]) - len(txt[lineno].lstrip()) + col += i + 1 + raise SyntaxError( + "form line field separator ('|') " + "with no corresponding separator in header", + (self.fname, lineno + 1, col, txt[lineno])) if not reading_data: assert l[0] == '#' heading = l[1:].strip()