Hi!
I’m struggling a bit with the usage of ForEach blocks. I’ve written a few rules
for structure looking like this:
Document{-> RETAINTYPE(BREAK)};
DECLARE BR;
"\\r?\\n" -> BR;
DECLARE Line;
"[^\\r\\n]+" -> Line;
Line{->SHIFT(Line,1,2)} BR;
DECLARE Empty_Line;
"\\r?\\n[ ]*(\\r?\\n)" -> 1=Empty_Line;
DECLARE After_Empty,Before_Empty;
Line{->Before_Empty} Empty_Line;
Empty_Line Line{->After_Empty};
DECLARE Paragraph;
Line+{-PARTOF(Paragraph)->Paragraph};
Seems to do exactly what I want, but it seems that for some reason,
ForEach-Blocks „skip“ some of the Lines. For instance, when a line starts with
a leading SPACE, it is being skipped.
For instance, given this script:
DECLARE Test;
BLOCK(ForEach) Line{}{
W+{->Test};
}
And this input:
This will match
This won’t
But this will
This too
Any hints why the ForEach block might be skipping the second line?
Cheers,
Michael