internal static bool MarkupBlocks(ref DecodingBlock current, List <DecodingBlock> accumulator, string input, bool finalize) { var inputLength = input.Length; for (int i = 0; i < inputLength; i++) { var is_final = finalize && (i == inputLength - 1); // is it the final character? var c = input[i]; bool eob; try { // verify next character against block descriptor // and adjust block parameters eob = current.AddCode(c, is_final); // end of block } catch (InvalidOperationException iox) { throw new ArgumentException(DECODE_ERROR_MESSAGE, nameof(input), iox); // invalid code(s) added to the block } if (eob) { // if block is finished accumulator.Add(current); // add to the accumulator current = new DecodingBlock(); // and start a new block } } return(accumulator.Any()); }