Ejemplo n.º 1
0
 /// <inheritdoc/>
 public ClassifierAction NextCharacter(char nextCharacter)
 {
     if (characterIndex == 0 ||
         characterIndex == 1)
     {
         characterIndex++;
         return(nextCharacter == '/'
                                 ? ClassifierAction.ContinueReading()
                                 : ClassifierAction.GiveUp());
     }
     else
     {
         return(nextCharacter == '\n' ||
                nextCharacter == '\r'
                                 ? ClassifierAction.TokenizeFromLast()
                                 : ClassifierAction.ContinueReading());
     }
 }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public ClassifierAction NextCharacter(char nextCharacter)
        {
            bool isMatched = IsMatched(nextCharacter);

            if (!IsFirstCharacter)
            {
                if (!isMatched)
                {
                    return(ClassifierAction.TokenizeFromLast());
                }
            }

            IsFirstCharacter = false;

            return(isMatched
                                ? ClassifierAction.ContinueReading()
                                : ClassifierAction.GiveUp());
        }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        public ClassifierAction NextCharacter(char nextCharacter)
        {
            bool isMatched = char.IsWhiteSpace(nextCharacter) &&
                             nextCharacter != '\r' &&
                             nextCharacter != '\n';

            if (!IsFirstCharacter)
            {
                if (!isMatched)
                {
                    return(ClassifierAction.TokenizeFromLast());
                }
            }

            IsFirstCharacter = false;

            return(isMatched
                                ? ClassifierAction.ContinueReading()
                                : ClassifierAction.GiveUp());
        }
Ejemplo n.º 4
0
 /// <inheritdoc/>
 public ClassifierAction NextCharacter(char nextCharacter)
 {
     if (currentIndex == Keyword.Length)
     {
         return(char.IsLetterOrDigit(nextCharacter)
                                 ? ClassifierAction.GiveUp()
                                 : ClassifierAction.TokenizeFromLast());
     }
     else
     {
         if (nextCharacter == Keyword[currentIndex])
         {
             currentIndex++;
             return(ClassifierAction.ContinueReading());
         }
         else
         {
             return(ClassifierAction.GiveUp());
         }
     }
 }
        /// <inheritdoc/>
        public ClassifierAction NextCharacter(char nextCharacter)
        {
            string keyword = MatchedString;

            if (currentIndex == keyword.Length)
            {
                return(ClassifierAction.TokenizeFromLast());
            }
            else
            {
                if (nextCharacter == keyword[currentIndex])
                {
                    currentIndex++;
                    return(ClassifierAction.ContinueReading());
                }
                else
                {
                    return(ClassifierAction.GiveUp());
                }
            }
        }
Ejemplo n.º 6
0
        /// <inheritdoc/>
        public ClassifierAction NextCharacter(char nextCharacter)
        {
            bool isMatched = char.IsDigit(nextCharacter) ||
                             nextCharacter == '.';

            if (!isFirstCharacter)
            {
                if (!isMatched)
                {
                    return(ClassifierAction.TokenizeFromLast());
                }
            }
            else if (nextCharacter == '-')
            {
                return(ClassifierAction.ContinueReading());
            }

            isFirstCharacter = false;

            return(isMatched
                                ? ClassifierAction.ContinueReading()
                                : ClassifierAction.GiveUp());
        }