Skip to main content

AnnotationParser

Struct AnnotationParser 

Source
pub struct AnnotationParser { /* private fields */ }
Expand description

The parser of an annotator’s one argument: a {…} group, a […] group, or the passage up to the annotator’s closing command, chosen by the first character after the command and any whitespace and source comments that follow it. The feature declares the argument TEXT_ARG of every annotator’s command with this parser.

Before the group. As for a mandatory {…} argument of any command, whitespace and source comments may be written between the command and the opening { or [; they become the leading nodes of the argument. (A space right after the command’s name belongs to the command, as it does after every command whose name is made of letters.) When neither { nor [ follows them, they are not skipped: they are the start of the passage.

The passage. The third form reads document content, paragraph breaks and blocks included, up to the command \end<command> written at the passage’s own level, which is consumed and closes the group. An \end<command> inside a group or an environment that the passage opened belongs to that group or environment, where it is not declared. When the input, or the group or environment enclosing the annotation, ends first (at the input’s end, at a closing brace, or at an \end written at the passage’s own level), the passage is what was read up to there, and the Error flm.annotations.unterminated is reported over it; the closing brace or the \end is left for the group or environment it closes, which stays intact. (An \end at the passage’s own level can only close an environment the passage did not open: the body of an environment the passage opened is read by that environment, where the passage does not stop.)

The groups. A […] group is read as an optional argument’s group is, and an unclosed { or [ is reported by the language as any unclosed group is. A {…} group alone inside the brackets is kept as a group of the remark, not unwrapped.

In every form, the argument is one group node holding the content, and the group records what was read as its delimiters (form_of reads them). The argument’s parsing mode and scoped packages come from its declaration and apply to the whole content.

Implementations§

Source§

impl AnnotationParser

Source

pub fn new(command: &str) -> AnnotationParser

Returns the parser of the argument of the command command (without the backslash), whose passage form closes at \end<command>.

Trait Implementations§

Source§

impl ArgumentParser<Flm> for AnnotationParser

Source§

fn can_match_empty(&self) -> bool

Returns false: the argument is always present, since the third form reads any content that follows the command.

Source§

fn parse_argument( &self, cx: &mut ParseContext<'_, '_, Flm>, spec: &ArgumentSpec<Flm>, ) -> ConstructParserResult<Flm, Option<ParsedArgumentNodes<Flm>>>

Parse one argument at the context’s current position. Read more
Source§

impl Debug for AnnotationParser

Source§

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

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

impl FlmArgumentParser for AnnotationParser

Source§

fn identity(&self) -> Vec<u8> ⓘ

flm.annotations.text: followed by the command: the parsers of two commands differ, since each stops at its own closing command.

Source§

fn definition_shape(&self) -> DefinitionShape

No user definition can declare an argument read by this parser.

Source§

fn description(&self) -> String

Returns a description of the argument’s syntax in a short phrase, such as “an optional […] group”. Read more
Source§

fn tack_on_fields(&self) -> Option<&[TackOnField]>

Returns the tack-on fields the argument declares, when it is a tack-on argument: the argument that absorbs the field macros written at its position in a call, after the arguments declared before it, such as the \label{…} after a heading. The default returns None, for every other argument. Read more
Source§

fn std_kind(&self) -> Option<&ArgStdKind>

Returns the standard kind this parser reads, for a program that describes the registry’s declarations, such as a generator of documentation pages; None, the default, for a parser of a feature’s own.

Auto Trait Implementations§

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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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<L, P> IntoArgumentParser<L, ByValue> for P
where L: Lang, P: ArgumentParser<L> + 'static,

Source§

fn into_argument_parser(self) -> Arc<dyn ArgumentParser<L>> ⓘ

Convert into the shared parser handle ArgumentSpecs store.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P> IntoFlmArgumentParser for P
where P: FlmArgumentParser + 'static,

Source§

fn into_flm_argument_parser(self) -> Arc<dyn FlmArgumentParser> ⓘ

Returns the shared parser object an ArgDef holds.
Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.