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
impl AnnotationParser
Sourcepub fn new(command: &str) -> AnnotationParser
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
impl ArgumentParser<Flm> for AnnotationParser
Source§fn can_match_empty(&self) -> bool
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>>>
fn parse_argument( &self, cx: &mut ParseContext<'_, '_, Flm>, spec: &ArgumentSpec<Flm>, ) -> ConstructParserResult<Flm, Option<ParsedArgumentNodes<Flm>>>
Source§impl Debug for AnnotationParser
impl Debug for AnnotationParser
Source§impl FlmArgumentParser for AnnotationParser
impl FlmArgumentParser for AnnotationParser
Source§fn identity(&self) -> Vec<u8> ⓘ
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
fn definition_shape(&self) -> DefinitionShape
No user definition can declare an argument read by this parser.
Source§fn description(&self) -> String
fn description(&self) -> String
[…] group”. Read moreSource§fn tack_on_fields(&self) -> Option<&[TackOnField]>
fn tack_on_fields(&self) -> Option<&[TackOnField]>
\label{…} after a heading. The default returns None,
for every other argument. Read moreSource§fn std_kind(&self) -> Option<&ArgStdKind>
fn std_kind(&self) -> Option<&ArgStdKind>
None, the default, for a parser of
a feature’s own.Auto Trait Implementations§
impl Forget for AnnotationParser
impl Freeze for AnnotationParserwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
FlmGroupType: Freeze,
PhantomData<Arc<GroupRule<Flm>>>: Freeze,
impl Move for AnnotationParser
impl RefUnwindSafe for AnnotationParser
impl Send for AnnotationParser
impl Sync for AnnotationParser
impl Unpin for AnnotationParser
impl UnsafeUnpin for AnnotationParserwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
FlmGroupType: UnsafeUnpin,
PhantomData<Arc<GroupRule<Flm>>>: UnsafeUnpin,
impl UnwindSafe for AnnotationParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<L, P> IntoArgumentParser<L, ByValue> for Pwhere
L: Lang,
P: ArgumentParser<L> + 'static,
impl<L, P> IntoArgumentParser<L, ByValue> for Pwhere
L: Lang,
P: ArgumentParser<L> + 'static,
Source§fn into_argument_parser(self) -> Arc<dyn ArgumentParser<L>> ⓘ
fn into_argument_parser(self) -> Arc<dyn ArgumentParser<L>> ⓘ
ArgumentSpecs store.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<P> IntoFlmArgumentParser for Pwhere
P: FlmArgumentParser + 'static,
impl<P> IntoFlmArgumentParser for Pwhere
P: FlmArgumentParser + 'static,
Source§fn into_flm_argument_parser(self) -> Arc<dyn FlmArgumentParser> ⓘ
fn into_flm_argument_parser(self) -> Arc<dyn FlmArgumentParser> ⓘ
ArgDef holds.