lapis
Interface Parser

All Known Implementing Classes:
CharacterParser, CParser, ExternalParser, HTMLParser, JavaParser, LexicalAttractionParser, ListParser, SpellingParser, SystemParser, TC, XMLParser

public interface Parser

A Parser binds patterns to names in a PatternLibrary. The actual parsing of a document should be done behind the scenes when one of those patterns is matched against a document.


Method Summary
 void bind(PatternLibrary lib)
          Bind the parser's patterns into the library.
 void bind(PatternLibrary lib, Document doc)
          Bind document-specific patterns into a document-specific library.
 

Method Detail

bind

public void bind(PatternLibrary lib)
Bind the parser's patterns into the library. This method is called by PatternLibrary when the parser is added to the library.

Parameters:
lib - Library in which patterns should be bound
Effects:
Parsers should implement this by calling PatternLibrary.put() to add each of their patterns to the library.

bind

public void bind(PatternLibrary lib,
                 Document doc)
Bind document-specific patterns into a document-specific library. This method is called by PatternLibrary when getDocumentLibrary makes a document-specific library for a new document.

Parameters:
lib - Document-specific library
doc - Document to which library pertains
Effects:
Parsers that have document-specific patterns should examine the document and add the appropriate patterns to the library. Parsers that don't have document-specific patterns should do nothing.