Beispiel #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 , or ) then we kack
            var idx = text.IndexOf(",", currentPosition);

            if (idx == -1)
            {
                idx = text.IndexOf(")", currentPosition);
                if (idx == -1)
                {
                    newPosition = -1;
                    newToken    = null;
                    newParser   = null;
                    return(false);
                }

                var substring = text.Substring(currentPosition, idx - currentPosition);
                newPosition = idx + 1;
                newToken    = NaturalToken.New(substring).HasDPCTokenType(DPCTokenType.Item);
                newParser   = new ToDotParser();
                return(true);
            }
            else
            {
                var substring = text.Substring(currentPosition, idx - currentPosition);
                newPosition = idx + 1;
                newToken    = NaturalToken.New(substring).HasDPCTokenType(DPCTokenType.Item);
                newParser   = new ToCommaOrEndParenthesisParser();
                return(true);
            }
        }
Beispiel #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).HasDPCTokenType(DPCTokenType.Operation);//build up the token
         newParser = new ToCommaOrEndParenthesisParser();
         return true;
     }
 }