|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjpicedt.format.input.util.AbstractRegularExpression
jpicedt.format.input.util.SequenceExpression
jpicedt.format.input.DefaultParser
public class DefaultParser
Default implementation of the Parser interface.
This expression doesn't contains rules in itself. On the contrary, it simply lumps sub-trees together, each sub-tree containing grammar rules for a particular format, e.g. PsTricks, eepic,...
Basically, this parser hold data using three objects :
[Developpers] for those willing to add their own parser to the tree, simply write a new parser-tree whose
root expression inherits from
RootExpression
,
then add it to this parser by using the
addGrammar
method.
Field Summary | |
---|---|
protected Context |
context
holds information about the current parser state |
protected AlternateExpression |
headExp
holds a reference to each supported grammar |
protected Pool |
pool
a pool of primitive types and objects that may be shared by sub-expressions |
Fields inherited from interface jpicedt.format.input.util.ExpressionConstants |
---|
ANY_CHAR, ANY_CHAR_EOL, ANY_SIGN, AT_LEAST, AT_MOST, DEBUG, DOUBLE, EOL, EXACTLY, INTEGER, NEGATIVE, NON_NULL, POSITIVE, STRICTLY_NEGATIVE, STRICTLY_POSITIVE, WHITE_SPACES, WHITE_SPACES_OR_EOL |
Constructor Summary | |
---|---|
DefaultParser()
Creates a new DefaultParser, and attach some grammar rules to it. Tree structure = (WhiteSpaceOrEOL & (headExp | notParsable))* where : headExp = Root1 | Root2 | Root3 ... |
Method Summary | |
---|---|
void |
addGrammar(RootExpression root)
Add a new sub-tree to this parser |
Pool |
getPool()
Return the pool containing variables shared across the grammar tree |
static void |
main(String[] arg)
parser standalone test |
Drawing |
parse(Reader reader)
kicks off the parsing process |
String |
toString()
|
Methods inherited from class jpicedt.format.input.util.SequenceExpression |
---|
add, interpret |
Methods inherited from class jpicedt.format.input.util.AbstractRegularExpression |
---|
action |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Pool pool
protected Context context
protected AlternateExpression headExp
Constructor Detail |
---|
public DefaultParser()
Note that with this current structure, sub-trees must NOT be mutually exclusive, ie it's ok with eepic and pstricks for instance (it wouldn't work with PDF and LaTeX, since once we've started with PDF, it wouldn't make sense trying to parse LaTeX commands...) ->
Method Detail |
---|
public void addGrammar(RootExpression root)
public Pool getPool()
public Drawing parse(Reader reader) throws REParserException
parse
in interface Parser
REParserException
public String toString()
toString
in class SequenceExpression
public static void main(String[] arg)
arg[0]
- name of file to parse.
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |