pub enum State {
Show 26 variants
Admonition,
AplusMultiCol,
AplusQuestionnaire,
AplusPickOne,
AplusPickAny,
Body,
Section,
BlockQuote,
BulletList,
Citation,
DefinitionList,
EnumeratedList,
HyperlinkTarget,
ListItem,
FieldList,
Figure,
Footnote,
InternalHyperlinkTarget,
OptionList,
LineBlock,
ListTable,
ExtensionOptions,
Line,
LiteralBlock,
Failure,
EOF,
}Expand description
An enum of states.
The variants are used as keys to the static TRANSITION_MAP, which stores vectors of
transitions as values.
Variants§
Admonition
A state for parsing body nodes inside admonitions.
AplusMultiCol
A state for detecting reStructuredText & Sphinx body elements,
in addition to column breaks in the form of ::newcol for A+ nodes that support them.
These include the Point of Interest directive.
AplusQuestionnaire
A state for recognizing the sub-directives:
pick-one,pick-anyandfreetext
AplusPickOne
A state for detecting choices and assignments inside a A+ questionnaire
subdirective pick-one.
AplusPickAny
A state for detecting choices and assignments inside a A+ questionnaire
subdirective pick-any.
Body
A state for recognizing body elements such as lists or footnotes when focused on document root.
Section
A state for detecting body elements inside a section.
BlockQuote
A state for recognizing body elements inside a block quote. In addition to normal body elements, attributions are also recognized as such in this state.
BulletList
In this state, the parser only recognizes empty lines and bullet list items.
Citation
Citation nodes may contain arbitrary body elements. This state is therefore reserved for recognizing them when focused on a citation node.
DefinitionList
Definition lists may only contain empty lines and definition list items.
EnumeratedList
When in this state, the parser only recognizes empty lines and enumerated list items.
HyperlinkTarget
ListItem
List items of any type, such as enumerated or field list items can contain arbitrary body elements. This state is reserved for recognizing them when focused on one of the list item type nodes.
FieldList
When focused on a field list node, the parser only recognizes empty lines and field list items.
Figure
Footnote
Footnotes can contain arbitrary body elements. This state is reserved for recognizing them when focused on a footnote node.
InternalHyperlinkTarget
There are 3 different types of hyperlink targets:
- internal, which link to body elements that directly follow them,
- external, that reference external URIs and
- indirect, which reference other hyperlink targets inside the same document.
??? Normally, an external or indirect hyperlink target would simply be a node on its own, that simply contains a reference label of some kind. However, chained internal hyperlinks all reference the same target node, so a state of its own (this one) is reserved for parsing them until a node of a different kind (including other types of hyperlink targets) is encountered. Once this happens, all of the internal hyperlinks are set to point to this same target node. ???
OptionList
When focused on an option list, only empty lines and option list items are recognized. This state is reserved for that purpose.
LineBlock
Empty and line block lines (lines beginning with ‘|’) are recognized in this state.
ListTable
A state for recognizing bullet list items inside a ListTable
ExtensionOptions
A state for parsing field lists inside diretives. Field lists located inside directive nodes work as directive parameters or settings.
Line
A state for parsing section titles and document transitions (a.k.a. \hrulefill commands in LaTeX terms).
LiteralBlock
A state for parsing empty lines and literal blocks of text.
Literal blocks are (non-contiguous) indented or “quoted” blocks of text that
are preceded by a paragraph ending in a ::.
Failure
An explicit failure state. Allows explicit signalling of transition failures.
EOF
An End of File state. Could have also been named EOI, as in end of input, as this state is transitioned to when a parser reaches the end of its source input: This does not neecssarily correspond to the end of the given file during nested parsing sessions, as nested parsers are usually limited to a parsijng single block of text behind a node indentifier.
Implementations§
Source§impl State
§=================================
StateMachine associated constants
impl State
§================================= StateMachine associated constants
Sourcepub const BODY_TRANSITIONS: &'static [UncompiledTransition]
pub const BODY_TRANSITIONS: &'static [UncompiledTransition]
An array of transitions related to State::Body.
Sourcepub const BLOCK_QUOTE_TRANSITIONS: &'static [UncompiledTransition]
pub const BLOCK_QUOTE_TRANSITIONS: &'static [UncompiledTransition]
An array of transitions related to State::Body.
Sourcepub const BULLET_LIST_TRANSITIONS: [UncompiledTransition; 2]
pub const BULLET_LIST_TRANSITIONS: [UncompiledTransition; 2]
An array of transitions related to State::BulletList.
Sourcepub const DEFINITION_LIST_TRANSITIONS: &'static [UncompiledTransition]
pub const DEFINITION_LIST_TRANSITIONS: &'static [UncompiledTransition]
An array of transitions related to State::DefinitionList.
Sourcepub const ENUMERATED_LIST_TRANSITIONS: &'static [UncompiledTransition]
pub const ENUMERATED_LIST_TRANSITIONS: &'static [UncompiledTransition]
An array of transitions related to State::EnumeratedList.
Sourcepub const FIELD_LIST_TRANSITIONS: &'static [UncompiledTransition]
pub const FIELD_LIST_TRANSITIONS: &'static [UncompiledTransition]
An array of transitions related to State::FieldList.
Sourcepub const OPTION_LIST_TRANSITIONS: [UncompiledTransition; 0]
pub const OPTION_LIST_TRANSITIONS: [UncompiledTransition; 0]
An array of transitions related to State::OptionList.
Sourcepub const LINE_BLOCK_TRANSITIONS: [UncompiledTransition; 0]
pub const LINE_BLOCK_TRANSITIONS: [UncompiledTransition; 0]
An array of transitions related to State::LineBlock.
Sourcepub const LITERAL_BLOCK_TRANSITIONS: [UncompiledTransition; 3]
pub const LITERAL_BLOCK_TRANSITIONS: [UncompiledTransition; 3]
An array of transitions related to State::Line.
Sourcepub const EXTENSION_OPTION_TRANSITIONS: [UncompiledTransition; 0]
pub const EXTENSION_OPTION_TRANSITIONS: [UncompiledTransition; 0]
An array of transitions related to State::ExtensionOptions.
Sourcepub const EXPLICIT_MARKUP_TRANSITIONS: [UncompiledTransition; 0]
pub const EXPLICIT_MARKUP_TRANSITIONS: [UncompiledTransition; 0]
An array of transitions related to State::ExplicitMarkup.
Sourcepub const TEXT_TRANSITIONS: [UncompiledTransition; 0]
pub const TEXT_TRANSITIONS: [UncompiledTransition; 0]
An array of transitions related to State::Text.
Sourcepub const DEFINITION_LIST_ITEM_TRANSITIONS: [UncompiledTransition; 0]
pub const DEFINITION_LIST_ITEM_TRANSITIONS: [UncompiledTransition; 0]
An array of transitions related to State::Definition.
Sourcepub const LINE_TRANSITIONS: [UncompiledTransition; 0]
pub const LINE_TRANSITIONS: [UncompiledTransition; 0]
An array of transitions related to State::Line.
Sourcepub const SUBSTITUTION_DEF_TRANSITIONS: [UncompiledTransition; 0]
pub const SUBSTITUTION_DEF_TRANSITIONS: [UncompiledTransition; 0]
An array of transitions related to State::SubstitutionDef.
pub const LIST_TABLE_TRANSITIONS: &'static [UncompiledTransition]
Sourcepub const APLUS_MULTICOL_TRANSITIONS: &'static [UncompiledTransition]
pub const APLUS_MULTICOL_TRANSITIONS: &'static [UncompiledTransition]
An array of transitions allowed in multi-column A+ directives such as points of interest. These are indentical to those, except the state also recognizes
pub const APLUS_QUESTIONNAIRE_TRANSITIONS: &'static [UncompiledTransition]
Sourcepub const INLINE_TRANSITIONS: [InlineTransition; 13]
pub const INLINE_TRANSITIONS: [InlineTransition; 13]
An array of inline transitions.
Source§impl State
impl State
Sourcepub fn to_failure(self) -> Self
pub fn to_failure(self) -> Self
Transitions a StateMachine into a Failure state using the From trait,
the implementation of which automatically implements the Into trait.
Sourcepub fn get_transitions(
&self,
line_cursor: &LineCursor,
) -> Result<&Vec<Transition>, &'static str>
pub fn get_transitions( &self, line_cursor: &LineCursor, ) -> Result<&Vec<Transition>, &'static str>
Retrieves the list of transitions based on a given StateMachine variant
using a match statement. First checks for end states that don’t contain transitions,
such as EOF or Failure and if these are not matched,
retrieves a list of transitions from the TRANSITION_MAP.