Beispiel #1
0
        /// <summary>
        /// Builds a new instance of Lexer.
        /// </summary>
        public Lexer()
        {
            _position = 0;
            _text     = "";

            _dictionary = new TokenDictionary();
            _dictionary.Add("/*", LexerTag.CommentC_Open);
            _dictionary.Add("*/", LexerTag.CommentC_Close);
            _dictionary.Add("//", LexerTag.CommentCpp);

            // Here: definition of one lengthed sequences
            _dictionary.Add("\\", LexerTag.Text);
            _dictionary.Add(" ", LexerTag.Separator);
            _dictionary.Add("\t", LexerTag.Separator);
            _dictionary.Add("\r", LexerTag.Separator);
            _dictionary.Add(".", LexerTag.Separator);
            _dictionary.Add(";", LexerTag.Separator);
            _dictionary.Add("[", LexerTag.Separator);
            _dictionary.Add("]", LexerTag.Separator);
            _dictionary.Add("(", LexerTag.Separator);
            _dictionary.Add(")", LexerTag.Separator);
            _dictionary.Add("#", LexerTag.Separator);
            _dictionary.Add(":", LexerTag.Separator);
            _dictionary.Add("<", LexerTag.Separator);
            _dictionary.Add(">", LexerTag.Separator);
            _dictionary.Add("=", LexerTag.Separator);
            _dictionary.Add(",", LexerTag.Separator);
            _dictionary.Add("\n", LexerTag.EndOfLine);
            _dictionary.Add("'", LexerTag.SingleQuote);
            _dictionary.Add("\"", LexerTag.DoubleQuote);

            return;
        }
Beispiel #2
0
        /// <summary>
        /// Builds a new instance of Lexer.
        /// </summary>
        public Lexer()
        {
            _position = 0;
            _text = "";

            _dictionary = new TokenDictionary();
            _dictionary.Add("/*", LexerTag.CommentC_Open);
            _dictionary.Add("*/", LexerTag.CommentC_Close);
            _dictionary.Add("//", LexerTag.CommentCpp);

            // Here: definition of one lengthed sequences
            _dictionary.Add("\\", LexerTag.Text);
            _dictionary.Add(" ", LexerTag.Separator);
            _dictionary.Add("\t", LexerTag.Separator);
            _dictionary.Add("\r", LexerTag.Separator);
            _dictionary.Add(".", LexerTag.Separator);
            _dictionary.Add(";", LexerTag.Separator);
            _dictionary.Add("[", LexerTag.Separator);
            _dictionary.Add("]", LexerTag.Separator);
            _dictionary.Add("(", LexerTag.Separator);
            _dictionary.Add(")", LexerTag.Separator);
            _dictionary.Add("#", LexerTag.Separator);
            _dictionary.Add(":", LexerTag.Separator);
            _dictionary.Add("<", LexerTag.Separator);
            _dictionary.Add(">", LexerTag.Separator);
            _dictionary.Add("=", LexerTag.Separator);
            _dictionary.Add(",", LexerTag.Separator);
            _dictionary.Add("\n", LexerTag.EndOfLine);
            _dictionary.Add("'", LexerTag.SingleQuote);
            _dictionary.Add("\"", LexerTag.DoubleQuote);

            return;
        }
        public void SetUp()
        {
            Lexer lexer;

            _emptyDictionary = new TestingTokenDictionary();

            lexer = new Lexer();
            _filledDictionary = lexer.Dictionary;
            Assert.That(_filledDictionary, Is.Not.Null);
            Assert.That(_filledDictionary.Count, Is.GreaterThan(0));

            return;
        }
Beispiel #4
0
        /// <summary>
        /// Clear all previously defined sequences.
        /// </summary>
        protected void Clear()
        {
            _dictionary = new TokenDictionary();

            return;
        }
Beispiel #5
0
        /// <summary>
        /// Clear all previously defined sequences.
        /// </summary>
        protected void Clear()
        {
            _dictionary = new TokenDictionary();

            return;
        }