Send bugs or comments to Bernd Kühl (bernd@informatik.uni-osnabrueck.de)

lolo.scans
Class QuotedChar

java.lang.Object
  |
  +--lolo.Scan
        |
        +--lolo.scans.Scan
              |
              +--lolo.scans.QuotedChar
All Implemented Interfaces:
java.io.Serializable

public class QuotedChar
extends Scan

A class to scan for one quoted character.

Author:
Bernd Kühl (bernd@informatik.uni-osnabrueck.de)
See Also:
Serialized Form

Inner classes inherited from class lolo.Scan
Scan.Action, Scan.State
 
Field Summary
protected  boolean end
          Marks the current state.
protected  boolean escape
          Is the character escaped?
protected  char[] found
          Holds the unescaped recognized quoted character.
protected  boolean middle
          Marks the current state.
protected  char quote
          The quote character.
protected  boolean start
          Marks the current state.
 
Fields inherited from class lolo.scans.Scan
reset, stateObject
 
Fields inherited from class lolo.Scan
action, ignore
 
Constructor Summary
QuotedChar()
          Just calls this('\'').
QuotedChar(char quote)
          Constructs a recognizer to scan for a quoted character.
 
Method Summary
 void action(char[] buffer, int off, int len)
          If action is not null, then the action method is called for this object.
 boolean equals(java.lang.Object o)
          Indicates whether some other object is "equal to" this one.
protected  char getQuote()
          Returns the quote character.
 int hashCode()
          Returns a hash code value for this object.
 Scan.State nextChar(char ch)
          Called by a Scanner for every new character.
 void reset()
          Resets this instance.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class lolo.Scan
getAction, getIgnore, setAction, setIgnore
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

found

protected final char[] found
Holds the unescaped recognized quoted character.

start

protected transient boolean start
Marks the current state.

middle

protected transient boolean middle
Marks the current state.

end

protected transient boolean end
Marks the current state.

escape

protected transient boolean escape
Is the character escaped?

quote

protected final char quote
The quote character.
Constructor Detail

QuotedChar

public QuotedChar()
Just calls this('\'').

QuotedChar

public QuotedChar(char quote)
Constructs a recognizer to scan for a quoted character. quote is the quote character.
Parameters:
quote - the quoted character.
Method Detail

reset

public void reset()
Description copied from class: Scan
Resets this instance.
Overrides:
reset in class Scan

getQuote

protected char getQuote()
Returns the quote character.
Returns:
the quote character.

nextChar

public Scan.State nextChar(char ch)
Description copied from class: Scan
Called by a Scanner for every new character.
Overrides:
nextChar in class Scan
Following copied from class: lolo.Scan
Returns:
a State object to signal whether more characters are wanted and whether a symbol is found.
See Also:
Scan.State, Scanner

hashCode

public int hashCode()
Returns a hash code value for this object.
Overrides:
hashCode in class Scan
Returns:
a hash code value for this object.

equals

public boolean equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one.
Overrides:
equals in class Scan
Returns:
true the argument is a QuotedChar and uses the same quote character, false otherwise.

action

public void action(char[] buffer,
                   int off,
                   int len)
Description copied from class: Scan
If action is not null, then the action method is called for this object.
Overrides:
action in class Scan
Following copied from class: lolo.Scan
Parameters:
buffer - the character buffer holding the characters of the symbol.
off - offset into the buffer.
len - number of characters for the symbol.
See Also:
Scan.action

toString

public java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class Scan
Returns:
a string representation of the object.

Send bugs or comments to Bernd Kühl (bernd@informatik.uni-osnabrueck.de)