public class TeXParser
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
protected static boolean |
isLoading |
Constructor | Description |
---|---|
TeXParser(boolean isPartial,
java.lang.String parseString,
ArrayOfAtoms aoa,
boolean firstpass) |
Create a new TeXParser in the context of an array.
|
TeXParser(boolean isPartial,
java.lang.String parseString,
ArrayOfAtoms aoa,
boolean firstpass,
boolean space) |
Create a new TeXParser in the context of an array.
|
TeXParser(boolean isPartial,
java.lang.String parseString,
TeXFormula formula) |
Create a new TeXParser
|
TeXParser(boolean isPartial,
java.lang.String parseString,
TeXFormula formula,
boolean firstpass) |
Create a new TeXParser with or without a first pass
|
TeXParser(boolean isPartial,
java.lang.String parseString,
TeXFormula formula,
boolean firstpass,
boolean space) |
Create a new TeXParser which ignores or not the white spaces, it's useful for mbox command
|
TeXParser(java.lang.String parseString,
ArrayOfAtoms aoa,
boolean firstpass) |
Create a new TeXParser in the context of an array.
|
TeXParser(java.lang.String parseString,
TeXFormula formula) |
Create a new TeXParser
|
TeXParser(java.lang.String parseString,
TeXFormula formula,
boolean firstpass) |
Create a new TeXParser with or without a first pass
|
TeXParser(java.lang.String parseString,
TeXFormula formula,
boolean firstpass,
boolean space) |
Create a new TeXParser which ignores or not the white spaces, it's useful for mbox command
|
Modifier and Type | Method | Description |
---|---|---|
void |
addAtom(Atom at) |
Put an atom in the current formula
|
void |
addRow() |
Add a new row when the parser is in array mode
|
Atom |
convertCharacter(char c,
boolean oneChar) |
Convert a character in the corresponding atom in using the file TeXFormulaSettings.xml for non-alphanumeric characters
|
void |
finish() |
|
Atom |
getArgument() |
Get the argument of a command in his atomic format
|
int |
getCol() |
Get the number of the current column
|
java.lang.String |
getDollarGroup(char openclose) |
Get the contents between two delimiters
|
Atom |
getFormulaAtom() |
Get the atom represented by the current formula
|
java.lang.String |
getGroup(char open,
char close) |
Get the contents between two delimiters
|
java.lang.String |
getGroup(java.lang.String open,
java.lang.String close) |
Get the contents between two strings as in \begin{foo}...\end{foo}
|
boolean |
getIsPartial() |
Return true if we get a partial formula
|
Atom |
getLastAtom() |
Get the last atom of the current formula
|
float[] |
getLength() |
|
int |
getLine() |
Get the number of the current line
|
java.lang.String[] |
getOptsArgs(int nbArgs,
int opts) |
Get the arguments ant the options of a command
|
java.lang.String |
getOverArgument() |
|
int |
getPos() |
Return the current position in the parsed string
|
java.lang.String |
getStringFromCurrentPos() |
|
boolean |
isArrayMode() |
Return a boolean indicating if the parser is used to parse an array or not
|
boolean |
isAtLetter() |
Return a boolean indicating if the character @ is considered as a letter or not
|
boolean |
isIgnoreWhiteSpace() |
Return a boolean indicating if the parser must ignore white spaces
|
boolean |
isMathMode() |
Return a boolean indicating if the parser is in math mode
|
boolean |
isValidCharacterInCommand(char ch) |
Test the validity of a character in a command.
|
boolean |
isValidName(java.lang.String com) |
Test the validity of the name of a command.
|
void |
makeAtLetter() |
Indicate if the character @ can be used in the command's name
|
void |
makeAtOther() |
Indicate if the character @ can be used in the command's name
|
void |
parse() |
Parse the input string
|
void |
reset(java.lang.String latex) |
Reset the parser with a new latex expression
|
int |
rewind(int n) |
Rewind the current parsed string
|
void |
setArrayMode(boolean arrayMode) |
public TeXParser(java.lang.String parseString, TeXFormula formula)
parseString
- the string to be parsedformula
- the formula where to put the atomsParseException
- if the string could not be parsed correctlypublic TeXParser(boolean isPartial, java.lang.String parseString, TeXFormula formula)
isPartial
- if true certains exceptions are not thrownparseString
- the string to be parsedformula
- the formula where to put the atomsParseException
- if the string could not be parsed correctlypublic TeXParser(boolean isPartial, java.lang.String parseString, TeXFormula formula, boolean firstpass)
isPartial
- if true certains exceptions are not thrownparseString
- the string to be parsedfirstpass
- a boolean to indicate if the parser must replace the user-defined macros by their contentParseException
- if the string could not be parsed correctlypublic TeXParser(java.lang.String parseString, TeXFormula formula, boolean firstpass)
parseString
- the string to be parsedfirstpass
- a boolean to indicate if the parser must replace the user-defined macros by their contentParseException
- if the string could not be parsed correctlypublic TeXParser(boolean isPartial, java.lang.String parseString, ArrayOfAtoms aoa, boolean firstpass)
isPartial
- if true certains exceptions are not thrownparseString
- the string to be parsedaoa
- an ArrayOfAtoms where to put the elementsfirstpass
- a boolean to indicate if the parser must replace the user-defined macros by their contentParseException
- if the string could not be parsed correctlypublic TeXParser(boolean isPartial, java.lang.String parseString, ArrayOfAtoms aoa, boolean firstpass, boolean space)
isPartial
- if true certains exceptions are not thrownparseString
- the string to be parsedaoa
- an ArrayOfAtoms where to put the elementsfirstpass
- a boolean to indicate if the parser must replace the user-defined macros by their contentParseException
- if the string could not be parsed correctlypublic TeXParser(java.lang.String parseString, ArrayOfAtoms aoa, boolean firstpass)
parseString
- the string to be parsedaoa
- an ArrayOfAtoms where to put the elementsfirstpass
- a boolean to indicate if the parser must replace the user-defined macros by their contentParseException
- if the string could not be parsed correctlypublic TeXParser(boolean isPartial, java.lang.String parseString, TeXFormula formula, boolean firstpass, boolean space)
isPartial
- if true certains exceptions are not thrownparseString
- the string to be parsedfirstpass
- a boolean to indicate if the parser must replace the user-defined macros by their contentspace
- a boolean to indicate if the parser must ignore or not the white spaceParseException
- if the string could not be parsed correctlypublic TeXParser(java.lang.String parseString, TeXFormula formula, boolean firstpass, boolean space)
parseString
- the string to be parsedfirstpass
- a boolean to indicate if the parser must replace the user-defined macros by their contentspace
- a boolean to indicate if the parser must ignore or not the white spaceParseException
- if the string could not be parsed correctlypublic void reset(java.lang.String latex)
public boolean getIsPartial()
public int getLine()
public int getCol()
public Atom getLastAtom()
public Atom getFormulaAtom()
public void addAtom(Atom at)
public void makeAtLetter()
public void makeAtOther()
public boolean isAtLetter()
public boolean isArrayMode()
public void setArrayMode(boolean arrayMode)
public boolean isIgnoreWhiteSpace()
public boolean isMathMode()
public int getPos()
public int rewind(int n)
n
- the number of character to be rewindedpublic java.lang.String getStringFromCurrentPos()
public void finish()
public void addRow() throws ParseException
ParseException
- if the parser is not in array modepublic void parse() throws ParseException
ParseException
- if an error is encountered during parsingpublic java.lang.String getDollarGroup(char openclose) throws ParseException
openclose
- the opening and closing character (such $)ParseException
- if the contents are badly enclosedpublic java.lang.String getGroup(char open, char close) throws ParseException
open
- the opening characterclose
- the closing characterParseException
- if the contents are badly enclosedpublic java.lang.String getGroup(java.lang.String open, java.lang.String close) throws ParseException
open
- the opening stringclose
- the closing stringParseException
- if the contents are badly enclosedpublic Atom getArgument() throws ParseException
ParseException
- if the argument is incorrectpublic java.lang.String getOverArgument() throws ParseException
ParseException
public float[] getLength() throws ParseException
ParseException
public Atom convertCharacter(char c, boolean oneChar) throws ParseException
c
- the character to be convertedParseException
- if the character is unknownpublic java.lang.String[] getOptsArgs(int nbArgs, int opts)
nbArgs
- the number of arguments of the commandopts
- must be 1 if the options are found before the first argument and must be 2 if they must be found before the second argumentpublic final boolean isValidName(java.lang.String com)
com
- the command's namepublic final boolean isValidCharacterInCommand(char ch)
com
- the command's name