Skip to main content

get_quantifier

Parse a quantifier from the input, where "ch" is the first character in the quantifier.

Return the minimum number of occurrences permitted by the quantifier and
either None or the next character from the input_iter if the next character
is not part of the quantifier.
def get_quantifier(
ch: string,
input_iter: iterator
) - > tuple

Parse a quantifier from the input, where "ch" is the first character in the quantifier.

Parameters

NameTypeDescription
chstringThe first character of the quantifier sequence being parsed (e.g., '*', '+', '?', or '{').
input_iteriteratorAn iterator yielding tuples of (character, is_escaped) used to consume subsequent characters of the quantifier.

Returns

TypeDescription
tupleA tuple containing the minimum number of occurrences permitted by the quantifier and either None or the next character from the input_iter if the next character is not part of the quantifier.