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

Feature request: A parser flag to expand variables inside marco options. #271

Open
Crest opened this issue Apr 6, 2023 · 1 comment
Open

Comments

@Crest
Copy link

Crest commented Apr 6, 2023

I would like to use something along this line in my configuration. While I could manually expand $base_dir and $local_dir having to expand $name would require using an external template engine.

.include(
    path: [
        "${base_dir}/hooks/"
        "${local_dir}/hooks/"
        "${base_dir}/${name}/hooks/"
        "${local_dir}/${name}/hooks/"
    ]) "*.conf"

The problem I encountered is that the UCL parser creates a new temporary parser to parse the macro options into a UCL object passed to the registered macro callback. The temporary parser created on behalf of the macro doesn't inherit anything registered with the outer parser (variables, macros, undefined variable handlers, etc.). My preferred solution to this would be a new parser option to have the outer parser register anything registered with it with the temporary parser before having it parse the macro options unless there is a better way I missed.

@michaeldexter
Copy link

Should the title be "macro variables"?

@Crest Crest changed the title Feature request: A parser option to expand variables inside marco variables. Feature request: A parser flag to expand variables inside marco options. Apr 13, 2023
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