public class Mouth
extends java.lang.Object
The Mouth is the main class of this package. It is a tokenizer to TeX files: According to "The TeXBook", the "eyes" and "mouth" of TeX are responsible for turning the input to TeX into a sequence of tokens. We are not going to reimplement TeX, but rather providing a service for parsing high-level languages based on TeX (eg. LaTeX, ConTeXt). For this reason the tokenizer deviates slightly from TeX: We're not reading a stream of bytes but rather a stream of characters (which makes no difference for ASCII files).
In tribute to Donald E. Knuths digestive metaphors, we divide the process in four levels
Constructor and Description |
---|
Mouth(java.io.Reader reader)
Construct a new
Mouth based on a character stream |
Modifier and Type | Method and Description |
---|---|
CatcodeTable |
getCatcodes()
Get the currently used catcode table
|
char |
getEndlinechar()
Return the current value of the \endlinechar (the character added to the end of each input line)
|
Token |
getToken()
Get the next token
|
Token |
getTokenObject()
Return the object used to store the current token (the "tongue" of TeX).
|
void |
setCatcodes(CatcodeTable catcodes)
Set the catcode table.
|
void |
setEndlinechar(char c)
Set a new \endlinechar (the character added to the end of each input line).
|
public Mouth(java.io.Reader reader) throws java.io.IOException
Mouth
based on a character streamreader
- the character stream to tokenizejava.io.IOException
- if we fail to read the character streampublic CatcodeTable getCatcodes()
public void setCatcodes(CatcodeTable catcodes)
catcodes
- the tablepublic char getEndlinechar()
public void setEndlinechar(char c)
c
- the characterpublic Token getTokenObject()
public Token getToken() throws java.io.IOException
getTokenObject()
).java.io.IOException
- if we fail to read the underlying stream