From cc480681d84d792c457f9bcd736fcafb8138aeb9 Mon Sep 17 00:00:00 2001 From: Aurelio Jargas Date: Thu, 29 Aug 2019 18:37:48 +0200 Subject: [PATCH] test: Improve comment handling testing The previous test/parsing/comment* files were too simple. Now I've added corner cases, bug raising samples (using ";", see issues #49 and #50) and a more complete coverage. --- test/debug/comment.gnu.sed.txt | 18 +- test/debug/comment.sed.txt | 18 +- test/dumpdebug/comment.gnu.sed | 175 ++++++++++- test/dumpdebug/comment.sed | 195 ++++++++++-- test/html/comment.gnu.sed.html | 36 ++- test/html/comment.sed.html | 53 +++- test/indent/comment.gnu.sed | 36 ++- test/indent/comment.sed | 53 +++- test/parsing/comment.gnu.sed | 31 +- test/parsing/comment.sed | 30 +- test/token/comment.gnu.sed.txt | 332 +++++++++++++++++++- test/token/comment.sed.txt | 540 +++++++++++++++++++++++++++++++-- 12 files changed, 1372 insertions(+), 145 deletions(-) diff --git a/test/debug/comment.gnu.sed.txt b/test/debug/comment.gnu.sed.txt index f4410a6..56d51b3 100644 --- a/test/debug/comment.gnu.sed.txt +++ b/test/debug/comment.gnu.sed.txt @@ -1,42 +1,36 @@ PATT:one$ HOLD:$ -COMM:/bla/ { -COMM:s/// +COMM:/foo/ { PATT:one$ HOLD:$ one PATT:two$ HOLD:$ -COMM:/bla/ { -COMM:s/// +COMM:/foo/ { PATT:two$ HOLD:$ two PATT:three$ HOLD:$ -COMM:/bla/ { -COMM:s/// +COMM:/foo/ { PATT:three$ HOLD:$ three PATT:four$ HOLD:$ -COMM:/bla/ { -COMM:s/// +COMM:/foo/ { PATT:four$ HOLD:$ four PATT:five$ HOLD:$ -COMM:/bla/ { -COMM:s/// +COMM:/foo/ { PATT:five$ HOLD:$ five PATT:six$ HOLD:$ -COMM:/bla/ { -COMM:s/// +COMM:/foo/ { PATT:six$ HOLD:$ six diff --git a/test/debug/comment.sed.txt b/test/debug/comment.sed.txt index f4410a6..56d51b3 100644 --- a/test/debug/comment.sed.txt +++ b/test/debug/comment.sed.txt @@ -1,42 +1,36 @@ PATT:one$ HOLD:$ -COMM:/bla/ { -COMM:s/// +COMM:/foo/ { PATT:one$ HOLD:$ one PATT:two$ HOLD:$ -COMM:/bla/ { -COMM:s/// +COMM:/foo/ { PATT:two$ HOLD:$ two PATT:three$ HOLD:$ -COMM:/bla/ { -COMM:s/// +COMM:/foo/ { PATT:three$ HOLD:$ three PATT:four$ HOLD:$ -COMM:/bla/ { -COMM:s/// +COMM:/foo/ { PATT:four$ HOLD:$ four PATT:five$ HOLD:$ -COMM:/bla/ { -COMM:s/// +COMM:/foo/ { PATT:five$ HOLD:$ five PATT:six$ HOLD:$ -COMM:/bla/ { -COMM:s/// +COMM:/foo/ { PATT:six$ HOLD:$ six diff --git a/test/dumpdebug/comment.gnu.sed b/test/dumpdebug/comment.gnu.sed index 238487a..50952eb 100644 --- a/test/dumpdebug/comment.gnu.sed +++ b/test/dumpdebug/comment.gnu.sed @@ -1,4 +1,7 @@ # GNU sed accepts end-of-line comments with no ; before. +### foo +#foo +# s/^/PATT:/ l s/^PATT:// @@ -8,14 +11,17 @@ s/^HOLD:// x i\ -COMM:/bla/ { +COMM:/foo/ { #-------------------------------------------------- -/bla/ { -# at this address +/foo/ { +# c1 i\ -COMM:h +COMM:c\\\\N1 #-------------------------------------------------- -h +c\ +1 +# foo;bar +#; s/^/PATT:/ l s/^PATT:// @@ -25,10 +31,9 @@ h s/^HOLD:// x i\ -COMM:g +COMM:p #-------------------------------------------------- -g -# +p s/^/PATT:/ l s/^PATT:// @@ -38,14 +43,158 @@ g s/^HOLD:// x i\ -COMM:} +COMM:p #-------------------------------------------------- -} +p + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:p +#-------------------------------------------------- +p + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:p +#-------------------------------------------------- +p + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:p +#-------------------------------------------------- +p + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:p +#-------------------------------------------------- +p + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:s/a/b/ +#-------------------------------------------------- +s/a/b/ + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x i\ -COMM:s/// - /bla/y/!/!/ +COMM:s/a/b/ #-------------------------------------------------- -s/// +s/a/b/ + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:s/a/b/gp +#-------------------------------------------------- +s/a/b/gp + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:s/a/b/gp +#-------------------------------------------------- +s/a/b/gp + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM::foo +#-------------------------------------------------- +:foo + i\ +COMM::foo +#-------------------------------------------------- +:foo + i\ +COMM:b foo +#-------------------------------------------------- +b foo + i\ +COMM:b foo +#-------------------------------------------------- +b foo + i\ +COMM:b +#-------------------------------------------------- +b + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:b +#-------------------------------------------------- +b + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:} +#-------------------------------------------------- +} +# s/^/PATT:/ l s/^PATT:// diff --git a/test/dumpdebug/comment.sed b/test/dumpdebug/comment.sed index 99a57ce..875cdfa 100644 --- a/test/dumpdebug/comment.sed +++ b/test/dumpdebug/comment.sed @@ -1,3 +1,6 @@ +### foo +#foo +# s/^/PATT:/ l s/^PATT:// @@ -7,15 +10,17 @@ s/^HOLD:// x i\ -COMM:/bla/ { +COMM:/foo/ { #-------------------------------------------------- -/bla/ { -# at this address +/foo/ { +# c1 i\ -COMM:h +COMM:c\\\\N1 - allowed without #-------------------------------------------------- -h -# do this +c\ +1 - allowed without +# foo;bar +#; s/^/PATT:/ l s/^PATT:// @@ -25,11 +30,10 @@ h s/^HOLD:// x i\ -COMM:g +COMM:p #-------------------------------------------------- -g -# than that -# +p +#p1 s/^/PATT:/ l s/^PATT:// @@ -39,16 +43,173 @@ g s/^HOLD:// x i\ -COMM:} +COMM:p #-------------------------------------------------- -} -#loop end +p +# p2 + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:p +#-------------------------------------------------- +p +### p3 + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:p +#-------------------------------------------------- +p +# p4 + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:p +#-------------------------------------------------- +p + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:p +#-------------------------------------------------- +p +# p5 + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:s/a/b/ +#-------------------------------------------------- +s/a/b/ +#s1 + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x i\ -COMM:s/// - /bla/y/!/!/ +COMM:s/a/b/ #-------------------------------------------------- -s/// -# script end +s/a/b/ +# s2 + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:s/a/b/gp +#-------------------------------------------------- +s/a/b/gp +#s3 + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:s/a/b/gp +#-------------------------------------------------- +s/a/b/gp +# s4 + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM::foo +#-------------------------------------------------- +:foo +#l1 + i\ +COMM::foo +#-------------------------------------------------- +:foo +# l2 + i\ +COMM:b foo +#-------------------------------------------------- +b foo +#b1 + i\ +COMM:b foo +#-------------------------------------------------- +b foo +# b2 + i\ +COMM:b +#-------------------------------------------------- +b +#b3 + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:b +#-------------------------------------------------- +b +# b4 + s/^/PATT:/ + l + s/^PATT:// + x + s/^/HOLD:/ + l + s/^HOLD:// + x + i\ +COMM:} +#-------------------------------------------------- +} +# c2 +# s/^/PATT:/ l s/^PATT:// diff --git a/test/html/comment.gnu.sed.html b/test/html/comment.gnu.sed.html index 7705dfa..574c3f1 100644 --- a/test/html/comment.gnu.sed.html +++ b/test/html/comment.gnu.sed.html @@ -5,15 +5,33 @@ link="#ff00ff" alink="#ff00ff" vlink="#ff00ff">
 # GNU sed accepts end-of-line comments with no ; before.
-
-/bla/ {;# at this address
-    # at this address
-    h;# do this
-    g;# than that
-    #
-}  ;#loop end
-
-s///;# script end
+### foo
+#foo
+#
+/foo/ {;# c1
+    # c1
+    c\
+1
+    # foo;bar
+    #;
+    p;#p1
+    p;# p2
+    p;### p3
+    p;# p4
+    p
+    p;# p5
+    s/a/b/;#s1
+    s/a/b/;# s2
+    s/a/b/gp;#s3
+    s/a/b/gp;# s4
+    :foo;#l1
+    :foo;# l2
+    b foo;#b1
+    b foo;# b2
+    b ;#b3
+    b ;# b4
+}  ;# c2
+#
 
 ### colorized by sedsed, a debugger and code formatter for sed scripts
 
diff --git a/test/html/comment.sed.html b/test/html/comment.sed.html
index fed71e4..d71b6b1 100644
--- a/test/html/comment.sed.html
+++ b/test/html/comment.sed.html
@@ -4,18 +4,49 @@
 
 
-/bla/ {;# at this address
-    # at this address
-    h
-    # do this
-    g
-    # than that
-    #
+### foo
+#foo
+#
+/foo/ {;# c1
+    # c1
+    c\
+1 - allowed without 
+    # foo;bar
+    #;
+    p
+    #p1
+    p
+    # p2
+    p
+    ### p3
+    p
+    # p4
+    p
+    p
+    # p5
+    s/a/b/
+    #s1
+    s/a/b/
+    # s2
+    s/a/b/gp
+    #s3
+    s/a/b/gp
+    # s4
+    :foo
+    #l1
+    :foo
+    # l2
+    b foo
+    #b1
+    b foo
+    # b2
+    b 
+    #b3
+    b 
+    # b4
 }
-#loop end
-
-s///
-# script end
+# c2
+#
 
 ### colorized by sedsed, a debugger and code formatter for sed scripts
 
diff --git a/test/indent/comment.gnu.sed b/test/indent/comment.gnu.sed
index 8896023..71641f0 100644
--- a/test/indent/comment.gnu.sed
+++ b/test/indent/comment.gnu.sed
@@ -1,10 +1,28 @@
 # GNU sed accepts end-of-line comments with no ; before.
-
-/bla/ {                                ;# at this address
-    # at this address
-    h                                  ;# do this
-    g                                  ;# than that
-    #
-}                                      ;#loop end
-
-s///                                   ;# script end
+### foo
+#foo
+#
+/foo/ {                                ;# c1
+    # c1
+    c\
+1
+    # foo;bar
+    #;
+    p                                  ;#p1
+    p                                  ;# p2
+    p                                  ;### p3
+    p                                  ;# p4
+    p
+    p                                  ;# p5
+    s/a/b/                             ;#s1
+    s/a/b/                             ;# s2
+    s/a/b/gp                           ;#s3
+    s/a/b/gp                           ;# s4
+    :foo                               ;#l1
+    :foo                               ;# l2
+    b foo                              ;#b1
+    b foo                              ;# b2
+    b                                  ;#b3
+    b                                  ;# b4
+}                                      ;# c2
+#
diff --git a/test/indent/comment.sed b/test/indent/comment.sed
index 2d4b913..ba81354 100644
--- a/test/indent/comment.sed
+++ b/test/indent/comment.sed
@@ -1,12 +1,43 @@
-/bla/ {                                ;# at this address
-    # at this address
-    h
-    # do this
-    g
-    # than that
-    #
+### foo
+#foo
+#
+/foo/ {                                ;# c1
+    # c1
+    c\
+1 - allowed without 
+    # foo;bar
+    #;
+    p
+    #p1
+    p
+    # p2
+    p
+    ### p3
+    p
+    # p4
+    p
+    p
+    # p5
+    s/a/b/
+    #s1
+    s/a/b/
+    # s2
+    s/a/b/gp
+    #s3
+    s/a/b/gp
+    # s4
+    :foo
+    #l1
+    :foo
+    # l2
+    b foo
+    #b1
+    b foo
+    # b2
+    b 
+    #b3
+    b 
+    # b4
 }
-#loop end
-
-s///
-# script end
+# c2
+#
diff --git a/test/parsing/comment.gnu.sed b/test/parsing/comment.gnu.sed
index b312e18..37bb5e9 100644
--- a/test/parsing/comment.gnu.sed
+++ b/test/parsing/comment.gnu.sed
@@ -1,9 +1,24 @@
 # GNU sed accepts end-of-line comments with no ; before.
-
-/bla/ {   # at this address
-  h       # do this
-  g       # than that
-          #
-}    #loop end
-
-s/// # script end
+### foo
+#foo
+#
+/foo/ { # c1;c1
+  # foo;bar
+  #;
+  p#p1
+  p # p2
+  p ### p3
+  p  # p4;p4
+  p   # p5
+  s/a/b/#s1
+  s/a/b/ # s2
+  s/a/b/gp#s3
+  s/a/b/gp # s4
+  :foo#l1
+  :foo # l2
+  b foo#b1
+  b foo # b2
+  b#b3
+  b # b4
+} # c2
+#
diff --git a/test/parsing/comment.sed b/test/parsing/comment.sed
index a0b58fa..0a7ba8b 100644
--- a/test/parsing/comment.sed
+++ b/test/parsing/comment.sed
@@ -1,7 +1,23 @@
-/bla/ {   # at this address
-  h;      # do this
-  g;      # than that
-          #
-};   #loop end
-
-s///; # script end
+### foo
+#foo
+#
+/foo/ { # c1;c1 - allowed without ;
+  # foo;bar
+  #;
+  p;#p1
+  p; # p2
+  p; ### p3
+  p ; # p4;p4
+  p   ;# p5
+  s/a/b/;#s1
+  s/a/b/ ;# s2
+  s/a/b/gp;#s3
+  s/a/b/gp ;# s4
+  :foo;#l1
+  :foo ;# l2
+  b foo;#b1
+  b foo ;# b2
+  b;#b3
+  b ;# b4
+} ;# c2
+#
diff --git a/test/token/comment.gnu.sed.txt b/test/token/comment.gnu.sed.txt
index f21b132..24b2fe8 100644
--- a/test/token/comment.gnu.sed.txt
+++ b/test/token/comment.gnu.sed.txt
@@ -14,21 +14,21 @@
  extrainfo:
    comment:# GNU sed accepts end-of-line comments with no ; before.
 
-    linenr:3
-     addr1:/bla/
+    linenr:2
+     addr1:
  addr1flag:
      addr2:
  addr2flag:
   lastaddr:
   modifier:
-        id:{
+        id:#
    content:
  delimiter:
    pattern:
    replace:
       flag:
  extrainfo:
-   comment:# at this address
+   comment:### foo
 
     linenr:3
      addr1:
@@ -44,7 +44,7 @@
    replace:
       flag:
  extrainfo:
-   comment:# at this address
+   comment:#foo
 
     linenr:4
      addr1:
@@ -53,14 +53,30 @@
  addr2flag:
   lastaddr:
   modifier:
-        id:h
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:#
+
+    linenr:5
+     addr1:/foo/
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:{
    content:
  delimiter:
    pattern:
    replace:
       flag:
  extrainfo:
-   comment:# do this
+   comment:# c1
 
     linenr:5
      addr1:
@@ -69,14 +85,30 @@
  addr2flag:
   lastaddr:
   modifier:
-        id:g
+        id:#
    content:
  delimiter:
    pattern:
    replace:
       flag:
  extrainfo:
-   comment:# than that
+   comment:# c1
+
+    linenr:5
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:c
+   content:\@#linesep#@1
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:
 
     linenr:6
      addr1:
@@ -92,7 +124,7 @@
    replace:
       flag:
  extrainfo:
-   comment:#
+   comment:# foo;bar
 
     linenr:7
      addr1:
@@ -101,28 +133,300 @@
  addr2flag:
   lastaddr:
   modifier:
-        id:}
+        id:#
    content:
  delimiter:
    pattern:
    replace:
       flag:
  extrainfo:
-   comment:#loop end
+   comment:#;
+
+    linenr:8
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:p
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:#p1
 
     linenr:9
      addr1:
  addr1flag:
      addr2:
  addr2flag:
-  lastaddr:/bla/
+  lastaddr:
+  modifier:
+        id:p
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# p2
+
+    linenr:10
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:p
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:### p3
+
+    linenr:11
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:p
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# p4
+
+    linenr:11
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:p
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:
+
+    linenr:12
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:p
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# p5
+
+    linenr:13
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
   modifier:
         id:s
    content:
  delimiter:/
+   pattern:a
+   replace:b
+      flag:
+ extrainfo:
+   comment:#s1
+
+    linenr:14
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:s
+   content:
+ delimiter:/
+   pattern:a
+   replace:b
+      flag:
+ extrainfo:
+   comment:# s2
+
+    linenr:15
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:s
+   content:
+ delimiter:/
+   pattern:a
+   replace:b
+      flag:gp
+ extrainfo:
+   comment:#s3
+
+    linenr:16
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:s
+   content:
+ delimiter:/
+   pattern:a
+   replace:b
+      flag:gp
+ extrainfo:
+   comment:# s4
+
+    linenr:17
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id::
+   content:foo
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:#l1
+
+    linenr:18
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id::
+   content:foo
+ delimiter:
    pattern:
    replace:
       flag:
  extrainfo:
-   comment:# script end
+   comment:# l2
+
+    linenr:19
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:b
+   content:foo
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:#b1
+
+    linenr:20
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:b
+   content:foo
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# b2
+
+    linenr:21
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:b
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:#b3
+
+    linenr:22
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:b
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# b4
+
+    linenr:23
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:}
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# c2
+
+    linenr:24
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:#
 
diff --git a/test/token/comment.sed.txt b/test/token/comment.sed.txt
index b297b47..a4c6f67 100644
--- a/test/token/comment.sed.txt
+++ b/test/token/comment.sed.txt
@@ -1,5 +1,53 @@
     linenr:1
-     addr1:/bla/
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:### foo
+
+    linenr:2
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:#foo
+
+    linenr:3
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:#
+
+    linenr:4
+     addr1:/foo/
  addr1flag:
      addr2:
  addr2flag:
@@ -12,9 +60,9 @@
    replace:
       flag:
  extrainfo:
-   comment:# at this address
+   comment:# c1
 
-    linenr:1
+    linenr:4
      addr1:
  addr1flag:
      addr2:
@@ -28,16 +76,64 @@
    replace:
       flag:
  extrainfo:
-   comment:# at this address
+   comment:# c1
 
-    linenr:2
+    linenr:4
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:c
+   content:\@#linesep#@1 - allowed without 
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:
+
+    linenr:5
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# foo;bar
+
+    linenr:6
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:#;
+
+    linenr:7
      addr1:
  addr1flag:
      addr2:
  addr2flag:
   lastaddr:
   modifier:
-        id:h
+        id:p
    content:
  delimiter:
    pattern:
@@ -46,7 +142,7 @@
  extrainfo:
    comment:
 
-    linenr:2
+    linenr:7
      addr1:
  addr1flag:
      addr2:
@@ -60,16 +156,16 @@
    replace:
       flag:
  extrainfo:
-   comment:# do this
+   comment:#p1
 
-    linenr:3
+    linenr:8
      addr1:
  addr1flag:
      addr2:
  addr2flag:
   lastaddr:
   modifier:
-        id:g
+        id:p
    content:
  delimiter:
    pattern:
@@ -78,7 +174,7 @@
  extrainfo:
    comment:
 
-    linenr:3
+    linenr:8
      addr1:
  addr1flag:
      addr2:
@@ -92,9 +188,25 @@
    replace:
       flag:
  extrainfo:
-   comment:# than that
+   comment:# p2
 
-    linenr:4
+    linenr:9
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:p
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:
+
+    linenr:9
      addr1:
  addr1flag:
      addr2:
@@ -108,16 +220,16 @@
    replace:
       flag:
  extrainfo:
-   comment:#
+   comment:### p3
 
-    linenr:5
+    linenr:10
      addr1:
  addr1flag:
      addr2:
  addr2flag:
   lastaddr:
   modifier:
-        id:}
+        id:p
    content:
  delimiter:
    pattern:
@@ -126,7 +238,7 @@
  extrainfo:
    comment:
 
-    linenr:5
+    linenr:10
      addr1:
  addr1flag:
      addr2:
@@ -140,25 +252,265 @@
    replace:
       flag:
  extrainfo:
-   comment:#loop end
+   comment:# p4
 
-    linenr:7
+    linenr:10
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:p
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:
+
+    linenr:11
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:p
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:
+
+    linenr:11
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# p5
+
+    linenr:12
      addr1:
  addr1flag:
      addr2:
  addr2flag:
-  lastaddr:/bla/
+  lastaddr:
   modifier:
         id:s
    content:
  delimiter:/
+   pattern:a
+   replace:b
+      flag:
+ extrainfo:
+   comment:
+
+    linenr:12
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
    pattern:
    replace:
       flag:
+ extrainfo:
+   comment:#s1
+
+    linenr:13
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:s
+   content:
+ delimiter:/
+   pattern:a
+   replace:b
+      flag:
  extrainfo:
    comment:
 
-    linenr:7
+    linenr:13
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# s2
+
+    linenr:14
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:s
+   content:
+ delimiter:/
+   pattern:a
+   replace:b
+      flag:gp
+ extrainfo:
+   comment:
+
+    linenr:14
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:#s3
+
+    linenr:15
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:s
+   content:
+ delimiter:/
+   pattern:a
+   replace:b
+      flag:gp
+ extrainfo:
+   comment:
+
+    linenr:15
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# s4
+
+    linenr:16
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id::
+   content:foo
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:
+
+    linenr:16
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:#l1
+
+    linenr:17
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id::
+   content:foo
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:
+
+    linenr:17
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# l2
+
+    linenr:18
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:b
+   content:foo
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:
+
+    linenr:18
      addr1:
  addr1flag:
      addr2:
@@ -172,5 +524,149 @@
    replace:
       flag:
  extrainfo:
-   comment:# script end
+   comment:#b1
+
+    linenr:19
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:b
+   content:foo
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:
+
+    linenr:19
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# b2
+
+    linenr:20
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:b
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:
+
+    linenr:20
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:#b3
+
+    linenr:21
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:b
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:
+
+    linenr:21
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# b4
+
+    linenr:22
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:}
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:
+
+    linenr:22
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:# c2
+
+    linenr:23
+     addr1:
+ addr1flag:
+     addr2:
+ addr2flag:
+  lastaddr:
+  modifier:
+        id:#
+   content:
+ delimiter:
+   pattern:
+   replace:
+      flag:
+ extrainfo:
+   comment:#