Пример #1
0
 protected virtual Object[] AnalyseTableKeyValue(TableKeyValue node, params Object[] args)
 {
     if (!node.IsSequential)
     {
         this.Analyse(node.Key);
     }
     this.Analyse(node.Value);
     return(null);
 }
Пример #2
0
 protected virtual ASTNode FoldTableKeyValue(TableKeyValue node, params Object[] args)
 {
     if (!node.IsSequential)
     {
         node.Key = this.Fold(node.Key);
     }
     node.Value = this.Fold(node.Value);
     return(node);
 }
Пример #3
0
        public override void ConstructTableConstructorExpression(TableConstructorExpression node)
        {
            // First token is always {
            this.Write('{');

            if (node.Fields.Count > 1)
            {
                this.WriteLine( );
            }
            else if (node.Fields.Count == 1 && !node.Fields[0].IsSequential)
            {
                this.Write(' ');
            }

            this.Indent( );
            for (var i = 0; i < node.Fields.Count; i++)
            {
                TableKeyValue field = node.Fields[i];

                if (field.IsSequential)
                {// No key to write
                }
                else if (field.Key.Tokens[0].ID == "ident")
                {
                    this.WriteIndented((( StringExpression )field.Key).Value);
                    this.Write(" = ");
                }
                else
                {
                    this.WriteIndented('[');
                    this.ConstructInternal(field.Key);
                    this.Write("] = ");
                }

                this.ConstructInternal(field.Value);
                this.WriteLine(field.Separator);
            }
            this.Outdent( );

            this.WriteIndented('}');
        }