Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class chomps.Parser

java.lang.Object
  |
  +--chomps.Parser

public class Parser
extends java.lang.Object
Parser is the rule parser class for Chompy. The main function is parse(Reader inputReader, String filename).

See Also:
Chompy

Constructor Summary
Parser(Chompy chompy)
          Constructor takes a reference to the Chompy world used to reference for rules.
 
Method Summary
void clearParsed()
          Clears the parsed rule counter and set it to zero.
Chompy getChompy()
           
int getParsed()
          Gets the number of rules successfully parsed.
void parse(java.io.Reader inputReader, java.lang.String filename)
          Parses the given input Reader.
void setAdd(boolean add)
          Sets whether the parser adds rules to the Chompy world as it parses them or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser(Chompy chompy)
Constructor takes a reference to the Chompy world used to reference for rules.
Parameters:
chompy - The chompy world to reference.
Method Detail

getParsed

public int getParsed()
Gets the number of rules successfully parsed. Counted since the last call to getParsed() or clearParsed().
Returns:
The number of rules successfully parsed.
See Also:
clearParsed()

clearParsed

public void clearParsed()
Clears the parsed rule counter and set it to zero.
See Also:
getParsed()

setAdd

public void setAdd(boolean add)
Sets whether the parser adds rules to the Chompy world as it parses them or not.
Parameters:
add - True if the parser adds the rules to the current Chompy world as it parses them.
See Also:
parse(Reader inputReader, String filename)

parse

public void parse(java.io.Reader inputReader,
                  java.lang.String filename)
          throws ParserException
Parses the given input Reader. The inputReader is parsed recursively. The filename is used to compile error messages for the ParserException if it is thrown. The filename should normally be the name of the file passed as the inputReader or a else a description of the inputReader. Rules are added to the current Chompy world if rule adding is true setAdd(boolean add). For details of the parser syntax see the Chomp help file.
Parameters:
inputReader - The Reader to start parsing from.
filename - A description of the Reader.
Throws:
ParserException - If an IO error occurs of an invalid rule is parsed.
See Also:
getParsed(), setAdd(boolean add), clearParsed()

getChompy

public Chompy getChompy()

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD