de.zeigermann.xpa.tokenParser
Class XMLFragmentDrivenTokenStream

java.lang.Object
  |
  +--de.zeigermann.xpa.tokenParser.Parser2XMLTokenStreamAdapter
        |
        +--de.zeigermann.xpa.tokenParser.XMLFragmentDrivenTokenStream
All Implemented Interfaces:
TokenStream

public class XMLFragmentDrivenTokenStream
extends Parser2XMLTokenStreamAdapter

This class is a token stream parser driven by an XMLFragmentParser. A token queue is used to buffer tokens.


Field Summary
 
Fields inherited from class de.zeigermann.xpa.tokenParser.Parser2XMLTokenStreamAdapter
tokenManager
 
Constructor Summary
XMLFragmentDrivenTokenStream(XMLTokenTypeManager tokenManager, InputStream in)
          Creates a new token stream parser with an input buffer as input.
XMLFragmentDrivenTokenStream(XMLTokenTypeManager tokenManager, Reader in)
          Creates a new token stream parser with a reader as input.
XMLFragmentDrivenTokenStream(XMLTokenTypeManager tokenManager, XMLFragmentParser parser)
          Creates a new token stream parser from a fully initialized XMLFragmentParser.
 
Method Summary
protected  void applyLocatorInfo(Token token)
          Does nothing, as no info is available, yet.
 Token nextToken()
          Gets next token from token queue if available.
protected  void setNextToken(Token token)
          Adds token to internal queue for later delivery by nextToken().
 
Methods inherited from class de.zeigermann.xpa.tokenParser.Parser2XMLTokenStreamAdapter
getIgnoreAllWhiteSpace, getTreatValidWhiteSpaceAsIgnorable, setIgnoreAllWhiteSpace, setTreatValidWhiteSpaceAsIgnorable, tellEndDocument, tellEndElement, tellPCDATA, tellStartElement, tellWhiteSpace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLFragmentDrivenTokenStream

public XMLFragmentDrivenTokenStream(XMLTokenTypeManager tokenManager,
                                    XMLFragmentParser parser)
Creates a new token stream parser from a fully initialized XMLFragmentParser.

Parameters:
tokenManager - the token manager to determine token types for token
parser - the parser feeding this token stream

XMLFragmentDrivenTokenStream

public XMLFragmentDrivenTokenStream(XMLTokenTypeManager tokenManager,
                                    Reader in)
Creates a new token stream parser with a reader as input.

Parameters:
tokenManager - the token manager to determine token types for token
in - the reader to parse XML from

XMLFragmentDrivenTokenStream

public XMLFragmentDrivenTokenStream(XMLTokenTypeManager tokenManager,
                                    InputStream in)
Creates a new token stream parser with an input buffer as input.

Parameters:
tokenManager - the token manager to determine token types for token
in - the input buffer to parse XML from
Method Detail

nextToken

public Token nextToken()
                throws TokenStreamException
Gets next token from token queue if available. If not try to pull a new one from XMLFragmentParser. Finally, return EOF token.

Specified by:
nextToken in interface TokenStream
Specified by:
nextToken in class Parser2XMLTokenStreamAdapter
Returns:
token generated by parser that feeds this adapter
TokenStreamException
See Also:
Parser2XMLTokenStreamAdapter.setNextToken(antlr.Token)

applyLocatorInfo

protected void applyLocatorInfo(Token token)
Does nothing, as no info is available, yet.

Specified by:
applyLocatorInfo in class Parser2XMLTokenStreamAdapter

setNextToken

protected void setNextToken(Token token)
Adds token to internal queue for later delivery by nextToken(). Queue is needed as some callbacks from XMLFragmentParser generate more than one token.

Specified by:
setNextToken in class Parser2XMLTokenStreamAdapter
See Also:
Parser2XMLTokenStreamAdapter.nextToken()


Copyright 1999-2003 Oliver Zeigermann. All Rights Reserved.