GenericQuoteState

A quoteState returns a quoted string token from a scanner.

Implements: IQuoteState

Description

The GenericQuoteState allows you to create a quoteState that returns a quoted string token from a scanner.

Important points

  • This state will collect characters until it sees a match to the character that the tokenizer used to switch to this state.
  • For example, if a tokenizer uses a double-quote character to enter this state, then nextToken() will search for another double-quote until it finds one or finds the end of the scanner.

Instance methods

decodeString

Decodes a string value.

public String decodeString(String value, int quoteSymbol)

  • value: String - string value to be decoded.
  • quoteSymbol: int - string quote character.
  • returns: String - decoded string.

encodeString

Encodes a string value.

public String encodeString(String value, int quoteSymbol)

  • value: String - string value to be encoded.
  • quoteSymbol: int - string quote character.
  • returns: String - encoded string.

nextToken

Returns a quoted string token from a scanner. This method will collect characters until it sees a match to the character that the tokenizer used to switch to this state.

public Token nextToken(IScanner scanner, ITokenizer tokenizer)

  • scanner: IScanner - text string to be tokenized.
  • tokenizer: ITokenizer - tokenizer class that controls the process.
  • returns: Token - next token from the top of the stream.