to.etc.lexer
Class ReaderScannerBase

java.lang.Object
  extended by to.etc.lexer.TextReaderBase
      extended by to.etc.lexer.ReaderScannerBase
Direct Known Subclasses:
ReaderTokenizerBase, TextTokenizerBase

public class ReaderScannerBase
extends TextReaderBase


Field Summary
static int T_BASE_LAST
           
static int T_COMMENT
           
static int T_EOF
           
static int T_IDENT
           
static int T_IPADDR
           
static int T_NUMBER
           
static int T_STRING
           
 
Constructor Summary
ReaderScannerBase(java.lang.Object source, java.io.Reader r)
           
 
Method Summary
 void error(java.lang.String msg)
           
 SourceLocation getSourceLocation()
           
 int getTokenColumn()
           
 int getTokenLine()
           
 boolean isAllowNewlineInString()
           
protected  boolean isIdChar(char c)
           
protected  boolean isIdStart(char c)
           
protected  int scanIdentifier()
           
protected  int scanNumber()
           
protected  void scanSimpleString(boolean keepquotes)
          Scans a very simple string: something starting with something, terminating with the same something and not allowing anything ugly in between.
 void setAllowNewlineInString(boolean allowNewlineInString)
           
protected  void skipWs()
          Skips whitespace until current character is either EOF or non-ws.
protected  void skipWsNoNL()
          Skips whitespace until current character is either EOF or non-ws.
 void startToken()
          Called when a new token retrieve is started.
 
Methods inherited from class to.etc.lexer.TextReaderBase
accept, accept, append, append, clearCopy, copy, copy, getCopied, getCurrentColumn, getCurrentLine, getSource, LA, LA, sb
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

T_EOF

public static final int T_EOF
See Also:
Constant Field Values

T_STRING

public static final int T_STRING
See Also:
Constant Field Values

T_NUMBER

public static final int T_NUMBER
See Also:
Constant Field Values

T_IPADDR

public static final int T_IPADDR
See Also:
Constant Field Values

T_IDENT

public static final int T_IDENT
See Also:
Constant Field Values

T_COMMENT

public static final int T_COMMENT
See Also:
Constant Field Values

T_BASE_LAST

public static final int T_BASE_LAST
See Also:
Constant Field Values
Constructor Detail

ReaderScannerBase

public ReaderScannerBase(java.lang.Object source,
                         java.io.Reader r)
Method Detail

isAllowNewlineInString

public boolean isAllowNewlineInString()

setAllowNewlineInString

public void setAllowNewlineInString(boolean allowNewlineInString)

getTokenLine

public int getTokenLine()

getTokenColumn

public int getTokenColumn()

getSourceLocation

public SourceLocation getSourceLocation()

error

public void error(java.lang.String msg)
           throws SourceErrorException
Throws:
SourceErrorException

skipWs

protected void skipWs()
               throws java.io.IOException
Skips whitespace until current character is either EOF or non-ws.

Throws:
java.io.IOException

skipWsNoNL

protected void skipWsNoNL()
                   throws java.io.IOException
Skips whitespace until current character is either EOF or non-ws.

Throws:
java.io.IOException

scanSimpleString

protected void scanSimpleString(boolean keepquotes)
                         throws java.io.IOException,
                                SourceErrorException
Scans a very simple string: something starting with something, terminating with the same something and not allowing anything ugly in between.

Throws:
java.io.IOException
SourceErrorException

scanNumber

protected int scanNumber()
                  throws java.io.IOException
Throws:
java.io.IOException

scanIdentifier

protected int scanIdentifier()
                      throws java.io.IOException
Throws:
java.io.IOException

isIdStart

protected boolean isIdStart(char c)

isIdChar

protected boolean isIdChar(char c)

startToken

public void startToken()
Called when a new token retrieve is started. This saves the current position within the file as the start location for the token and resets the token collection buffer.