Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing @do arguments is broken #97

Open
rburny opened this issue Sep 22, 2015 · 1 comment
Open

Parsing @do arguments is broken #97

rburny opened this issue Sep 22, 2015 · 1 comment

Comments

@rburny
Copy link

rburny commented Sep 22, 2015

I have found a situation where I cannot pass data to a previously defined macro. Here is an example snippet:

  @macro (test)
  :echomsg "[]"
  ~ {res}
  @endmacro
  @do (test, res="[]")

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
@groschovskiy
Copy link
Contributor

I will try to examine the problem and to solve it in the near future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants