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 "@tokens = $gullet->neutralizeTokens(@tokens);"
47 Another unusual method: Used for things like \edef and token
48 registers, to inhibit further expansion of control sequences and
49 proper spawning of register tokens.
50
51 "$token = $gullet->readToken;"
52 Return the next token from the input source, or undef if there is
53 no more input.
54
55 "$token = $gullet->readXToken($toplevel,$commentsok);"
56 Return the next unexpandable token from the input source, or undef
57 if there is no more input. If the next token is expandable, it is
58 expanded, and its expansion is reinserted into the input. If
59 $commentsok, a comment read or pending will be returned.
60
61 "$gullet->unread(@tokens);"
62 Push the @tokens back into the input stream to be re-read.
63
64 Mid-level methods
65 "$token = $gullet->readNonSpace;"
66 Read and return the next non-space token from the input after
67 discarding any spaces.
68
69 "$gullet->skipSpaces;"
70 Skip the next spaces from the input.
71
72 "$gullet->skip1Space;"
73 Skip the next token from the input if it is a space.
74
75 "$tokens = $gullet->readBalanced;"
76 Read a sequence of tokens from the input until the balancing '}'
77 (assuming the '{' has already been read). Returns a
78 LaTeXML::Core::Tokens.
79
80 "$boole = $gullet->ifNext($token);"
81 Returns true if the next token in the input matches $token; the
82 possibly matching token remains in the input.
83
84 "$tokens = $gullet->readMatch(@choices);"
85 Read and return whichever of @choices matches the input, or undef
86 if none do. Each of the choices is an LaTeXML::Core::Tokens.
87
88 "$keyword = $gullet->readKeyword(@keywords);"
89 Read and return whichever of @keywords (each a string) matches the
90 input, or undef if none do. This is similar to readMatch, but case
91 and catcodes are ignored. Also, leading spaces are skipped.
92
93 "$tokens = $gullet->readUntil(@delims);"
94 Read and return a (balanced) sequence of LaTeXML::Core::Tokens
95 until matching one of the tokens in @delims. In a list context,
96 it also returns which of the delimiters ended the sequence.
97
98 High-level methods
99 "$tokens = $gullet->readArg;"
100 Read and return a TeX argument; the next Token or Tokens (if
101 surrounded by braces).
102
103 "$tokens = $gullet->readOptional($default);"
104 Read and return a LaTeX optional argument; returns $default if
105 there is no '[', otherwise the contents of the [].
106
107 "$thing = $gullet->readValue($type);"
108 Reads an argument of a given type: one of 'Number', 'Dimension',
109 'Glue', 'MuGlue' or 'any'.
110
111 "$value = $gullet->readRegisterValue($type);"
112 Read a control sequence token (and possibly it's arguments) that
113 names a register, and return the value. Returns undef if the next
114 token isn't such a register.
115
116 "$number = $gullet->readNumber;"
117 Read a LaTeXML::Common::Number according to TeX's rules of the
118 various things that can be used as a numerical value.
119
120 "$dimension = $gullet->readDimension;"
121 Read a LaTeXML::Common::Dimension according to TeX's rules of the
122 various things that can be used as a dimension value.
123
124 "$mudimension = $gullet->readMuDimension;"
125 Read a LaTeXML::Core::MuDimension according to TeX's rules of the
126 various things that can be used as a mudimension value.
127
128 "$glue = $gullet->readGlue;"
129 Read a LaTeXML::Common::Glue according to TeX's rules of the
130 various things that can be used as a glue value.
131
132 "$muglue = $gullet->readMuGlue;"
133 Read a LaTeXML::Core::MuGlue according to TeX's rules of the
134 various things that can be used as a muglue value.
135
137 Bruce Miller <bruce.miller@nist.gov>
138
140 Public domain software, produced as part of work done by the United
141 States Government & not subject to copyright in the US.
142
143
144
145perl v5.28.0 2018-07-27 LaTeXML::Core::Gullet(3)