Microsoft.Zing.Keyword.GetKeyword C# (CSharp) Méthode

GetKeyword() private méthode

private GetKeyword ( System.Compiler.DocumentText source, int startPos, int endPos ) : Token
source System.Compiler.DocumentText
startPos int
endPos int
Résultat Token
        internal Token GetKeyword(DocumentText source, int startPos, int endPos)
        {
            int length = endPos - startPos;
            Keyword keyword = this;
            nextToken:
            while (null != keyword)
            {
                if (length == keyword.length)
                {
                    // we know the first char has to match
                    string name = keyword.name;
                    for (int i = 1, j = startPos + 1; i < length; i++, j++)
                    {
                        char ch1 = name[i];
                        char ch2 = source[j];
                        if (ch1 == ch2)
                            continue;
                        else if (ch2 < ch1)
                            return Token.Identifier;
                        else
                        {
                            keyword = keyword.next;
                            goto nextToken;
                        }
                    }
                    return keyword.token;
                }
                else if (length < keyword.length)
                    return Token.Identifier;

                keyword = keyword.next;
            }
            return Token.Identifier;
        }

Same methods

Keyword::GetKeyword ( string source, int startPos, int endPos ) : Token