org.apache.torque.engine.sql
Class SQLScanner

java.lang.Object
  extended by org.apache.torque.engine.sql.SQLScanner

public class SQLScanner
extends Object

A simple Scanner implementation that scans an sql file into usable tokens. Used by SQLToAppData.

Version:
$Id: SQLScanner.java,v 1.1 2007-10-21 07:57:27 abyrne Exp $
Author:
Leon Messerschmidt, Jon S. Stevens, Andreas Andreou

Field Summary
private static String ALFA
          alphabetic characters
private static String ALFANUM
          alphanumeric
private  int chr
          character
private  int col
          column
private static char COMMENT_DASH
          comment
private static char COMMENT_POUND
          comment
private static char COMMENT_SLASH
          comment
private static char COMMENT_STAR
          comment
private  Reader in
          the input reader
private  int line
          line
private static String NUMER
          numbers
private static String SPECIAL
          special characters
private  String token
          token
private  List tokens
          list of tokens
private static String WHITE
          white spaces
 
Constructor Summary
SQLScanner()
          Creates a new scanner with no Reader
SQLScanner(Reader input)
          Creates a new scanner with an Input Reader
 
Method Summary
private  void readChar()
          Reads the next character and increments the line and column counters.
 List scan()
          Scan the input Reader and returns a list of tokens.
private  void scanIdentifier()
          Scans an identifier.
private  void scanNegativeIdentifier()
          Scans an identifier which had started with the negative sign.
 void setInput(Reader input)
          Set the Input
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHITE

private static final String WHITE
white spaces

See Also:
Constant Field Values

ALFA

private static final String ALFA
alphabetic characters

See Also:
Constant Field Values

NUMER

private static final String NUMER
numbers

See Also:
Constant Field Values

ALFANUM

private static final String ALFANUM
alphanumeric

See Also:
Constant Field Values

SPECIAL

private static final String SPECIAL
special characters

See Also:
Constant Field Values

COMMENT_POUND

private static final char COMMENT_POUND
comment

See Also:
Constant Field Values

COMMENT_SLASH

private static final char COMMENT_SLASH
comment

See Also:
Constant Field Values

COMMENT_STAR

private static final char COMMENT_STAR
comment

See Also:
Constant Field Values

COMMENT_DASH

private static final char COMMENT_DASH
comment

See Also:
Constant Field Values

in

private Reader in
the input reader


chr

private int chr
character


token

private String token
token


tokens

private List tokens
list of tokens


line

private int line
line


col

private int col
column

Constructor Detail

SQLScanner

public SQLScanner()
Creates a new scanner with no Reader


SQLScanner

public SQLScanner(Reader input)
Creates a new scanner with an Input Reader

Parameters:
input - the input reader
Method Detail

setInput

public void setInput(Reader input)
Set the Input

Parameters:
input - the input reader

readChar

private void readChar()
               throws IOException
Reads the next character and increments the line and column counters.

Throws:
IOException - If an I/O error occurs

scanIdentifier

private void scanIdentifier()
                     throws IOException
Scans an identifier.

Throws:
IOException - If an I/O error occurs

scanNegativeIdentifier

private void scanNegativeIdentifier()
                             throws IOException
Scans an identifier which had started with the negative sign.

Throws:
IOException - If an I/O error occurs

scan

public List scan()
          throws IOException
Scan the input Reader and returns a list of tokens.

Returns:
a list of tokens
Throws:
IOException - If an I/O error occurs


Copyright © 2007-2011 The Kuali Foundation. All Rights Reserved.