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

Non-integer numeric parameters aren't supported #573

Closed
dontgitit opened this issue Feb 8, 2017 · 1 comment
Closed

Non-integer numeric parameters aren't supported #573

dontgitit opened this issue Feb 8, 2017 · 1 comment
Milestone

Comments

@dontgitit
Copy link
Contributor

dontgitit commented Feb 8, 2017

Handlebars added numeric support in v2.0: handlebars-lang/handlebars.js#472

HbsLexer.g4 still supports only integers: https://github.com/jknack/handlebars.java/blob/master/handlebars/src/main/antlr4/com/github/jknack/handlebars/internal/HbsLexer.g4#L283

It should probably be changed to match the pattern that handlebars uses: handlebars-lang/handlebars.js@d4cfe90#diff-a13581e6dfc1c61c90703da188230cbcR80

Any code that has a declared decimal parameter fails, i.e.
{{#if 1.5}}{{/if}}

fails with

com.github.jknack.handlebars.HandlebarsException: inline@20a72c8c:1:6: found: '1.5', expected: '}}'
{{#if 1.5}}{{/if}}
      ^
	at com.github.jknack.handlebars.internal.HbsErrorReporter.syntaxError(HbsErrorReporter.java:93) ~[handlebars-4.0.5.jar:na]
	at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:65) ~[antlr4-runtime-4.5.1-1.jar:4.5.1-1]
	at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:566) ~[antlr4-runtime-4.5.1-1.jar:4.5.1-1]
	at com.github.jknack.handlebars.internal.HbsErrorStrategy.reportInputMismatch(HbsErrorStrategy.java:186) ~[handlebars-4.0.5.jar:na]
	at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:148) ~[antlr4-runtime-4.5.1-1.jar:4.5.1-1]
@dontgitit
Copy link
Contributor Author

thanks, much appreciated!

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

No branches or pull requests

2 participants