Esempio n. 1
0
        /// <summary>
        /// Gets the next symbol without touching the DDL cursor.
        /// </summary>
        internal Symbol PeekSymbol()
        {
            int idx    = this.m_idx - 1;
            int length = this.ddlLength - idx;

            // Move to first non whitespace
            char ch = char.MinValue;

            while (length > 0)
            {
                ch = m_strDocument[idx++];
                if (!DdlScanner.IsWhiteSpace(ch))
                {
                    break;
                }
                length--;
            }

            if (DdlScanner.IsLetter(ch))
            {
                return(Symbol.Text);
            }
            else if (ch == '\\')
            {
                return(PeekKeyword(idx));
            }
            else
            {
                return(PeekPunctuator(idx - 1));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the next keyword without touching the DDL cursor.
        /// </summary>
        internal Symbol PeekKeyword(int index)
        {
            // Check special keywords
            switch (m_strDocument[index])
            {
            case '{':
            case '}':
            case '\\':
            case '-':
            case '(':
                return(Symbol.Character);
            }

            string token  = "\\";
            int    idx    = index;
            int    length = this.ddlLength - idx;

            while (length > 0)
            {
                char ch = m_strDocument[idx++];
                if (DdlScanner.IsLetter(ch))
                {
                    token += ch;
                    length--;
                }
                else
                {
                    break;
                }
            }
            return(KeyWords.SymbolFromName(token));
        }