which fails with ERROR on line 26: Unrecognized directive "do (test, res='[]')"
The underlying issue is that each directive must much the following regexp:
r'( .*) \(\s*([%><=\'"\w\d.+,$ ]*)\s*\)$'
which doesn't allow square brackets.
Naive solution would be to simply extend this regexp to allow more characters. However, I suggest reimplementing @do completely. There are two reasons for that:
other control blocks have much more restricted argument format, and should be left with stricter validation
naive control block parsing (which splits it on comma) does not work for @do anyway. For example, @do (test, res="1,2") fails due to erroenously splitting string argument in half:
File "/usr/local/google/home/rburny/vroom/vroom/actions.py", line 346, in ParseCall
kwargs[k.strip()] = eval(v)
File "<string>", line 1
"1
^
SyntaxError: EOL while scanning string literal
I have found a situation where I cannot pass data to a previously defined macro. Here is an example snippet:
which fails with
ERROR on line 26: Unrecognized directive "do (test, res='[]')"
The underlying issue is that each directive must much the following regexp:r'( .*) \(\s*([%><=\'"\w\d.+,$ ]*)\s*\)$'
which doesn't allow square brackets.Naive solution would be to simply extend this regexp to allow more characters. However, I suggest reimplementing
@do
completely. There are two reasons for that:@do
anyway. For example,@do (test, res="1,2")
fails due to erroenously splitting string argument in half: