// <auto-generated />
/*
 * Asn1Tokenizer.cs
 *
 * THIS FILE HAS BEEN GENERATED AUTOMATICALLY. DO NOT EDIT!
 *
 * This work is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 2 of the License,
 * or (at your option) any later version.
 *
 * This work is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 *
 * Copyright (c) 2004-2009 Per Cederberg. All rights reserved.
 */

using System.IO;

using PerCederberg.Grammatica.Runtime;

namespace MibbleSharp.Asn1
{

    /**
     * <remarks>A character stream tokenizer.</remarks>
     */
    internal class Asn1Tokenizer : Tokenizer
    {

        /**
         * <summary>Creates a new tokenizer for the specified input
         * stream.</summary>
         *
         * <param name='input'>the input stream to read</param>
         *
         * <exception cref='ParserCreationException'>if the tokenizer
         * couldn't be initialized correctly</exception>
         */
        public Asn1Tokenizer(TextReader input)
            : base(input, false)
        {

            CreatePatterns();
        }

        /**
         * <summary>Initializes the tokenizer by creating all the token
         * patterns.</summary>
         *
         * <exception cref='ParserCreationException'>if the tokenizer
         * couldn't be initialized correctly</exception>
         */
        private void CreatePatterns()
        {
            TokenPattern pattern;

            pattern = new TokenPattern((int)Asn1Constants.DOT,
                                       "DOT",
                                       TokenPattern.PatternType.String,
                                       ".");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.DOUBLE_DOT,
                                       "DOUBLE_DOT",
                                       TokenPattern.PatternType.String,
                                       "..");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.TRIPLE_DOT,
                                       "TRIPLE_DOT",
                                       TokenPattern.PatternType.String,
                                       "...");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.COMMA,
                                       "COMMA",
                                       TokenPattern.PatternType.String,
                                       ",");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.SEMI_COLON,
                                       "SEMI_COLON",
                                       TokenPattern.PatternType.String,
                                       ";");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.LEFT_PAREN,
                                       "LEFT_PAREN",
                                       TokenPattern.PatternType.String,
                                       "(");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.RIGHT_PAREN,
                                       "RIGHT_PAREN",
                                       TokenPattern.PatternType.String,
                                       ")");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.LEFT_BRACE,
                                       "LEFT_BRACE",
                                       TokenPattern.PatternType.String,
                                       "{");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.RIGHT_BRACE,
                                       "RIGHT_BRACE",
                                       TokenPattern.PatternType.String,
                                       "}");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.LEFT_BRACKET,
                                       "LEFT_BRACKET",
                                       TokenPattern.PatternType.String,
                                       "[");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.RIGHT_BRACKET,
                                       "RIGHT_BRACKET",
                                       TokenPattern.PatternType.String,
                                       "]");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.MINUS,
                                       "MINUS",
                                       TokenPattern.PatternType.String,
                                       "-");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.LESS_THAN,
                                       "LESS_THAN",
                                       TokenPattern.PatternType.String,
                                       "<");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.VERTICAL_BAR,
                                       "VERTICAL_BAR",
                                       TokenPattern.PatternType.String,
                                       "|");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.DEFINITION,
                                       "DEFINITION",
                                       TokenPattern.PatternType.String,
                                       "::=");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.DEFINITIONS,
                                       "DEFINITIONS",
                                       TokenPattern.PatternType.String,
                                       "DEFINITIONS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.EXPLICIT,
                                       "EXPLICIT",
                                       TokenPattern.PatternType.String,
                                       "EXPLICIT");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.IMPLICIT,
                                       "IMPLICIT",
                                       TokenPattern.PatternType.String,
                                       "IMPLICIT");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.TAGS,
                                       "TAGS",
                                       TokenPattern.PatternType.String,
                                       "TAGS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.BEGIN,
                                       "BEGIN",
                                       TokenPattern.PatternType.String,
                                       "BEGIN");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.END,
                                       "END",
                                       TokenPattern.PatternType.String,
                                       "END");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.EXPORTS,
                                       "EXPORTS",
                                       TokenPattern.PatternType.String,
                                       "EXPORTS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.IMPORTS,
                                       "IMPORTS",
                                       TokenPattern.PatternType.String,
                                       "IMPORTS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.FROM,
                                       "FROM",
                                       TokenPattern.PatternType.String,
                                       "FROM");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.MACRO,
                                       "MACRO",
                                       TokenPattern.PatternType.String,
                                       "MACRO");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.INTEGER,
                                       "INTEGER",
                                       TokenPattern.PatternType.String,
                                       "INTEGER");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.REAL,
                                       "REAL",
                                       TokenPattern.PatternType.String,
                                       "REAL");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.BOOLEAN,
                                       "BOOLEAN",
                                       TokenPattern.PatternType.String,
                                       "BOOLEAN");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.NULL,
                                       "NULL",
                                       TokenPattern.PatternType.String,
                                       "NULL");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.BIT,
                                       "BIT",
                                       TokenPattern.PatternType.String,
                                       "BIT");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.OCTET,
                                       "OCTET",
                                       TokenPattern.PatternType.String,
                                       "OCTET");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.STRING,
                                       "STRING",
                                       TokenPattern.PatternType.String,
                                       "STRING");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.ENUMERATED,
                                       "ENUMERATED",
                                       TokenPattern.PatternType.String,
                                       "ENUMERATED");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.SEQUENCE,
                                       "SEQUENCE",
                                       TokenPattern.PatternType.String,
                                       "SEQUENCE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.SET,
                                       "SET",
                                       TokenPattern.PatternType.String,
                                       "SET");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.OF,
                                       "OF",
                                       TokenPattern.PatternType.String,
                                       "OF");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.CHOICE,
                                       "CHOICE",
                                       TokenPattern.PatternType.String,
                                       "CHOICE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.UNIVERSAL,
                                       "UNIVERSAL",
                                       TokenPattern.PatternType.String,
                                       "UNIVERSAL");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.APPLICATION,
                                       "APPLICATION",
                                       TokenPattern.PatternType.String,
                                       "APPLICATION");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.PRIVATE,
                                       "PRIVATE",
                                       TokenPattern.PatternType.String,
                                       "PRIVATE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.ANY,
                                       "ANY",
                                       TokenPattern.PatternType.String,
                                       "ANY");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.DEFINED,
                                       "DEFINED",
                                       TokenPattern.PatternType.String,
                                       "DEFINED");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.BY,
                                       "BY",
                                       TokenPattern.PatternType.String,
                                       "BY");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.OBJECT,
                                       "OBJECT",
                                       TokenPattern.PatternType.String,
                                       "OBJECT");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.IDENTIFIER,
                                       "IDENTIFIER",
                                       TokenPattern.PatternType.String,
                                       "IDENTIFIER");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.INCLUDES,
                                       "INCLUDES",
                                       TokenPattern.PatternType.String,
                                       "INCLUDES");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.MIN,
                                       "MIN",
                                       TokenPattern.PatternType.String,
                                       "MIN");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.MAX,
                                       "MAX",
                                       TokenPattern.PatternType.String,
                                       "MAX");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.SIZE,
                                       "SIZE",
                                       TokenPattern.PatternType.String,
                                       "SIZE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.WITH,
                                       "WITH",
                                       TokenPattern.PatternType.String,
                                       "WITH");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.COMPONENT,
                                       "COMPONENT",
                                       TokenPattern.PatternType.String,
                                       "COMPONENT");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.COMPONENTS,
                                       "COMPONENTS",
                                       TokenPattern.PatternType.String,
                                       "COMPONENTS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.PRESENT,
                                       "PRESENT",
                                       TokenPattern.PatternType.String,
                                       "PRESENT");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.ABSENT,
                                       "ABSENT",
                                       TokenPattern.PatternType.String,
                                       "ABSENT");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.OPTIONAL,
                                       "OPTIONAL",
                                       TokenPattern.PatternType.String,
                                       "OPTIONAL");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.DEFAULT,
                                       "DEFAULT",
                                       TokenPattern.PatternType.String,
                                       "DEFAULT");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.TRUE,
                                       "TRUE",
                                       TokenPattern.PatternType.String,
                                       "TRUE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.FALSE,
                                       "FALSE",
                                       TokenPattern.PatternType.String,
                                       "FALSE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.PLUS_INFINITY,
                                       "PLUS_INFINITY",
                                       TokenPattern.PatternType.String,
                                       "PLUS-INFINITY");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.MINUS_INFINITY,
                                       "MINUS_INFINITY",
                                       TokenPattern.PatternType.String,
                                       "MINUS-INFINITY");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.MODULE_IDENTITY,
                                       "MODULE_IDENTITY",
                                       TokenPattern.PatternType.String,
                                       "MODULE-IDENTITY");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.OBJECT_IDENTITY,
                                       "OBJECT_IDENTITY",
                                       TokenPattern.PatternType.String,
                                       "OBJECT-IDENTITY");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.OBJECT_TYPE,
                                       "OBJECT_TYPE",
                                       TokenPattern.PatternType.String,
                                       "OBJECT-TYPE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.NOTIFICATION_TYPE,
                                       "NOTIFICATION_TYPE",
                                       TokenPattern.PatternType.String,
                                       "NOTIFICATION-TYPE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.TRAP_TYPE,
                                       "TRAP_TYPE",
                                       TokenPattern.PatternType.String,
                                       "TRAP-TYPE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.TEXTUAL_CONVENTION,
                                       "TEXTUAL_CONVENTION",
                                       TokenPattern.PatternType.String,
                                       "TEXTUAL-CONVENTION");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.OBJECT_GROUP,
                                       "OBJECT_GROUP",
                                       TokenPattern.PatternType.String,
                                       "OBJECT-GROUP");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.NOTIFICATION_GROUP,
                                       "NOTIFICATION_GROUP",
                                       TokenPattern.PatternType.String,
                                       "NOTIFICATION-GROUP");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.MODULE_COMPLIANCE,
                                       "MODULE_COMPLIANCE",
                                       TokenPattern.PatternType.String,
                                       "MODULE-COMPLIANCE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.AGENT_CAPABILITIES,
                                       "AGENT_CAPABILITIES",
                                       TokenPattern.PatternType.String,
                                       "AGENT-CAPABILITIES");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.LAST_UPDATED,
                                       "LAST_UPDATED",
                                       TokenPattern.PatternType.String,
                                       "LAST-UPDATED");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.ORGANIZATION,
                                       "ORGANIZATION",
                                       TokenPattern.PatternType.String,
                                       "ORGANIZATION");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.CONTACT_INFO,
                                       "CONTACT_INFO",
                                       TokenPattern.PatternType.String,
                                       "CONTACT-INFO");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.DESCRIPTION,
                                       "DESCRIPTION",
                                       TokenPattern.PatternType.String,
                                       "DESCRIPTION");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.REVISION,
                                       "REVISION",
                                       TokenPattern.PatternType.String,
                                       "REVISION");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.STATUS,
                                       "STATUS",
                                       TokenPattern.PatternType.String,
                                       "STATUS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.REFERENCE,
                                       "REFERENCE",
                                       TokenPattern.PatternType.String,
                                       "REFERENCE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.SYNTAX,
                                       "SYNTAX",
                                       TokenPattern.PatternType.String,
                                       "SYNTAX");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.BITS,
                                       "BITS",
                                       TokenPattern.PatternType.String,
                                       "BITS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.UNITS,
                                       "UNITS",
                                       TokenPattern.PatternType.String,
                                       "UNITS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.ACCESS,
                                       "ACCESS",
                                       TokenPattern.PatternType.String,
                                       "ACCESS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.MAX_ACCESS,
                                       "MAX_ACCESS",
                                       TokenPattern.PatternType.String,
                                       "MAX-ACCESS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.MIN_ACCESS,
                                       "MIN_ACCESS",
                                       TokenPattern.PatternType.String,
                                       "MIN-ACCESS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.INDEX,
                                       "INDEX",
                                       TokenPattern.PatternType.String,
                                       "INDEX");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.AUGMENTS,
                                       "AUGMENTS",
                                       TokenPattern.PatternType.String,
                                       "AUGMENTS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.IMPLIED,
                                       "IMPLIED",
                                       TokenPattern.PatternType.String,
                                       "IMPLIED");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.DEFVAL,
                                       "DEFVAL",
                                       TokenPattern.PatternType.String,
                                       "DEFVAL");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.OBJECTS,
                                       "OBJECTS",
                                       TokenPattern.PatternType.String,
                                       "OBJECTS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.ENTERPRISE,
                                       "ENTERPRISE",
                                       TokenPattern.PatternType.String,
                                       "ENTERPRISE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.VARIABLES,
                                       "VARIABLES",
                                       TokenPattern.PatternType.String,
                                       "VARIABLES");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.DISPLAY_HINT,
                                       "DISPLAY_HINT",
                                       TokenPattern.PatternType.String,
                                       "DISPLAY-HINT");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.NOTIFICATIONS,
                                       "NOTIFICATIONS",
                                       TokenPattern.PatternType.String,
                                       "NOTIFICATIONS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.MODULE,
                                       "MODULE",
                                       TokenPattern.PatternType.String,
                                       "MODULE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.MANDATORY_GROUPS,
                                       "MANDATORY_GROUPS",
                                       TokenPattern.PatternType.String,
                                       "MANDATORY-GROUPS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.GROUP,
                                       "GROUP",
                                       TokenPattern.PatternType.String,
                                       "GROUP");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.WRITE_SYNTAX,
                                       "WRITE_SYNTAX",
                                       TokenPattern.PatternType.String,
                                       "WRITE-SYNTAX");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.PRODUCT_RELEASE,
                                       "PRODUCT_RELEASE",
                                       TokenPattern.PatternType.String,
                                       "PRODUCT-RELEASE");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.SUPPORTS,
                                       "SUPPORTS",
                                       TokenPattern.PatternType.String,
                                       "SUPPORTS");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.VARIATION,
                                       "VARIATION",
                                       TokenPattern.PatternType.String,
                                       "VARIATION");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.CREATION_REQUIRES,
                                       "CREATION_REQUIRES",
                                       TokenPattern.PatternType.String,
                                       "CREATION-REQUIRES");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.BINARY_STRING,
                                       "BINARY_STRING",
                                       TokenPattern.PatternType.RegExp,
                                       "'[0-1]*'(B|b)");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.HEXADECIMAL_STRING,
                                       "HEXADECIMAL_STRING",
                                       TokenPattern.PatternType.RegExp,
                                       "'[0-9A-Fa-f]*'(H|h)");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.QUOTED_STRING,
                                       "QUOTED_STRING",
                                       TokenPattern.PatternType.RegExp,
                                       "\"([^\"]|\"\")*\"");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.IDENTIFIER_STRING,
                                       "IDENTIFIER_STRING",
                                       TokenPattern.PatternType.RegExp,
                                       //"[a-zA-Z][a-zA-Z0-9-_]*");
                                       "[a-zA-Z][-_a-zA-Z0-9]*");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.NUMBER_STRING,
                                       "NUMBER_STRING",
                                       TokenPattern.PatternType.RegExp,
                                       "[0-9]+");
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.WHITESPACE,
                                       "WHITESPACE",
                                       TokenPattern.PatternType.RegExp,
                                       "[ \\t\\n\\r\\f\\x0b\\x17\\x18\\x19\\x1a]+");
            pattern.Ignore = true;
            AddPattern(pattern);

            pattern = new TokenPattern((int)Asn1Constants.COMMENT,
                                       "COMMENT",
                                       TokenPattern.PatternType.RegExp,
                                       "--([^\\n\\r-]|-[^\\n\\r-])*(--|-?[\\n\\r])");
            pattern.Ignore = true;
            AddPattern(pattern);
        }
    }
}
