JuPfu / sparkle-g

Automatically exported from code.google.com/p/sparkle-g
Apache License 2.0
0 stars 0 forks source link

Auto indentation via StringTemplate does not work correctly with strings containing embedded newlines #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Queries containing strings with embedded newlines are correctly passed through 
the transformation pipeline. The last step, formatting the query with a 
StringTemplate template in connection with auto indentation adds additional 
blanks after the newline character.

Examples Query with line break after sequence '''x:

PREFIX : <http://example.org/ns#>
SELECT ?x
{ ?x ?p '''x
y'''
}

Expected output should be:

PREFIX : <http://example.org/ns#>

SELECT ?x
WHERE {
   ?x ?p '''x
y'''
}

Instead additional blanks are inserted after the line break:

PREFIX : <http://example.org/ns#>

SELECT ?x
WHERE {
   ?x ?p '''x
   y'''
}

ANTLR 3.4 uses ST V3 for output=template.
The <% is introduced in ST V4:

templateName(arg1, arg2, ..., argN) ::= <%
multi-line template that ignores indentation and newlines
%>

How to suppress auto indentation for strings containing line breaks ?

Original issue reported on code.google.com by Juergen....@gmail.com on 7 Jan 2012 at 5:33