.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "LaTeXML::Core::Gullet 3pm" .TH LaTeXML::Core::Gullet 3pm 2024-02-27 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME "LaTeXML::Core::Gullet" \- expands expandable tokens and parses common token sequences. .SH DESCRIPTION .IX Header "DESCRIPTION" A \f(CW\*(C`LaTeXML::Core::Gullet\*(C'\fR reads tokens (LaTeXML::Core::Token) from a LaTeXML::Core::Mouth. It is responsible for expanding macros and expandable control sequences, if the current definition associated with the token in the LaTeXML::Core::State is an LaTeXML::Core::Definition::Expandable definition. The \f(CW\*(C`LaTeXML::Core::Gullet\*(C'\fR also provides a variety of methods for reading various types of input such as arguments, optional arguments, as well as for parsing LaTeXML::Common::Number, LaTeXML::Common::Dimension, etc, according to TeX's rules. .PP It extends LaTeXML::Common::Object. .SS "Managing Input" .IX Subsection "Managing Input" .ie n .IP """$gullet\->openMouth($mouth, $noautoclose);""" 4 .el .IP "\f(CW$gullet\->openMouth($mouth, $noautoclose);\fR" 4 .IX Item "$gullet->openMouth($mouth, $noautoclose);" Is this public? Prepares to read tokens from \f(CW$mouth\fR. If \f(CW$noautoclose\fR is true, the Mouth will not be automatically closed when it is exhausted. .ie n .IP """$gullet\->closeMouth;""" 4 .el .IP \f(CW$gullet\->closeMouth;\fR 4 .IX Item "$gullet->closeMouth;" Is this public? Finishes reading from the current mouth, and reverts to the one in effect before the last openMouth. .ie n .IP """$gullet\->flush;""" 4 .el .IP \f(CW$gullet\->flush;\fR 4 .IX Item "$gullet->flush;" Is this public? Clears all inputs. .ie n .IP """$gullet\->getLocator;""" 4 .el .IP \f(CW$gullet\->getLocator;\fR 4 .IX Item "$gullet->getLocator;" Returns an object describing the current location in the input stream. .SS "Low-level methods" .IX Subsection "Low-level methods" .ie n .IP """$tokens = $gullet\->expandTokens($tokens);""" 4 .el .IP "\f(CW$tokens = $gullet\->expandTokens($tokens);\fR" 4 .IX Item "$tokens = $gullet->expandTokens($tokens);" Return the LaTeXML::Core::Tokens resulting from expanding all the tokens in \f(CW$tokens\fR. This is actually only used in a few circumstances where the arguments to an expandable need explicit expansion; usually expansion happens at the right time. .ie n .IP """$token = $gullet\->readToken;""" 4 .el .IP "\f(CW$token = $gullet\->readToken;\fR" 4 .IX Item "$token = $gullet->readToken;" Return the next token from the input source, or undef if there is no more input. .ie n .IP """$token = $gullet\->readXToken($toplevel,$commentsok);""" 4 .el .IP "\f(CW$token = $gullet\->readXToken($toplevel,$commentsok);\fR" 4 .IX Item "$token = $gullet->readXToken($toplevel,$commentsok);" Return the next unexpandable token from the input source, or undef if there is no more input. If the next token is expandable, it is expanded, and its expansion is reinserted into the input. If \f(CW$commentsok\fR, a comment read or pending will be returned. .ie n .IP """$gullet\->unread(@tokens);""" 4 .el .IP \f(CW$gullet\->unread(@tokens);\fR 4 .IX Item "$gullet->unread(@tokens);" Push the \f(CW@tokens\fR back into the input stream to be re-read. .SS "Mid-level methods" .IX Subsection "Mid-level methods" .ie n .IP """$token = $gullet\->readNonSpace;""" 4 .el .IP "\f(CW$token = $gullet\->readNonSpace;\fR" 4 .IX Item "$token = $gullet->readNonSpace;" Read and return the next non-space token from the input after discarding any spaces. .ie n .IP """$gullet\->skipSpaces;""" 4 .el .IP \f(CW$gullet\->skipSpaces;\fR 4 .IX Item "$gullet->skipSpaces;" Skip the next spaces from the input. .ie n .IP """$gullet\->skip1Space($expanded);""" 4 .el .IP \f(CW$gullet\->skip1Space($expanded);\fR 4 .IX Item "$gullet->skip1Space($expanded);" Skip the next token from the input if it is a space. If C($expanded> is true, expands ( like \f(CW\*(C` ). .ie n .IP """$tokens = $gullet\->readBalanced;""" 4 .el .IP "\f(CW$tokens = $gullet\->readBalanced;\fR" 4 .IX Item "$tokens = $gullet->readBalanced;" Read a sequence of tokens from the input until the balancing '}' (assuming the '{' has already been read). Returns a LaTeXML::Core::Tokens, except in an array context, returns the collected tokens and the closing token. .ie n .IP """$boole = $gullet\->ifNext($token);""" 4 .el .IP "\f(CW$boole = $gullet\->ifNext($token);\fR" 4 .IX Item "$boole = $gullet->ifNext($token);" Returns true if the next token in the input matches \f(CW$token\fR; the possibly matching token remains in the input. .ie n .IP """$tokens = $gullet\->readMatch(@choices);""" 4 .el .IP "\f(CW$tokens = $gullet\->readMatch(@choices);\fR" 4 .IX Item "$tokens = $gullet->readMatch(@choices);" Read and return whichever of \f(CW@choices\fR matches the input, or undef if none do. Each of the choices is an LaTeXML::Core::Tokens. .ie n .IP """$keyword = $gullet\->readKeyword(@keywords);""" 4 .el .IP "\f(CW$keyword = $gullet\->readKeyword(@keywords);\fR" 4 .IX Item "$keyword = $gullet->readKeyword(@keywords);" Read and return whichever of \f(CW@keywords\fR (each a string) matches the input, or undef if none do. This is similar to readMatch, but case and catcodes are ignored. Also, leading spaces are skipped. .ie n .IP """$tokens = $gullet\->readUntil(@delims);""" 4 .el .IP "\f(CW$tokens = $gullet\->readUntil(@delims);\fR" 4 .IX Item "$tokens = $gullet->readUntil(@delims);" Read and return a (balanced) sequence of LaTeXML::Core::Tokens until matching one of the tokens in \f(CW@delims\fR. In a list context, it also returns which of the delimiters ended the sequence. .SS "High-level methods" .IX Subsection "High-level methods" .ie n .IP """$tokens = $gullet\->readArg;""" 4 .el .IP "\f(CW$tokens = $gullet\->readArg;\fR" 4 .IX Item "$tokens = $gullet->readArg;" Read and return a TeX argument; the next Token or Tokens (if surrounded by braces). .ie n .IP """$tokens = $gullet\->readOptional($default);""" 4 .el .IP "\f(CW$tokens = $gullet\->readOptional($default);\fR" 4 .IX Item "$tokens = $gullet->readOptional($default);" Read and return a LaTeX optional argument; returns \f(CW$default\fR if there is no '[', otherwise the contents of the []. .ie n .IP """$thing = $gullet\->readValue($type);""" 4 .el .IP "\f(CW$thing = $gullet\->readValue($type);\fR" 4 .IX Item "$thing = $gullet->readValue($type);" Reads an argument of a given type: one of 'Number', 'Dimension', 'Glue', 'MuGlue' or 'any'. .ie n .IP """$value = $gullet\->readRegisterValue($type);""" 4 .el .IP "\f(CW$value = $gullet\->readRegisterValue($type);\fR" 4 .IX Item "$value = $gullet->readRegisterValue($type);" Read a control sequence token (and possibly it's arguments) that names a register, and return the value. Returns undef if the next token isn't such a register. .ie n .IP """$number = $gullet\->readNumber;""" 4 .el .IP "\f(CW$number = $gullet\->readNumber;\fR" 4 .IX Item "$number = $gullet->readNumber;" Read a LaTeXML::Common::Number according to TeX's rules of the various things that can be used as a numerical value. .ie n .IP """$dimension = $gullet\->readDimension;""" 4 .el .IP "\f(CW$dimension = $gullet\->readDimension;\fR" 4 .IX Item "$dimension = $gullet->readDimension;" Read a LaTeXML::Common::Dimension according to TeX's rules of the various things that can be used as a dimension value. .ie n .IP """$mudimension = $gullet\->readMuDimension;""" 4 .el .IP "\f(CW$mudimension = $gullet\->readMuDimension;\fR" 4 .IX Item "$mudimension = $gullet->readMuDimension;" Read a LaTeXML::Core::MuDimension according to TeX's rules of the various things that can be used as a mudimension value. .ie n .IP """$glue = $gullet\->readGlue;""" 4 .el .IP "\f(CW$glue = $gullet\->readGlue;\fR" 4 .IX Item "$glue = $gullet->readGlue;" Read a LaTeXML::Common::Glue according to TeX's rules of the various things that can be used as a glue value. .ie n .IP """$muglue = $gullet\->readMuGlue;""" 4 .el .IP "\f(CW$muglue = $gullet\->readMuGlue;\fR" 4 .IX Item "$muglue = $gullet->readMuGlue;" Read a LaTeXML::Core::MuGlue according to TeX's rules of the various things that can be used as a muglue value. .SH AUTHOR .IX Header "AUTHOR" Bruce Miller .SH COPYRIGHT .IX Header "COPYRIGHT" Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.