public override List <Token> ApplyFilter(List <Token> tokens) { var from = 0; var patternRes = FilterPattern.GetMatch(tokens, from); while (patternRes.IsFullMatch) { tokens.RemoveRange(patternRes.Start, patternRes.Length); from = patternRes.Start; patternRes = FilterPattern.GetMatch(tokens, from); } return(tokens); }
public override List <Token> ApplyFilter(List <Token> tokens) { var matchResult = FilterPattern.GetMatch(tokens); while (matchResult.IsPartMatch) { var tokensToApplyRule = TokenUtils.GetMatchResultTokens(tokens, matchResult); tokensToApplyRule = EditFunc(tokensToApplyRule); tokens.RemoveRange(matchResult.Start, matchResult.Length); tokens.InsertRange(matchResult.Start, tokensToApplyRule); matchResult = FilterPattern.GetMatch(tokens, matchResult.Start + tokensToApplyRule.Count); } return(tokens); }