java.lang.Object
jpicedt.graphic.io.parser.AbstractRegularExpression
jpicedt.graphic.io.parser.SequenceExpression
jpicedt.graphic.io.parser.DefaultParser
- All Implemented Interfaces:
- ExpressionConstants, Parser
- public class DefaultParser
- extends SequenceExpression
- implements ExpressionConstants, Parser
Default implementation of the parser interface [pending : create 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, epic,...
Fields inherited from interface jpicedt.graphic.io.parser.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 build grammar rules ;
Tree structure = (WhiteSpaceOrEOL & (headExp | notParsable))*
where : headExp = Root1 | Root2 | Root3 ... |
pool
private Pool pool
context
private Context context
headExp
private AlternateExpression headExp
DefaultParser
public DefaultParser()
- Creates a new DefaultParser, and build grammar rules ;
Tree structure = (WhiteSpaceOrEOL & (headExp | notParsable))*
where : headExp = Root1 | Root2 | Root3 ... (each sub-tree representing a particular format.
[pending] with the current structure, sub-trees must NOT be mutually exclusive, i.e. 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...) ->
addGrammar
public void addGrammar(RootExpression root)
- Add a new sub-tree to this parser
getPool
public Pool getPool()
- Return the pool containing variables shared across the grammar tree
parse
public jpicedt.graphic.model.Drawing parse(java.io.Reader reader)
throws ParserException
- kicks off the parsing process
- Specified by:
parse
in interface Parser
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object
- Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string
concatenation with this object. If the result is
null
, string concatenation will instead
use "null"
.
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode())
.
- Overrides:
toString
in class SequenceExpression
main
public static void main(java.lang.String[] arg)
- parser standalone test