class Treetop::Compiler::OccurrenceRange
def clean_unsaturated
def clean_unsaturated if !max.empty? && max.text_value.to_i > 0 builder.if_ "#{accumulator_var}.size < #{max.text_value}" do builder << '@terminal_failures.pop' # Ignore the last failure. end end end
def compile(address, builder, parent_expression)
def compile(address, builder, parent_expression) super if !min.empty? && min.text_value.to_i != 0 # We got some, but fewer than we wanted. There'll be a failure reported already builder.if__ "#{accumulator_var}.size < #{min.text_value}" do reset_index assign_failure start_index_var end builder.else_ do clean_unsaturated assign_and_extend_result parent_expression end else clean_unsaturated assign_and_extend_result parent_expression end end_comment(parent_expression) end
def expected
def expected parent_expression.atomic.expected && "at least #{min.text_value} "+parent_expression.atomic.expected end