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

Use '&' as a DelimiterChar ? #172

Closed
ncharles opened this issue Jan 24, 2017 · 6 comments
Closed

Use '&' as a DelimiterChar ? #172

ncharles opened this issue Jan 24, 2017 · 6 comments
Labels

Comments

@ncharles
Copy link

Hello,

First, I'd like to thank you for StringTemplate, this is a very useful libraries for us.
We've been using StringTemplate 3 since 2009, and now we'd like to upgrade to 4.0.8, as it promises major improvement.

In our templates, we use & as a delimiter character; we created specific Lexer and Parser for version 3, and it seems in 4.0 the recommended approach is to use new ST(mycontent, '&', '&')

However, I never managed to make this work, as it fails with following error message:

1:20: expecting '&', found ''
1:20: expecting '&', found ''
1:19: '&' came as a complete surprise to me
1:20: expecting '&', found ''
1:20: expecting '&', found ''

when content is &AGENT_RUN_INTERVAL&

I tried with '!', which fails in the same way, but using 'ç' succeed.
My guess is that & and ! are reserved for AND and NOT respectively, but this is not documented (and it is not in #149 either)

Is there a way to use & as a separator in 4.0 ? If so, what is the prefered way to make it work ?

Kind regards,
Nicolas

@sharwell
Copy link
Member

sharwell commented Jan 24, 2017

💭 Totally just guessing right now, but I wonder if it's messing up because of the && operator. For example, using the default delimiters an expression might be:

<if(A&&B)><endif>

📝 I used an if operator here, but that wouldn't affect the lexer attempting to treat & as a partial && token.

@ncharles
Copy link
Author

Thank you @sharwell - is there a way I can help you to fix it? My knowledge in parsing and lexing is not very good though, but I can at least test proposed solution,

@ncharles
Copy link
Author

Hi,
Is there any way I can help in the resolution of this issue ?

@parrt
Copy link
Member

parrt commented Nov 8, 2018

I believe that we have added a warning so that it doesn't just mysteriously not work. #149

@parrt parrt closed this as completed Nov 8, 2018
@ncharles
Copy link
Author

ncharles commented Nov 9, 2018

Unfortunately, this ends all hopes to upgrade from ST3 to ST4 as all of our template are using &, and our user-defined template also use & as separator. There is no upgrade path possible without support for this value (automatic rewrite of template is most likely to fail because we use it to generate plenty of scripts)

Anyway, thank you for fixing the warning, and thank you for developping StringTemplate, which is super useful

@parrt
Copy link
Member

parrt commented Nov 9, 2018

Sorry I can't help further, @ncharles. Glad to be of service.

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

3 participants