de.odysseus.el.tree.impl
Class Scanner

java.lang.Object
  extended by de.odysseus.el.tree.impl.Scanner

public class Scanner
extends java.lang.Object

Handcrafted scanner.

Author:
Christoph Beck

Nested Class Summary
static class Scanner.ExtensionToken
           
static class Scanner.ScanException
          Scan exception type
static class Scanner.Symbol
          Symbol type
static class Scanner.Token
           
 
Field Summary
protected  java.lang.StringBuilder builder
           
 
Constructor Summary
protected Scanner(java.lang.String input)
          Constructor.
 
Method Summary
protected  Scanner.Token fixed(Scanner.Symbol symbol)
           
 java.lang.String getInput()
           
 int getPosition()
           
 Scanner.Token getToken()
           
protected  boolean isDigit(char c)
           
protected  boolean isEval()
           
protected  Scanner.Token keyword(java.lang.String s)
           
 Scanner.Token next()
          Scan next token.
protected  Scanner.Token nextEval()
          token inside an eval expression
protected  Scanner.Token nextNumber()
          number token
protected  Scanner.Token nextString()
          string token
protected  Scanner.Token nextText()
          text token
protected  Scanner.Token nextToken()
           
protected  Scanner.Token token(Scanner.Symbol symbol, java.lang.String value, int length)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

builder

protected final java.lang.StringBuilder builder
Constructor Detail

Scanner

protected Scanner(java.lang.String input)
Constructor.

Parameters:
input - expression string
Method Detail

getInput

public java.lang.String getInput()

getToken

public Scanner.Token getToken()
Returns:
current token

getPosition

public int getPosition()
Returns:
current input position

isDigit

protected boolean isDigit(char c)
Returns:
true iff the specified character is a digit

keyword

protected Scanner.Token keyword(java.lang.String s)
Parameters:
s - name
Returns:
token for the given keyword or null

fixed

protected Scanner.Token fixed(Scanner.Symbol symbol)
Parameters:
symbol -
Returns:
token for the given symbol

token

protected Scanner.Token token(Scanner.Symbol symbol,
                              java.lang.String value,
                              int length)

isEval

protected boolean isEval()

nextText

protected Scanner.Token nextText()
                          throws Scanner.ScanException
text token

Throws:
Scanner.ScanException

nextString

protected Scanner.Token nextString()
                            throws Scanner.ScanException
string token

Throws:
Scanner.ScanException

nextNumber

protected Scanner.Token nextNumber()
                            throws Scanner.ScanException
number token

Throws:
Scanner.ScanException

nextEval

protected Scanner.Token nextEval()
                          throws Scanner.ScanException
token inside an eval expression

Throws:
Scanner.ScanException

nextToken

protected Scanner.Token nextToken()
                           throws Scanner.ScanException
Throws:
Scanner.ScanException

next

public Scanner.Token next()
                   throws Scanner.ScanException
Scan next token. After calling this method, getToken() and getPosition() can be used to retreive the token's image and input position.

Returns:
scanned token
Throws:
Scanner.ScanException

Copyright © 2006-2009 Odysseus Software GmbH.