Beispiel #1
0
        public override bool ExpectIt(ref IWordWalker ww, object additionalParam = null)
        {
            //if (!ExpectString(ref ww))
            //{
            //   return false;
            //}

            StringBuilder resultName = new StringBuilder("");

            CLetterExpector letterExpector = new CLetterExpector();

            if (!letterExpector.ExpectIt(ref ww))
            {
                error = letterExpector.error;
                return(false);
            }
            resultName.Append(letterExpector.result);

            CCharExpector charExpector = new CCharExpector();

            while (charExpector.ExpectIt(ref ww))
            {
                resultName.Append(charExpector.result);
            }

            result = resultName.ToString();
            return(true);
        }
Beispiel #2
0
        public override bool ExpectIt(ref IWordWalker ww, object additionalParam = null)
        {
            var headExpector = new CExactWordExpector("str(\"");

            if (!headExpector.ExpectIt(ref ww))
            {
                error = headExpector.error;
                return(false);
            }

            StringBuilder stringSig         = new StringBuilder();
            var           characterExpector = new CCharExpector();

            while (characterExpector.ExpectIt(ref ww))
            {
                stringSig.Append(characterExpector.result);
            }

            var tailExpector = new CExactWordExpector("\");");

            if (!tailExpector.ExpectIt(ref ww))
            {
                error = tailExpector.error;
                return(false);
            }

            result = Encoding.UTF8.GetBytes(stringSig.ToString());

            return(true);
        }