コード例 #1
0
 /// <inheritdoc />
 public void Visit(MorestachioExpressionString expression)
 {
     StringBuilder.Append(expression.Delimiter);
     foreach (var expressionStringConstPart in expression.StringParts)
     {
         var str = expressionStringConstPart.PartText.Replace(expression.Delimiter.ToString(), "\\" + expression.Delimiter);
         StringBuilder.Append(str);
     }
     StringBuilder.Append(expression.Delimiter);
 }
コード例 #2
0
 /// <inheritdoc />
 public void Visit(MorestachioExpressionString expression)
 {
     StringBuilder.Append("String(");
     StringBuilder.Append(expression.Delimiter.ToString());
     foreach (var expressionStringConstPart in expression.StringParts)
     {
         StringBuilder.Append("const(");
         StringBuilder.Append(expressionStringConstPart.PartText);
         StringBuilder.Append(")");
     }
     StringBuilder.Append(expression.Delimiter.ToString());
     StringBuilder.Append(")");
 }
コード例 #3
0
        internal static IMorestachioExpression ParseExpressionFromKind(this XmlReader reader)
        {
            IMorestachioExpression exp = null;

            switch (reader.Name)
            {
            case "Expression":
                exp = new MorestachioExpression();
                break;

            case "ExpressionMultiPart":
                exp = new MorestachioMultiPartExpressionList();
                break;

            case "ExpressionArgList":
                exp = new MorestachioArgumentExpressionList();
                break;

            case "ExpressionString":
                exp = new MorestachioExpressionString();
                break;

            case "ExpressionNumber":
                exp = new MorestachioExpressionNumber();
                break;

            case "ExpressionOperator":
                exp = new MorestachioOperatorExpression();
                break;

            case "ExpressionBracket":
                exp = new MorestachioBracketExpression();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(ExpressionKindNodeName));
            }
            exp.ReadXml(reader);
            return(exp);
        }
コード例 #4
0
 /// <inheritdoc />
 public void Visit(MorestachioExpressionString expression)
 {
     StringBuilder.Append(expression.Delimiter +
                          string.Join("", expression.StringParts.Select(f => f.PartText))
                          + expression.Delimiter);
 }