grammatica.grammar.CharRange.from_ords#

classmethod grammar.CharRange.from_ords(ords, negate=False)[source]#

Create an instance of grammatica.grammar.CharRange from an iterable of ordinals.

Note

Duplicate ordinals in the input are ignored.

Parameters:
  • ords (Iterable[int]) – Ordinals to include in the character ranges.

  • negate (bool, optional) – Negate the character ranges. Defaults to False.

Returns:

CharRange – Instance created from the provided ordinals.

Raises:

ValueError – No ordinals provided.