-
Notifications
You must be signed in to change notification settings - Fork 52
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
Avoid processing parameters and directives in multi-line strings #287
Comments
I do not think we should revert the behavior. There must be a better way. Maybe we can add some kind of "and now the script parameters are done" symbol like: #@ ScriptService scripts
#@---- |
@imagejan What do you think? Do you like the idea of a terminating directive? |
Yes, I'll open a PR including the proposed directive in the Should this also be introduced to |
Yeah, we'll have to think carefully about the most extension-friendly way of doing this. It might be nice if |
Currently it's not possible to use script parameters inside scripts that are defined as multi-line strings inside other scripts. The following Groovy script illustrates this:
You might expect the return value of the inner script being a
HashMap
containingconstant
andsum
, and the return value of the outer script being the implicitresult
with a value of 42.However, the actual return values are
result: foobar
from the inner script, and{sum: barfoo; constant: 42}
from the outer script.If you replace the line breaks in the multi-line string by
\n
, you'll get the expected behavior:This behavior is the result of the simple line-by-line parsing of the
ScriptProcessor
, but it isn't intuitive from the user perspective. I suggest to implement some (language-agnostic) parsing that respects and ignores multi-line strings.@ctrueden Or should we revert to only allowing parameters at the start of scripts altogether? (While keeping the new language-agnostic
#@
syntax, of course...)The text was updated successfully, but these errors were encountered: