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

Unclear how to use gpp with different user-macro syntax but same meta-macro syntax #23

Open
jkm opened this issue Nov 7, 2017 · 1 comment
Labels

Comments

@jkm
Copy link

jkm commented Nov 7, 2017

I'd like to use gpp for preprocessing text files. There are different formats of these files and I want to support each different format by expressing the macro call as a comment. This way the macro is ignored when not preprocessed. For example consider I have a format where {::something/} is ignored. I call using -U "{::" "/}" "\B" " " "}" "{" "}" "#" "\\". Then there are other files with a different format, say %something. Again I can define appropriate strings using -U. Being able to define the call syntax is probably the most interesting feature to me. Note I only want to change the call syntax. The definition of the macros should use some fixed (probably the default) syntax.
But I cannot make it work:

$ echo "{::macroname/}" | gpp --include macros.gpp -U "{::" "/}" "\B" " " "}" "{" "}" "#" "\\"

where macros.gpp is

#define macroname bar

The output is

#define macroname bar
{::macroname/}

(seems like no macro was applied) when I expected

bar

When I change macros.gpp to {::define macroname bar} I'll get almost (note the additional new line) what I want


bar

But I don't want to provide the macros in each call syntax.
Apparently I am doing it wrong or it cannot be done using gpp. Any suggestions?
This is GPP 2.25 on Linux.

@jkm jkm changed the title Unclear how to use gpp with different user-macro syntax but same meta-macro syntax Unclear how to use gpp with different user-macro syntax but same meta-macro syntax Nov 7, 2017
@logological
Copy link
Owner

After some preliminary investigation, I suspect this is a bug—for some reason the user-defined mode is not being applied to the argument of --include. I will look into this when I have time.

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

No branches or pull requests

2 participants