package matrix

  1. Overview
  2. Docs

Module Parser.ParamsSource

Sourcetype t

The type for the parameters of a control sequence or DCS header.

Sourceval count : t -> int

count p is the number of parameters, such as 0 for CSI m and 2 for CSI ; m.

Sourceval pn : t -> int -> default:int -> int

pn p i ~default reads parameter i as a count or a position (ECMA-48 §8.1, Pn). Absent, 0 or i >= count p means default. DEC terminals give 0 the default's meaning for these parameters (VT510 §4.3.3, "A 0 value or omitted parameter indicates a default value"), as does ECMA-48's ZERO DEFAULT MODE for the functions it lists (F.4.2). Reads the first field.

Sourceval ps : t -> int -> default:int -> int

ps p i ~default reads parameter i as a selector (ECMA-48 §8.1, Ps). Absent or i >= count p means default, and 0 is the value 0, as in ED 0 or SGR 0. Reads the first field.

Sourceval value : t -> int -> int option

value p i is the first field of parameter i, None if it is absent or i >= count p. For functions that skip absent parameters, such as SM and RM.

Sourceval fields : t -> int -> int

fields p i is the number of fields of parameter i, such as 1 for 5 and 3 for 5:1:2, and 0 if i >= count p.

Sourceval field : t -> int -> int -> int option

field p i j is field j of parameter i, None if it is absent or out of range. Field 0 is the one value reads.