|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.scilab.forge.jlatexmath.TeXParser
public class TeXParser
This class implements a parser for LaTeX' formulas.
Field Summary | |
---|---|
protected boolean |
hasStyleChanged
|
Constructor Summary | |
---|---|
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 |
Method Summary | |
---|---|
void |
addRow()
Add a new row when the parser is in array mode |
Atom |
convertCharacter(char c)
Convert a character in the corresponding atom in using the file TeXFormulaSettings.xml for non-alphanumeric characters |
Atom |
getArgument()
Get the argument of a command in his atomic format |
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} |
Atom |
getLastAtom()
Get the last atom of the current formula |
java.lang.String[] |
getOptsArgs(int nbArgs,
int opts)
Get the arguments ant the options of a command |
int |
getPos()
Return the current position in the parsed string |
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 |
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 |
int |
rewind(int n)
Rewind the current parsed string |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean hasStyleChanged
Constructor Detail |
---|
public TeXParser(java.lang.String parseString, TeXFormula formula)
parseString
- the string to be parsedformula
- the formula where to put the atoms
ParseException
- 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 content
ParseException
- 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 content
ParseException
- 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 space
ParseException
- if the string could not be parsed correctlyMethod Detail |
---|
public Atom getLastAtom()
public void makeAtLetter()
public void makeAtOther()
public boolean isAtLetter()
public boolean isArrayMode()
public int getPos()
public int rewind(int n)
n
- the number of character to be rewinded
public void addRow() throws ParseException
ParseException
- if the parser is not in array modepublic void parse() throws ParseException
ParseException
- if ann error is encountered during parsingpublic java.lang.String getGroup(char open, char close) throws ParseException
open
- the opening characterclose
- the closing character
ParseException
- 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 string
ParseException
- if the contents are badly enclosedpublic Atom getArgument() throws ParseException
ParseException
- if the argument is incorrectpublic Atom convertCharacter(char c) throws ParseException
c
- the character to be converted
ParseException
- 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 argument
public boolean isValidName(java.lang.String com)
com
- the command's name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |