public class Latex2Unicode extends Object implements ParsePropertiesKeys, LatexMarkupParser.LatexLexer
The low-level latex to unicode scanner for Z.
See LatexToUnicode for a high level latex to unicode converter.
This is a JFlex generated scanner for translating
Z
specifications written in the latex mark-up language into unicode.
It provides tokens (instances of class Symbol) whose values
are unicode strings and which contain line and column number
information from the original latex file or stream.
See LatexSym for a list of possible token kinds.
In order to work properly, a map containing the latex mark-up function
of the current section to be scanned is needed. This map must be
updated when a new section header is recognised.
The LatexMarkupParser is
responsible for this task, and should process the output of an instance
of this class before it can be processed further.
Limitations:
| Modifier and Type | Field and Description |
|---|---|
static int |
COMMENT_STATE |
static int |
ERROR |
static int |
MARKUP
lexical states
|
static int |
YYEOF
This character denotes the end of file
|
static int |
YYINITIAL |
static int |
ZED |
PROP_IGNORE_UNKNOWN_LATEX_COMMANDS, PROP_IGNORE_UNKNOWN_LATEX_COMMANDS_DEFAULT| Constructor and Description |
|---|
Latex2Unicode(InputStream in)
Creates a new scanner.
|
Latex2Unicode(Reader in)
Creates a new scanner
There is also a java.io.InputStream version of this constructor.
|
Latex2Unicode(Source source,
SectionInfo sectInfo,
Properties properties)
Creates a new scanner for the source.
|
| Modifier and Type | Method and Description |
|---|---|
Dialect |
getDialect()
Low-level LaTeX scanner gets its dialect from the context and propagate to other scanners.
|
LatexMarkupFunction |
getMarkupFunction()
Returns the latex mark-up function.
|
protected SectionInfo |
getSectionInfo() |
Source |
getSource()
The source that is lexed.
|
LocToken |
next()
Resumes scanning until the next regular expression is matched,
the end of input is encountered or an I/O-Error occurs.
|
void |
setMarkupFunction(LatexMarkupFunction markupFunction)
Sets the latex mark-up function.
|
void |
yybegin(int newState)
Enters a new lexical state
|
char |
yycharat(int pos)
Returns the character at position pos from the
matched text.
|
void |
yyclose()
Closes the input stream.
|
int |
yylength()
Returns the length of the matched text region.
|
void |
yypushback(int number)
Pushes the specified amount of characters back into the input stream.
|
void |
yyreset(Reader reader)
Resets the scanner to read from a new input stream.
|
int |
yystate()
Returns the current lexical state.
|
String |
yytext()
Returns the text matched by the current regular expression.
|
public static final int YYEOF
public static final int MARKUP
public static final int ERROR
public static final int COMMENT_STATE
public static final int YYINITIAL
public static final int ZED
public Latex2Unicode(Source source, SectionInfo sectInfo, Properties properties) throws IOException
IOExceptionpublic Latex2Unicode(Reader in)
in - the java.io.Reader to read input from.public Latex2Unicode(InputStream in)
in - the java.io.Inputstream to read input from.public Dialect getDialect()
getDialect in interface Lexerpublic Source getSource()
Lexerprotected SectionInfo getSectionInfo()
public LatexMarkupFunction getMarkupFunction()
public void setMarkupFunction(LatexMarkupFunction markupFunction)
LatexCommand containing the unicode representation.
This map must be kept up to date to ensure proper working of
instances of this class.setMarkupFunction in interface LatexMarkupParser.LatexLexerpublic final void yyclose()
throws IOException
IOExceptionpublic final void yyreset(Reader reader)
reader - the new input streampublic final int yystate()
public final void yybegin(int newState)
newState - the new lexical statepublic final String yytext()
public final char yycharat(int pos)
pos - the position of the character to fetch.
A value from 0 to yylength()-1.public final int yylength()
public void yypushback(int number)
number - the number of characters to be read again.
This number must not be greater than yylength()!public LocToken next() throws IOException
next in interface LexerIOException - if any I/O-Error occursCopyright © 2003–2016 Community Z Tools Project. All rights reserved.