|
From: | Hanna Reitz |
Subject: | Re: [PATCH 1/3] simplebench: add img_bench_templater.py |
Date: | Tue, 24 Aug 2021 10:59:18 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
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.
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
[Prev in Thread] | Current Thread | [Next in Thread] |