State

Enum State 

Source
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:

  1. pick-one,
  2. pick-any and
  3. freetext
§

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:

  1. internal, which link to body elements that directly follow them,
  2. external, that reference external URIs and
  3. 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

Source

pub const BODY_TRANSITIONS: &'static [UncompiledTransition]

An array of transitions related to State::Body.

Source

pub const BLOCK_QUOTE_TRANSITIONS: &'static [UncompiledTransition]

An array of transitions related to State::Body.

Source

pub const BULLET_LIST_TRANSITIONS: [UncompiledTransition; 2]

An array of transitions related to State::BulletList.

Source

pub const DEFINITION_LIST_TRANSITIONS: &'static [UncompiledTransition]

An array of transitions related to State::DefinitionList.

Source

pub const ENUMERATED_LIST_TRANSITIONS: &'static [UncompiledTransition]

An array of transitions related to State::EnumeratedList.

Source

pub const FIELD_LIST_TRANSITIONS: &'static [UncompiledTransition]

An array of transitions related to State::FieldList.

Source

pub const OPTION_LIST_TRANSITIONS: [UncompiledTransition; 0]

An array of transitions related to State::OptionList.

Source

pub const LINE_BLOCK_TRANSITIONS: [UncompiledTransition; 0]

An array of transitions related to State::LineBlock.

Source

pub const LITERAL_BLOCK_TRANSITIONS: [UncompiledTransition; 3]

An array of transitions related to State::Line.

Source

pub const EXTENSION_OPTION_TRANSITIONS: [UncompiledTransition; 0]

An array of transitions related to State::ExtensionOptions.

Source

pub const EXPLICIT_MARKUP_TRANSITIONS: [UncompiledTransition; 0]

An array of transitions related to State::ExplicitMarkup.

Source

pub const TEXT_TRANSITIONS: [UncompiledTransition; 0]

An array of transitions related to State::Text.

Source

pub const DEFINITION_LIST_ITEM_TRANSITIONS: [UncompiledTransition; 0]

An array of transitions related to State::Definition.

Source

pub const LINE_TRANSITIONS: [UncompiledTransition; 0]

An array of transitions related to State::Line.

Source

pub const SUBSTITUTION_DEF_TRANSITIONS: [UncompiledTransition; 0]

An array of transitions related to State::SubstitutionDef.

Source

pub const LIST_TABLE_TRANSITIONS: &'static [UncompiledTransition]

Source

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

Source

pub const APLUS_QUESTIONNAIRE_TRANSITIONS: &'static [UncompiledTransition]

Source

pub const INLINE_TRANSITIONS: [InlineTransition; 13]

An array of inline transitions.

Source§

impl State

Source

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.

Source

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.

Source§

impl State

This impl block contains no items.

§================================= StateMachine associated constants

Trait Implementations§

Source§

impl Debug for State

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for State

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for State

Source§

fn eq(&self, other: &State) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for State

Source§

impl StructuralPartialEq for State

Auto Trait Implementations§

§

impl Freeze for State

§

impl RefUnwindSafe for State

§

impl Send for State

§

impl Sync for State

§

impl Unpin for State

§

impl UnwindSafe for State

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.