eat


Description:

public int eat (string chunk, int chunk_pos, bool is_end_of_chunks, out FormatType matched_type, out int byte_length)

Core match: determines if characters at a given position match entries in this map. Uses a loop-based approach to handle variable-length sequences. Always normalizes digits to "1" for matching (harmless for maps without digit entries). Subclasses can wrap this with peek() for higher-level behaviour; callers can call eat() directly.

Parameters:

chunk

The text chunk to examine

chunk_pos

The position in the chunk to check

is_end_of_chunks

If true, markers at the end are treated as definitive

matched_type

Output parameter for the matched format type (NONE if no match)

byte_length

Output parameter for the byte length of the match

Returns:

1-N: Length of the match, 0: No match found, -1: Cannot determine (need more characters)