kasemir / org.csstudio.display.builder

Update of org.csstudio.opibuilder.*
Eclipse Public License 1.0
2 stars 10 forks source link

The `$(MACRO=$(other_MACRO))` construct will result in an extra ) when MACRO is defined #505

Closed claudio-rosati closed 5 years ago

claudio-rosati commented 5 years ago

This is also true if ${MACRO=${other_MACRO}} is used (and and extra } will result.

CSSTUDIO-970.zip

kasemir commented 5 years ago

In the current implementation, the default value cannot itself be another macro. I'll have to update the macro handling to support that.

claudio-rosati commented 5 years ago

Personally I don't know if it's worth. I think that even if you implement it, someone else will soon or later come up with

${MACRO=${other_MACRO=${further_MACRO}}}

and so on. I leave to you the decision. If we'll go for constant value only, I'll tell our integrator that this is. Maybe we should update the HTML documentation in any case.

kasemir commented 5 years ago

Yes, never misunderestimate people's creativity.

I'll update it anyway because of this:

// XXX Replace pattern with code.
// This pattern is too complicated,
// and it doesn't allow braces inside the default value.
private static final Pattern spec = Pattern
 .compile("(?<!\\\\)\\$\\((" + Macros.MACRO_NAME_PATTERN + ")((\\s*=\\s*)[^)]*)?\\)" +
 "|" +
          "(?<!\\\\)\\$\\{(" + Macros.MACRO_NAME_PATTERN + ")((\\s*=\\s*)[^}]*)?\\}");

There's one \ too many in that for me to understand what's going on.

kasemir commented 5 years ago

$(MACRO=$(other_MACRO)) works now.

claudio-rosati commented 5 years ago

Thank you very much.