Esempio n. 1
0
 public TableArraySyntax(KeySyntax name) : this()
 {
     Name           = name ?? throw new ArgumentNullException(nameof(name));
     OpenBracket    = SyntaxFactory.Token(TokenKind.OpenBracketDouble);
     CloseBracket   = SyntaxFactory.Token(TokenKind.CloseBracketDouble);
     EndOfLineToken = SyntaxFactory.NewLine();
 }
        private bool KeyNameToObjectPath(KeySyntax key, ObjectKind kind)
        {
            if (key.Key == null)
            {
                _diagnostics.Error(key.Span, $"The property KeySyntax.Key cannot be null");
            }

            var name = GetStringFromBasic(key.Key);

            if (string.IsNullOrWhiteSpace(name))
            {
                return(false);
            }

            _currentPath.Add(name);

            var items = key.DotKeys;

            for (int i = 0; i < items.ChildrenCount; i++)
            {
                AddObjectPath(key, kind, true);
                var dotItem = GetStringFromBasic(items.GetChildren(i).Key);
                if (string.IsNullOrWhiteSpace(dotItem))
                {
                    return(false);
                }
                _currentPath.Add(dotItem);
            }

            return(true);
        }
 public override void Visit(KeySyntax key)
 {
     if (key.Key == null)
     {
         _diagnostics.Error(key.Span, $"A KeySyntax must have a non null property Key");
     }
     base.Visit(key);
 }
 /// <summary>
 /// Creates an instance of <see cref="KeyValueSyntax"/>
 /// </summary>
 /// <param name="key">The key</param>
 /// <param name="value">The value</param>
 public KeyValueSyntax(KeySyntax key, ValueSyntax value) : this()
 {
     Key        = key ?? throw new ArgumentNullException(nameof(key));
     Value      = value ?? throw new ArgumentNullException(nameof(value));
     EqualToken = SyntaxFactory.Token(TokenKind.Equal);
     EqualToken.AddLeadingWhitespace();
     EqualToken.AddTrailingWhitespace();
     EndOfLineToken = SyntaxFactory.NewLine();
 }
Esempio n. 5
0
 public TableSyntax(string name) : this()
 {
     if (name == null)
     {
         throw new ArgumentNullException(nameof(name));
     }
     OpenBracket    = SyntaxFactory.Token(TokenKind.OpenBracket);
     Name           = new KeySyntax(name);
     CloseBracket   = SyntaxFactory.Token(TokenKind.CloseBracket);
     EndOfLineToken = SyntaxFactory.NewLine();
 }
Esempio n. 6
0
 public virtual void Visit(KeySyntax key)
 {
     DefaultVisit(key);
 }