Package ca.phon.xml
Class XMLLexer
java.lang.Object
ca.phon.xml.XMLLexer
- All Implemented Interfaces:
org.antlr.runtime.TokenSource
ANTLR3 lexer for XML files using the
StAX API (XMLEventReader
) to
pull tokens from the xml stream.
Tokens are emitted on the following xml events:
Token numbers can be assigned using a properties file. If no file is given or the generated token name is not found, the token ID is given ....
TODO Handle namespaces-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic XMLLexer
fromStream
(InputStream source, String encoding) Create a new lexer for the given stream.static XMLLexer
fromStream
(InputStream source, String encoding, Properties tokenMap) Create a new lexer for the given stream.org.antlr.runtime.Token
protected int
Get the token ID for the given token name.protected String
Turn the givenQName
into a ANTLR token name.
-
Constructor Details
-
XMLLexer
Constructor- Parameters:
reader
-
-
-
Method Details
-
fromStream
Create a new lexer for the given stream.- Parameters:
source
-- Throws:
IOException
-
fromStream
public static XMLLexer fromStream(InputStream source, String encoding, Properties tokenMap) throws IOException Create a new lexer for the given stream. Also provide a token map, can benull
.- Parameters:
tokenMap
-stream
-- Throws:
IOException
-
tokenName
Turn the givenQName
into a ANTLR token name.- Parameters:
qname
-- Returns:
- the generated token name
-
tokenID
Get the token ID for the given token name.- Parameters:
tokenName
-- Returns:
- the token ID, if not found in the tokenMap it will be generated.
-
nextToken
public org.antlr.runtime.Token nextToken()- Specified by:
nextToken
in interfaceorg.antlr.runtime.TokenSource
-
getSourceName
- Specified by:
getSourceName
in interfaceorg.antlr.runtime.TokenSource
-