antlr / stringtemplate4

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

BIGSTRING testing the opposite? #180

Closed xied75 closed 7 years ago

xied75 commented 7 years ago

I might be very dumb here but according to the doc: https://github.com/antlr/stringtemplate4/blob/master/doc/groups.md

Large strings, such as those with newlines, can be specified with the usual large template delimiters from the group file format: <<...>>

And the STGLexer defined BIGSTRING as << .. >>, and the BIGSTRING_NO_NL as <% .. %>.

But the test here: https://github.com/antlr/stringtemplate4/blob/master/test/org/stringtemplate/v4/test/TestGroups.java#L715-L717

This is BIGSTRING apparently, why are we expecting "Foo bar" without any newline or indent? Shouldn't that be the behavior of BIGSTRING_NO_NL?

xied75 commented 7 years ago

@parrt Sorry to ping you, I guess no one really understands the design intention better than you. :)

parrt commented 7 years ago

Ah. the "NO_NL" part is I think other than the first and last newline. <<...>>ignores the first and last so we can write things like:

f() ::= <<
hi
mom
>>

There is exactly one \n, between the two words, in order to avoid having to write this:

f() ::= <<hi
mom>>