String Template

May 26, 2010 at 12:24 AM

Has anyone used the StringTemplate option in StringLiteral?  If so, how do I set ExpressionRoot?  I'm not sure what it's supposed to be set to.  I've extended StringLiteral and set the other properties for the StringTemplateSettings, but not sure what to do with ExpressionRoot.

public class MyStringLiteral : StringLiteral
        public MyStringLiteral(string name, string startEndSymbol)
            : base(name, startEndSymbol, StringOptions.IsTemplate)
            StringTemplateSettings settings = new StringTemplateSettings();
            settings.StartTag = "{";
            settings.EndTag = "}";

            this.AstNodeConfig = settings;

May 26, 2010 at 3:01 AM

Look at ExpressionEvaluatorGrammar, it uses this facility for Ruby-like string templates; also read about it in the latest entry in my blog, I discuss this facility briefly. Link to log is on home page


May 27, 2010 at 5:38 PM

Thanks.  I should have known as most of the answers can be found by referencing that example.  I've looked it a million times, but of course, never noticed that part of it.