antlr / stringtemplate4

StringTemplate 4
http://www.stringtemplate.org
Other
956 stars 231 forks source link

Using an attribute with a hypen, followed by a alphanum character throws Antlr4.StringTemplate.Compiler.TemplateException #94

Closed frederik256 closed 6 years ago

frederik256 commented 9 years ago

The following throws Antlr4.StringTemplate.Compiler.TemplateException

new Template("{A-1}.Something", '{', '}');

The following does not:

new Template("{A-}.Something", '{', '}');

Ideally I'd like to use GUIDs, including those starting with numbers as an attribute but that may need a language spec change.

This is using "Antlr4.StringTemplate" C# package from nuget, version=4.0.6.9004 (running on Windows)

parrt commented 9 years ago

Hi. {A-1} isn't a valid template expression is it? If you just want text then just use the string "A-1".

sharwell commented 9 years ago

@parrt The ID rule in Group.g supports hyphens, but the mID() method in STLexer.java does not match the same syntax. This means it is possible to declare a template parameter which cannot be referenced by name within an expression.

parrt commented 9 years ago

ah! right. sounds familiar. thanks, Sam.