1LaTeXML::Core::Gullet(3U)ser Contributed Perl DocumentatiLoanTeXML::Core::Gullet(3)
2
3
4
6 "LaTeXML::Core::Gullet" - expands expandable tokens and parses common
7 token sequences.
8
10 A "LaTeXML::Core::Gullet" reads tokens (LaTeXML::Core::Token) from a
11 LaTeXML::Core::Mouth. It is responsible for expanding macros and
12 expandable control sequences, if the current definition associated with
13 the token in the LaTeXML::Core::State is an
14 LaTeXML::Core::Definition::Expandable definition. The
15 "LaTeXML::Core::Gullet" also provides a variety of methods for reading
16 various types of input such as arguments, optional arguments, as well
17 as for parsing LaTeXML::Common::Number, LaTeXML::Common::Dimension,
18 etc, according to TeX's rules.
19
20 It extends LaTeXML::Common::Object.
21
22 Managing Input
23 "$gullet->openMouth($mouth, $noautoclose);"
24 Is this public? Prepares to read tokens from $mouth. If
25 $noautoclose is true, the Mouth will not be automatically closed
26 when it is exhausted.
27
28 "$gullet->closeMouth;"
29 Is this public? Finishes reading from the current mouth, and
30 reverts to the one in effect before the last openMouth.
31
32 "$gullet->flush;"
33 Is this public? Clears all inputs.
34
35 "$gullet->getLocator;"
36 Returns an object describing the current location in the input
37 stream.
38
39 Low-level methods
40 "$tokens = $gullet->expandTokens($tokens);"
41 Return the LaTeXML::Core::Tokens resulting from expanding all the
42 tokens in $tokens. This is actually only used in a few
43 circumstances where the arguments to an expandable need explicit
44 expansion; usually expansion happens at the right time.
45
46 "$token = $gullet->readToken;"
47 Return the next token from the input source, or undef if there is
48 no more input.
49
50 "$token = $gullet->readXToken($toplevel,$commentsok);"
51 Return the next unexpandable token from the input source, or undef
52 if there is no more input. If the next token is expandable, it is
53 expanded, and its expansion is reinserted into the input. If
54 $commentsok, a comment read or pending will be returned.
55
56 "$gullet->unread(@tokens);"
57 Push the @tokens back into the input stream to be re-read.
58
59 Mid-level methods
60 "$token = $gullet->readNonSpace;"
61 Read and return the next non-space token from the input after
62 discarding any spaces.
63
64 "$gullet->skipSpaces;"
65 Skip the next spaces from the input.
66
67 "$gullet->skip1Space($expanded);"
68 Skip the next token from the input if it is a space. If
69 C($expanded> is true, expands ( like " <one optional space" > ).
70
71 "$tokens = $gullet->readBalanced;"
72 Read a sequence of tokens from the input until the balancing '}'
73 (assuming the '{' has already been read). Returns a
74 LaTeXML::Core::Tokens, except in an array context, returns the
75 collected tokens and the closing token.
76
77 "$boole = $gullet->ifNext($token);"
78 Returns true if the next token in the input matches $token; the
79 possibly matching token remains in the input.
80
81 "$tokens = $gullet->readMatch(@choices);"
82 Read and return whichever of @choices matches the input, or undef
83 if none do. Each of the choices is an LaTeXML::Core::Tokens.
84
85 "$keyword = $gullet->readKeyword(@keywords);"
86 Read and return whichever of @keywords (each a string) matches the
87 input, or undef if none do. This is similar to readMatch, but case
88 and catcodes are ignored. Also, leading spaces are skipped.
89
90 "$tokens = $gullet->readUntil(@delims);"
91 Read and return a (balanced) sequence of LaTeXML::Core::Tokens
92 until matching one of the tokens in @delims. In a list context,
93 it also returns which of the delimiters ended the sequence.
94
95 High-level methods
96 "$tokens = $gullet->readArg;"
97 Read and return a TeX argument; the next Token or Tokens (if
98 surrounded by braces).
99
100 "$tokens = $gullet->readOptional($default);"
101 Read and return a LaTeX optional argument; returns $default if
102 there is no '[', otherwise the contents of the [].
103
104 "$thing = $gullet->readValue($type);"
105 Reads an argument of a given type: one of 'Number', 'Dimension',
106 'Glue', 'MuGlue' or 'any'.
107
108 "$value = $gullet->readRegisterValue($type);"
109 Read a control sequence token (and possibly it's arguments) that
110 names a register, and return the value. Returns undef if the next
111 token isn't such a register.
112
113 "$number = $gullet->readNumber;"
114 Read a LaTeXML::Common::Number according to TeX's rules of the
115 various things that can be used as a numerical value.
116
117 "$dimension = $gullet->readDimension;"
118 Read a LaTeXML::Common::Dimension according to TeX's rules of the
119 various things that can be used as a dimension value.
120
121 "$mudimension = $gullet->readMuDimension;"
122 Read a LaTeXML::Core::MuDimension according to TeX's rules of the
123 various things that can be used as a mudimension value.
124
125 "$glue = $gullet->readGlue;"
126 Read a LaTeXML::Common::Glue according to TeX's rules of the
127 various things that can be used as a glue value.
128
129 "$muglue = $gullet->readMuGlue;"
130 Read a LaTeXML::Core::MuGlue according to TeX's rules of the
131 various things that can be used as a muglue value.
132
134 Bruce Miller <bruce.miller@nist.gov>
135
137 Public domain software, produced as part of work done by the United
138 States Government & not subject to copyright in the US.
139
140
141
142perl v5.38.0 2023-07-19 LaTeXML::Core::Gullet(3)