Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jpicedt.graphic.io.parser
Class DefaultParser  view DefaultParser download DefaultParser.java

java.lang.Object
  extended byjpicedt.graphic.io.parser.AbstractRegularExpression
      extended byjpicedt.graphic.io.parser.SequenceExpression
          extended byjpicedt.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,...


Field Summary
private  Context context
           
private  AlternateExpression headExp
           
private  Pool pool
           
 
Fields inherited from class jpicedt.graphic.io.parser.SequenceExpression
 
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 ...
 
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(java.lang.String[] arg)
          parser standalone test
 jpicedt.graphic.model.Drawing parse(java.io.Reader reader)
          kicks off the parsing process
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class jpicedt.graphic.io.parser.SequenceExpression
add, interpret
 
Methods inherited from class jpicedt.graphic.io.parser.AbstractRegularExpression
action
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pool

private Pool pool

context

private Context context

headExp

private AlternateExpression headExp
Constructor Detail

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...) ->

Method Detail

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