Esempio n. 1
0
 public bool Parse(string text, int currentPosition, IToken currentToken, out int newPosition, out IToken newToken, out IForwardMovingTokenizer newParser)
 {
     //if we can't find a . then we kack
     var idx = text.IndexOf(".", currentPosition);
     if (idx == -1)
     {
         newPosition = -1;
         newToken = null;
         newParser = null;
         return false;
     }
     else
     {
         var substring = text.Substring(currentPosition, idx - currentPosition);
         newPosition = idx + 1;
         newToken = NaturalToken.New(substring);//build up the token
         newParser = new ToOpenParenthesisParser();
         return true;
     }
 }
Esempio n. 2
0
        public bool Parse(string text, int currentPosition, IToken currentToken, out int newPosition, out IToken newToken, out IForwardMovingTokenizer newParser)
        {
            //if we can't find a . then we kack
            var idx = text.IndexOf(".", currentPosition);

            if (idx == -1)
            {
                newPosition = -1;
                newToken    = null;
                newParser   = null;
                return(false);
            }
            else
            {
                var substring = text.Substring(currentPosition, idx - currentPosition);
                newPosition = idx + 1;
                newToken    = NaturalToken.New(substring);//build up the token
                newParser   = new ToOpenParenthesisParser();
                return(true);
            }
        }