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

lolo.scans
Class QuotedText

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

public class QuotedText
extends Scan

A class to scan for quoted text. The quoted text can span more then one line.

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  char[] help
          Used the collect the unescaped scanned characters.
protected  boolean inside
          Marks if the recognition is after the quote character.
protected  char last
          Holds the last scanned character.
protected  char quote
          The quote character.
 
Fields inherited from class lolo.scans.Scan
reset, stateObject
 
Fields inherited from class lolo.Scan
action, ignore
 
Constructor Summary
QuotedText()
          Just calls this('"').
QuotedText(char quote)
          Constructs a recognizer who uses quote as the quote 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

inside

protected transient boolean inside
Marks if the recognition is after the quote character.

quote

protected final char quote
The quote character.

last

protected transient char last
Holds the last scanned character. Used to handle escaped characters.

help

protected transient char[] help
Used the collect the unescaped scanned characters.
Constructor Detail

QuotedText

public QuotedText()
Just calls this('"').

QuotedText

public QuotedText(char quote)
Constructs a recognizer who uses quote as the quote character.
Parameters:
quote - the quote 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 QuotedText and uses the same quotre 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)