using System; using System.Collections.Generic; namespace Confuser.Core.Project.Patterns { /// /// A pattern function. /// public abstract class PatternFunction : PatternExpression { /// /// Gets the name of function. /// /// The name. public abstract string Name { get; } /// /// Gets the number of arguments of the function. /// /// The number of arguments. public abstract int ArgumentCount { get; } /// /// Gets or sets the arguments of function. /// /// The arguments. public IList Arguments { get; set; } /// public override void Serialize(IList tokens) { tokens.Add(new PatternToken(TokenType.Identifier, Name)); tokens.Add(new PatternToken(TokenType.LParens)); for (int i = 0; i < Arguments.Count; i++) { if (i != 0) tokens.Add(new PatternToken(TokenType.Comma)); Arguments[i].Serialize(tokens); } tokens.Add(new PatternToken(TokenType.RParens)); } } }