Example #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));
            }
        }
Example #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));
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the DdlParser class.
        /// </summary>
        internal DdlParser(string fileName, string ddl, DdlReaderErrors errors)
        {
            if (errors != null)
            this.errors = errors;
              else
            this.errors = new DdlReaderErrors();

              scanner = new DdlScanner(fileName, ddl, errors);
        }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the DdlParser class.
 /// </summary>
 internal DdlParser(string fileName, string ddl, DdlReaderErrors errors)
 {
     _errors = errors ?? new DdlReaderErrors();
     _scanner = new DdlScanner(fileName, ddl, errors);
 }