[stringtemplate-interest] [ST4 Beta-2] No whitespace allowed before <@end> when at new line
Terence Parr
parrt at cs.usfca.edu
Wed Jan 26 17:32:09 PST 2011
made sure it accepts and also ignores indent in front of <@r> etc...
Ter
@Test public void testIndentBeforeRegionIsIgnored() throws Exception {
String dir = getRandomDir();
String g = "a() ::= <<[\n" +
" <@r>\n" +
" foo\n" +
" <@end>\n" +
"]>>\n";
writeFile(dir, "g.stg", g);
STGroupFile group = new STGroupFile(dir+"/g.stg");
ST st = group.getInstanceOf("a");
String expected = "[\n" +
" foo\n" +
"]";
String result = st.render();
assertEquals(expected, result);
}
On Jan 26, 2011, at 3:52 AM, Udo Borkowski wrote:
> I assume this is a bug:
>
> One cannot create a region like this:
>
> -------------
> method(name,code) ::= <<
> public void <name>() {
> <@block>
> <code>
> <@end>
> }
> >>
> -------------
>
> This produces the error:
>
> mismatched input ' ' expecting LDELIM
>
> When the whitespace before the <@end> is removed the error is gone.
>
> -------------
> method(name,code) ::= <<
> public void <name>() {
> <@block>
> <code>
> <@end>
> }
> >>
> -------------
>
> This only happens when the whitespaces are at the front of the line, immediately before the <@end>. The following example is OK, too:
>
> -------------
> method(name,code) ::= <<
> public void <name>() {
> <@block>
> <code> <@end>
> }
> >>
> -------------
>
> Udo
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
More information about the stringtemplate-interest
mailing list