Exemple #1
0
 public TableSyntax(KeySyntax name) : this()
 {
     Name           = name ?? throw new ArgumentNullException(nameof(name));
     OpenBracket    = SyntaxFactory.Token(TokenKind.OpenBracket);
     CloseBracket   = SyntaxFactory.Token(TokenKind.CloseBracket);
     EndOfLineToken = SyntaxFactory.NewLine();
 }
Exemple #2
0
        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);
        }
Exemple #3
0
 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);
 }
Exemple #4
0
 /// <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();
 }
Exemple #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();
 }
Exemple #6
0
 public virtual void Visit(KeySyntax key)
 {
     DefaultVisit(key);
 }