Merge branch 'master' of git.libre-soc.org:soc
authorAlain D D Williams <addw@phcomp.co.uk>
Tue, 30 Mar 2021 18:10:09 +0000 (19:10 +0100)
committerAlain D D Williams <addw@phcomp.co.uk>
Tue, 30 Mar 2021 18:10:09 +0000 (19:10 +0100)
src/soc/decoder/pseudo/pagereader.py

index 8e9b0be39b66cc70afd45cbe09cca793c03a901c..ea1b6653f40765c5b5a0878fea6456c28aa52a62 100644 (file)
@@ -97,8 +97,14 @@ class ISA:
             # <!-- line 1 comment -->
             # <!-- line 2 comment -->
             if l.startswith('<!--'):
-                print ("skipping comment", l)
+                # print ("skipping comment", l)
+                l = lines.pop(0).rstrip()  # get first line
                 continue
+
+            # Ignore blank lines before the first #
+            if len(l.strip()) == 0:
+                continue
+
             # expect get heading
             assert l.startswith('#'), ("# not found in line %s" % l)
 
@@ -158,7 +164,7 @@ class ISA:
             while lines:
                 l = lines.pop(0).rstrip()
                 rewrite.append(l)
-                if len(l) != 0:
+                if len(l) != 0 and not l.startswith('<!--'):
                     break
 
         return rewrite
@@ -179,8 +185,23 @@ class ISA:
         l = lines.pop(0).rstrip()  # get first line
         while lines:
             print(l)
+            # look for HTML comment, if starting, skip line.
+            # XXX this is braindead!  it doesn't look for the end
+            # so please put ending of comments on one line:
+            # <!-- line 1 comment -->
+            # <!-- line 2 comment -->
+            if l.startswith('<!--'):
+                # print ("skipping comment", l)
+                l = lines.pop(0).rstrip()  # get next line
+                continue
+
+            # Ignore blank lines before the first #
+            if len(l) == 0:
+                l = lines.pop(0).rstrip()  # get next line
+                continue
+
             # expect get heading
-            assert l.startswith('#'), ("# not found in line %s" % l)
+            assert l.startswith('#'), ("# not found in line '%s'" % l)
             d['desc'] = l[1:].strip()
 
             # whitespace expected
@@ -255,7 +276,7 @@ class ISA:
             # expect and drop whitespace
             while lines:
                 l = lines.pop(0).rstrip()
-                if len(l) != 0:
+                if len(l) != 0 and not l.startswith('<!--'):
                     break
 
     def add_op(self, o, d):