Example #1
0
        public override ElementSyntaxBase With(
            NameToken name = null,
            IImmutableList <AttributeSyntaxBase> attributes = null,
            IImmutableList <NodeSyntax> nodes = null,
            bool?isEmpty = null)
        {
            name       = name ?? Name;
            nodes      = nodes ?? Nodes;
            attributes = attributes ?? Attributes;

            if ((isEmpty ?? false) && nodes.Count == 0)
            {
                return(EmptyElementSyntax.Create(
                           StartTag.LessThan,
                           Name,
                           attributes,
                           SlashToken.Default,
                           EndTag.GreaterThan));
            }

            if (name.Equals(Name) &&
                (attributes.Equals(Attributes) || attributes.SequenceEqual(Attributes)) &&
                (nodes.Equals(Nodes) || nodes.SequenceEqual(Nodes)))
            {
                return(this);
            }

            return(Create(
                       StartTag.With(name, attributes),
                       nodes,
                       EndTag.With(EndTag.Name.With(name.Text))));
        }
Example #2
0
 public static ElementStartTagSyntax Create(
     LessThanToken lessThan,
     NameToken name,
     IImmutableList <AttributeSyntaxBase> attributes,
     GreaterThanToken greaterThan)
 {
     return(new ElementStartTagSyntax(lessThan, name, attributes, greaterThan));
 }
 public override ElementSyntaxBase With(
     NameToken name = null,
     IImmutableList <AttributeSyntaxBase> attributes = null,
     IImmutableList <NodeSyntax> nodes = null,
     bool?isEmpty = null)
 {
     throw new NotImplementedException("Can't turn JavaScript tag into anything else");
 }
Example #4
0
 public static ElementEndTagSyntax Create(
     LessThanToken lessThan,
     SlashToken slash,
     NameToken name,
     GreaterThanToken greaterThan)
 {
     return(new ElementEndTagSyntax(lessThan, slash, name, greaterThan));
 }
Example #5
0
 public static AttributeSyntax Create(NameToken name, EqualsToken eq, AttributeLiteralToken literal)
 {
     if (eq.Equals(EqualsToken.Default))
     {
         return(new AttributeSyntaxWithDefaultEqToken(name, literal));
     }
     return(new AttributeSyntaxWithCustomEqToken(name, eq, literal));
 }
Example #6
0
        public ElementEndTagSyntax With(NameToken name)
        {
            if (name == null || name.Equals(Name))
            {
                return(this);
            }

            return(new ElementEndTagSyntax(LessThan, Slash, name, GreaterThan));
        }
Example #7
0
 public static EmptyElementSyntax Create(
     LessThanToken lessThan,
     NameToken name,
     IImmutableList <AttributeSyntaxBase> attributes,
     SlashToken slash,
     GreaterThanToken greaterThan)
 {
     return(new EmptyElementSyntax(lessThan, name, attributes, slash, greaterThan));
 }
Example #8
0
 public ElementStartTagSyntax With(NameToken name = null, IImmutableList <AttributeSyntaxBase> attributes = null)
 {
     name       = name ?? Name;
     attributes = attributes ?? Attributes;
     if (attributes.Equals(Attributes) && name.Equals(Name))
     {
         return(this);
     }
     return(Create(LessThan, name, attributes, GreaterThan));
 }
Example #9
0
 ElementStartTagSyntax(
     LessThanToken lessThan,
     NameToken name,
     IImmutableList <AttributeSyntaxBase> attributes,
     GreaterThanToken greaterThan)
 {
     LessThan    = lessThan;
     Name        = name;
     Attributes  = attributes;
     GreaterThan = greaterThan;
 }
Example #10
0
 EmptyElementSyntax(
     LessThanToken lessThan,
     NameToken name,
     IImmutableList <AttributeSyntaxBase> attributes,
     SlashToken slash,
     GreaterThanToken greaterThan)
 {
     LessThan    = lessThan ?? throw new ArgumentNullException(nameof(lessThan));
     Name        = name ?? throw new ArgumentNullException(nameof(name));
     Attributes  = attributes ?? throw new ArgumentNullException(nameof(attributes));
     Slash       = slash ?? throw new ArgumentNullException(nameof(slash));
     GreaterThan = greaterThan ?? throw new ArgumentNullException(nameof(greaterThan));
 }
Example #11
0
 ImplicitAttributeSyntax(NameToken name) : base(name)
 {
 }
Example #12
0
 public static ImplicitAttributeSyntax Create(NameToken name)
 {
     return(new ImplicitAttributeSyntax(name));
 }
Example #13
0
 protected AttributeSyntaxBase(NameToken name)
 {
     Name = name ?? throw new ArgumentNullException(nameof(name));
 }
Example #14
0
 AttributeSyntax(NameToken name, AttributeLiteralToken literal) : base(name)
 {
     Literal = literal;
 }
Example #15
0
 public AttributeSyntaxWithCustomEqToken(NameToken name, EqualsToken eq, AttributeLiteralToken literal) : base(
         name,
         literal)
 {
     Eq = eq;
 }
Example #16
0
 public AttributeSyntaxWithDefaultEqToken(NameToken name, AttributeLiteralToken literal) : base(name, literal)
 {
 }
Example #17
0
 protected virtual SyntaxToken VisitName(NameToken token)
 {
     return(token);
 }
Example #18
0
 public abstract ElementSyntaxBase With(
     NameToken name = null,
     IImmutableList <AttributeSyntaxBase> attributes = null,
     IImmutableList <NodeSyntax> nodes = null,
     bool?isEmpty = null);