using System; using System.Collections.Generic; namespace Confuser.Core.Project.Patterns { /// /// A pattern operator. /// public abstract class PatternOperator : PatternExpression { /// /// Gets the name of operator. /// /// The name. public abstract string Name { get; } /// /// Gets a value indicating whether this is an unary operator. /// /// true if this is an unary operator; otherwise, false. public abstract bool IsUnary { get; } /// /// Gets or sets the first operand. /// /// The first operand. public PatternExpression OperandA { get; set; } /// /// Gets or sets the second operand. /// /// The second operand. public PatternExpression OperandB { get; set; } /// public override void Serialize(IList tokens) { if (IsUnary) { tokens.Add(new PatternToken(TokenType.Identifier, Name)); OperandA.Serialize(tokens); } else { OperandA.Serialize(tokens); tokens.Add(new PatternToken(TokenType.Identifier, Name)); OperandB.Serialize(tokens); } } } }