org.ablaf.internal.lexer
Class AbstractLexerSource

java.lang.Object
  extended byorg.ablaf.internal.lexer.AbstractLexerSource
All Implemented Interfaces:
ILexerSource
Direct Known Subclasses:
ReaderLexerSource

public abstract class AbstractLexerSource
extends java.lang.Object
implements ILexerSource

An abstract implementation of an ILexerSource.

Version:
$Revision: 1.7 $
Author:
jpetersen

Constructor Summary
protected AbstractLexerSource(java.lang.String sourceName)
           
 
Method Summary
 char getLastRead()
           
 int getLine()
           
 int getOffset()
          Return the count of read characters.
 java.lang.String getSourceName()
          Return the name of the source.
protected abstract  char internalRead()
           
 char read()
          Returns the next char.
 void unread()
          Unread the last read char.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLexerSource

protected AbstractLexerSource(java.lang.String sourceName)
Method Detail

internalRead

protected abstract char internalRead()

read

public char read()
Description copied from interface: ILexerSource
Returns the next char.

Specified by:
read in interface ILexerSource
Returns:
the next char.
See Also:
ILexerSource.read()

unread

public void unread()
Description copied from interface: ILexerSource
Unread the last read char.

Specified by:
unread in interface ILexerSource
See Also:
ILexerSource.unread()

getOffset

public int getOffset()
Description copied from interface: ILexerSource
Return the count of read characters.

Specified by:
getOffset in interface ILexerSource
Returns:
the count of read characters.
See Also:
ILexerSource.getOffset()

getSourceName

public java.lang.String getSourceName()
Description copied from interface: ILexerSource
Return the name of the source. For example this method can return the name of the file from which is readed.

Specified by:
getSourceName in interface ILexerSource
Returns:
the name of the source.
See Also:
ILexerSource.getSourceName()

getLastRead

public char getLastRead()
Specified by:
getLastRead in interface ILexerSource
Returns:
the last char returned by read()

getLine

public int getLine()
Specified by:
getLine in interface ILexerSource
Returns:
the current line number


Copyright © 2002 Jan Arne Petersen. All Rights Reserved.