Пример #1
0
        public override ShakeCondition <string> AsShakeCondition()
        {
            var fn = (RequiresEqualityCheck) ?
                     (LexicalExtensions.GenerateCond <string>(
                          (val, ind, len) => new Tuple <bool, Segment>(val.Equals(TargetWord), new Segment(TargetWord.Length, ind)))) : LexicalExtensions.GenerateMultiCharacterCond(TargetWord);

            return((x) => x.Value.Contains(TargetWord) ? fn(x) : null); //f**k it
        }
Пример #2
0
        public override TypedShakeCondition <string> AsTypedShakeCondition()
        {
            Regex currentRegex = new Regex(TargetWord);

            return(LexicalExtensions.GenerateTypedRegexCond <string>(
                       (x, y, z) =>
            {
                Match m = currentRegex.Match(x, y, z - y);
                TypedSegment output = m.Success ? new TypedSegment(m.Length, WordType, m.Index + y) : null;
                return new Tuple <bool, TypedSegment>(m.Success, output);
            }));
        }
Пример #3
0
        public override TypedShakeCondition <string> AsTypedShakeCondition()
        {
            TypedShakeCondition <string> fn = null;

            if (RequiresEqualityCheck)
            {
                fn = LexicalExtensions.GenerateTypedCond <string>(
                    (val, ind, len) =>
                {
                    bool condition   = val.Equals(TargetWord);
                    TypedSegment seg = new TypedSegment(TargetWord.Length, WordType, ind);
                    return(new Tuple <bool, TypedSegment>(condition, seg));
                });
            }
            else
            {
                fn = LexicalExtensions.GenerateMultiCharacterTypedCond(TargetWord, TargetWord);
            }
            return((x) =>
            {
                bool result = x.Value.Contains(TargetWord);
                return result ? fn(x) : null;
            });
        }
Пример #4
0
 public override TypedShakeCondition <string> AsTypedShakeCondition()
 {
     return(LexicalExtensions.GenerateTypedCond <string>(GenerateSingularTypedDualMatch));
 }
Пример #5
0
        public override TypedShakeCondition <string> AsTypedShakeCondition()
        {
            var fn = LexicalExtensions.GenerateSingleTypedCharacterCond(TargetWord, WordType);

            return((x) => fn(x));
        }