chiark / gitweb /
make-secnet-sites: Introduce copyout() in pline()
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 24 Oct 2019 14:10:55 +0000 (15:10 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 24 Oct 2019 18:16:17 +0000 (19:16 +0100)
These are all the places where we simply copy the input line to our
output.  We are going to do something more complicated in a moment, so
centralising this is useful.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
make-secnet-sites

index cff283c8d9b8756026caecb7a26d3c8e6a1e00dd..55c66cc91b41b1b4ff3838597d66a279bf1b977f 100755 (executable)
@@ -545,11 +545,12 @@ def pline(i,allow_include=False):
        w=list([Tainted(x) for x in w])
        keyword=w[0]
        current=obstack[len(obstack)-1]
+       copyout=lambda: [i]
        if keyword=='end-definitions':
                keyword.raw_mark_ok()
                allow_defs=sitelevel.depth
                obstack=[root]
-               return [i]
+               return copyout()
        if keyword=='include':
                if not allow_include:
                        complain("include not permitted here")
@@ -591,7 +592,7 @@ def pline(i,allow_include=False):
                        current.children[tname]=nl
                        current=nl
                obstack.append(current)
-               return [i]
+               return copyout()
        if keyword.raw() not in current.allow_properties:
                complain("Property %s not allowed at %s level"%
                        (keyword.raw(),current.type))
@@ -601,7 +602,7 @@ def pline(i,allow_include=False):
                return []
        else:
                set_property(current,w)
-               return [i]
+               return copyout()
 
        complain("unknown keyword '%s'"%(keyword.raw()))