/// <summary>
        /// Format a <see cref="PragmaWarningAction"/> as a string.
        /// </summary>
        public static string PragmaWarningActionToString(PragmaWarningAction pragmaWarningAction)
        {
            switch (pragmaWarningAction)
            {
            case PragmaWarningAction.Disable: return(ParseTokenDisable);

            case PragmaWarningAction.Restore: return(ParseTokenRestore);
            }
            return("");
        }
        /// <summary>
        /// Parse a <see cref="PragmaWarningDirective"/>.
        /// </summary>
        public PragmaWarningDirective(Parser parser, CodeObject parent)
            : base(parser, parent)
        {
            parser.NextToken();                            // Move past 'pragma'
            Token token = parser.NextTokenSameLine(false); // Move past 'warning'

            if (token != null)
            {
                // Parse the warning action
                _pragmaWarningAction = ParseAction(parser.TokenText);
                if (_pragmaWarningAction != PragmaWarningAction.Invalid)
                {
                    token = parser.NextTokenSameLine(false);  // Move past the action

                    // Parse the list of warning numbers
                    while (token != null && token.IsNumeric)
                    {
                        int number;
                        if (!int.TryParse(token.Text, out number))
                        {
                            number = int.MaxValue;
                            parser.AttachMessage(this, "Integer value expected", token);
                        }
                        CreateNumbers().Add(number);
                        token = parser.NextTokenSameLine(false);  // Move past the number
                        if (token != null && token.Text == ParseTokenSeparator)
                        {
                            token = parser.NextTokenSameLine(false);  // Move past ','
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            MoveEOLComment(parser.LastToken);
        }
 /// <summary>
 /// Create a <see cref="PragmaWarningDirective"/> with the specified action and warning numbers.
 /// </summary>
 public PragmaWarningDirective(PragmaWarningAction pragmaWarningAction, params int[] warningNumbers)
     : this(pragmaWarningAction)
 {
     CreateNumbers().AddRange(warningNumbers);
 }
 /// <summary>
 /// Create a <see cref="PragmaWarningDirective"/> with the specified action.
 /// </summary>
 public PragmaWarningDirective(PragmaWarningAction pragmaWarningAction)
 {
     _pragmaWarningAction = pragmaWarningAction;
 }