/// <inheritdoc/> public override ParserRuleResult Execute(InputBuffer buffer) { var succeeded = _delegate(buffer, out var token); return(succeeded ? ParserRuleResult.Success(token) : ParserRuleResult.Fail()); }
/// <inheritdoc/> public override ParserRuleResult Execute(InputBuffer buffer) { var tokens = new List <IToken>(); foreach (var rule in _rules) { var result = rule.Execute(buffer); // All rules must succeed for this rule to pass through to the mapping stage. if (!result.Succeeded) { return(ParserRuleResult.Fail()); } if (result.Token != null) { tokens.Add(result.Token); } } return(_mapper(tokens)); }
/// <inheritdoc/> public override ParserRuleResult Execute(InputBuffer buffer) { return(_condition(buffer) ? ParserRuleResult.Success(token: null) : ParserRuleResult.Fail()); }