Standalone interpolated strings fail at the parser stage instead of later in the pipeline like other standalone strings. This is because the interpolated string has two ESEPARATOR tokens at the end instead of the beginning like other interpolated strings. Changing the expression_interpolation rule fixes that (see below).
This is useful for "html in boo" style templates like how quixote does it in python: http://colorstudy.com/docs/shootout.html#quixote
Ayende's Brail template wouldn't require adding an "output " at the beginning of every line, for example.
protected
expression_interpolation returns [ExpressionInterpolationExpression e]
{
e = null;
Expression param = null;
LexicalInfo info = null;
}:
(firstseparator:ESEPARATOR)?
( options { greedy = true; } :
startsep:ESEPARATOR{ if (info == null)
{
info = ToLexicalInfo(startsep);
e = new ExpressionInterpolationExpression(info);
}
}
param=expression { if (null != param) { e.Expressions.Add(param); } }
endsep:ESEPARATOR
)+
(lastseparator:ESEPARATOR)?
;