24.08.2021 11:59, Hanna Reitz wrote:
On 24.08.21 10:53, Vladimir Sementsov-Ogievskiy wrote:
19.08.2021 19:37, Hanna Reitz wrote:
On 24.07.21 15:38, Vladimir Sementsov-Ogievskiy wrote:
[...]
+import itertools
+from lark import Lark
+
+grammar = """
+start: ( text | column_switch | row_switch )+
+
+column_switch: "{" text ["|" text]+ "}"
+row_switch: "[" text ["|" text]+ "]"
+text: /[^|{}\[\]]+/
So I have no idea how this really works, of course, but does this mean that the
`text` pattern cannot contain pipe symbols? I.e. that you cannot use pipes in
the test template?
Hmm. I didn't try. I hope lark is smart enough to keep pipes that are out of {}
[] as is.. But of course, you can't hope that pipe inside {} or [] will work as
bash-pipe.
Yep, sure. It’s just that the `text` nonterminal symbol doesn’t look like it
could match anything with a pipe in it.
Oops, right. To avoid it, we'll have to split text into "text_inside_brackets" and
"text_outside_of_brackets".. As well, let's postpone this complication until we really
need it.
Same thing with other special symbols ("{}" and "[]"). I don't want to care
about this too much now. This simple grammar works good for test template in patch 03. If we need
something more, we can add a kind of special symbols escaping later.
But yes, if someone trips over this (i.e. we ourselves), we can still fix it
then.
Hanna
--
Best regards,
Vladimir