Exemplo n.º 1
0
        private static IParseResult <Expression> ParseValue(LLEnumerator <Token.Match> tokens)
        {
            var a = Parts.Value.Parse(tokens);

            if (a is FailedParseResult <Value> aFailure)
            {
                return(aFailure.Cast <Expression>());
            }

            if (tokens.LookAhead(Token.Match.Eof).Type != Token.Type.And &&
                tokens.LookAhead(Token.Match.Eof).Type != Token.Type.Or)
            {
                return(a.Then(v => new Expression(v)));
            }

            var conjunction = Conjunction.Parse(tokens);

            var b = Parse(tokens);

            return(a.AndThen(conjunction, b, (aR, cR, bR) => new Expression(aR, cR, bR)));
        }
Exemplo n.º 2
0
 public ConjunctionMatchable(IMatchable left, Conjunction conjunction, IMatchable right)
 {
     Left        = left;
     Conjunction = conjunction;
     Right       = right;
 }