private static TeDictionary TranslateDictionary(ParseTreeNode exprNode) { exprNode.Assert(TextExpressionDslParseNodeNames.Dictionary); var name = TranslateExpressionName(exprNode.ChildNodes[0]); var dictArgsNode = exprNode.ChildNodes[1]; var expr = new TeDictionary() { Name = name }; foreach (var dictArgNode in dictArgsNode.ChildNodes) { var dictArgName = TranslateQualifiedIdentifier(dictArgNode.ChildNodes[0]); var dictArgExpr = TranslateExpression(dictArgNode.ChildNodes[1]); expr.Add(dictArgName.Text, dictArgExpr); } return(expr); }
public override void Visit(TeDictionary textExpr) { if (ReferenceEquals(textExpr, null)) { return; } if (textExpr.IsNamed) { TextComposer.Append(textExpr.Name.ToString()).AppendLine(" {").IncreaseIndentation(); } else { TextComposer.AppendLine("{").IncreaseIndentation(); } var flag = false; foreach (var pair in textExpr) { if (flag) { TextComposer.AppendLine(", "); } else { flag = true; } TextComposer.Append(pair.Key).Append(" : "); Visit(pair.Value); } TextComposer.DecreaseIndentation().AppendAtNewLine("}"); }
public abstract void Visit(TeDictionary textExpr);