EnumeratedListRule
in package
implements
Rule
FinalYes
Tags
Table of Contents
Interfaces
Constants
- PRIORITY = 80
- ALPHABETIC = '[a-z]'
- LIST_MARKER = '(^%s([\.)])(?:\s+|$)|^[(]%s[)](?:\s+|$))'
- NUMBER = '(\d+|#)'
- ROMAN_NUMBER = '((?:M{0,3})(?:CM|CD|D?C{0,3})(?:XC|XL|L?X{0,3})(?:IX|IV|V?I{0,3}))(?<!^)'
Properties
- $expression : string
- $productions : RuleContainer
Methods
- __construct() : mixed
- applies() : bool
- apply() : TNode|null
- Enters this state and loops through all relevant lines until a Node is produced.
- getItemConfig() : array{marker: string, indenting: int, marker_type: string}
- getMarkerType() : string
- isListItemStart() : bool
- isListLine() : bool
- markerSuffix() : string
- parseListItem() : ListItemNode
Constants
PRIORITY
public
mixed
PRIORITY
= 80
ALPHABETIC
private
mixed
ALPHABETIC
= '[a-z]'
LIST_MARKER
private
mixed
LIST_MARKER
= '(^%s([\.)])(?:\s+|$)|^[(]%s[)](?:\s+|$))'
NUMBER
private
mixed
NUMBER
= '(\d+|#)'
ROMAN_NUMBER
private
mixed
ROMAN_NUMBER
= '((?:M{0,3})(?:CM|CD|D?C{0,3})(?:XC|XL|L?X{0,3})(?:IX|IV|V?I{0,3}))(?<!^)'
Properties
$expression read-only
private
string
$expression
$productions read-only
private
RuleContainer
$productions
Methods
__construct()
public
__construct(RuleContainer $productions) : mixed
Parameters
- $productions : RuleContainer
applies()
public
applies(BlockContext $blockContext) : bool
Parameters
- $blockContext : BlockContext
Return values
boolapply()
Enters this state and loops through all relevant lines until a Node is produced.
public
apply(BlockContext $blockContext[, CompoundNode|null $on = null ]) : TNode|null
The opening line is considered relevant and as such is always used (this is found the case in the self::Applies() method, otherwise we wouldn't have been here) but for all subsequent lines we use a Look Ahead to test whether it should be included in the Node.
By using a Look Ahead, we prevent the cursor from advancing; and this caused the cursor to 'rest' on the line that is considered that last relevant line. The document parser will advance the line after successfully parsing this and to send the Parser into a line that belongs to another state.
Parameters
- $blockContext : BlockContext
- $on : CompoundNode|null = null
Return values
TNode|nullgetItemConfig()
private
getItemConfig(string $line) : array{marker: string, indenting: int, marker_type: string}
Parameters
- $line : string
Return values
array{marker: string, indenting: int, marker_type: string}getMarkerType()
private
getMarkerType(string $marker) : string
Parameters
- $marker : string
Return values
stringisListItemStart()
private
isListItemStart(string|null $line[, string|null $listMarker = null ]) : bool
Parameters
- $line : string|null
- $listMarker : string|null = null
Return values
boolisListLine()
private
isListLine(string|null $line) : bool
Parameters
- $line : string|null
Return values
boolmarkerSuffix()
private
markerSuffix(string $marker) : string
Parameters
- $marker : string
Return values
stringparseListItem()
private
parseListItem(array{marker: string, indenting: int, marker_type: string} $listConfig, Buffer $buffer, BlockContext $blockContext) : ListItemNode
Parameters
- $listConfig : array{marker: string, indenting: int, marker_type: string}
- $buffer : Buffer
- $blockContext : BlockContext