notio
Interface Parser

All Known Implementing Classes:
LFParser, CGIFParser

public interface Parser

The required interface for all parsers. All parsers should implement this interface to facilitate pluggability. While a parser must implement the entire interface, it can opt to throw an UnimplementedFeature exception if it does not support parsing of a particular nonterminal. Minimally, a parser should support the Unit nonterminal.

See Also:
UnimplementedFeatureException

Method Summary
 java.lang.Class getUnitClass()
          Returns a Class object that indicates what class the parseUnit() method will return.
 void initializeParser(java.io.Reader reader, KnowledgeBase kBase, TranslationContext tContext)
          Initializes the parser to parse the specified character reader.
 Actor parseActor()
          Attempts to parse an actor from the input stream.
 java.util.Vector parseCGStream()
          Attempts to parse a CGStream from the input stream.
 Concept parseConcept()
          Attempts to parse a concept from the input stream.
 Graph parseGraph()
          Attempts to parse a graph from the input stream.
 Graph parseOutermostContext()
          Attempts to parse a graph which is treated as the outermost context for purposes for scoping.
 Relation parseRelation()
          Attempts to parse a relation from the input stream.
 java.lang.Object parseUnit()
          Attempts to parse the default unit from the input stream.
 

Method Detail

initializeParser

public void initializeParser(java.io.Reader reader,
                             KnowledgeBase kBase,
                             TranslationContext tContext)
                      throws ParserException
Initializes the parser to parse the specified character reader.
Parameters:
reader - the reader whose contents are to be parsed.
kBase - the knowledge base to be used while parsing.
tContext - the translation context to be used while parsing.
Throws:
ParserException - if an error occurs while initializing the parser.

getUnitClass

public java.lang.Class getUnitClass()
Returns a Class object that indicates what class the parseUnit() method will return.
Returns:
a Class object that indicates what class the parseUnit() method will return.
See Also:
parseUnit()

parseUnit

public java.lang.Object parseUnit()
                           throws ParserException
Attempts to parse the default unit from the input stream. The default unit is whatever a particular parser is usually intended to parse.
Returns:
the unit object parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.

parseOutermostContext

public Graph parseOutermostContext()
                            throws ParserException
Attempts to parse a graph which is treated as the outermost context for purposes for scoping. This method should be used instead of parseGraph() when no translation information is to be used from previous translation sessions and when the parser can safely assume that the graph is "self-contained".
Returns:
the graph parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.
UnimplementedFeatureException - if this parser does not support this parsing method.

parseCGStream

public java.util.Vector parseCGStream()
                               throws ParserException
Attempts to parse a CGStream from the input stream.
Returns:
a vector of graphs parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.
UnimplementedFeatureException - if this parser does not support this parsing method.

parseGraph

public Graph parseGraph()
                 throws ParserException
Attempts to parse a graph from the input stream.
Returns:
the graph parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.
UnimplementedFeatureException - if this parser does not support this parsing method.

parseConcept

public Concept parseConcept()
                     throws ParserException
Attempts to parse a concept from the input stream.
Returns:
the concept parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.
UnimplementedFeatureException - if this parser does not support this parsing method.

parseRelation

public Relation parseRelation()
                       throws ParserException
Attempts to parse a relation from the input stream.
Returns:
the relation parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.
UnimplementedFeatureException - if this parser does not support this parsing method.

parseActor

public Actor parseActor()
                 throws ParserException
Attempts to parse an actor from the input stream.
Returns:
the actor parsed from the input stream.
Throws:
ParserException - if an error occurs while parsing.
UnimplementedFeatureException - if this parser does not support this parsing method.


Copyright 1998-2001 Finnegan Southey