Class GenericQuoteState
- java.lang.Object
-
- org.pipservices3.expressions.tokenizers.generic.GenericQuoteState
-
- All Implemented Interfaces:
IQuoteState,ITokenizerState
public class GenericQuoteState extends Object implements IQuoteState
A quoteState returns a quoted string token from a scanner. 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, thennextToken()will search for another double-quote until it finds one or finds the end of the scanner.
-
-
Constructor Summary
Constructors Constructor Description GenericQuoteState()
-
Method Summary
Modifier and Type Method Description StringdecodeString(String value, int quoteSymbol)Decodes a string value.StringencodeString(String value, int quoteSymbol)Encodes a string value.TokennextToken(IScanner scanner, ITokenizer tokenizer)Return a quoted string token from a scanner.
-
-
-
Method Detail
-
nextToken
public Token nextToken(IScanner scanner, ITokenizer tokenizer)
Return 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.- Specified by:
nextTokenin interfaceITokenizerState- Parameters:
scanner- A textual string to be tokenized.tokenizer- A tokenizer class that controls the process.- Returns:
- The next token from the top of the stream.
-
encodeString
public String encodeString(String value, int quoteSymbol)
Encodes a string value.- Specified by:
encodeStringin interfaceIQuoteState- Parameters:
value- A string value to be encoded.quoteSymbol- A string quote character.- Returns:
- An encoded string.
-
decodeString
public String decodeString(String value, int quoteSymbol)
Decodes a string value.- Specified by:
decodeStringin interfaceIQuoteState- Parameters:
value- A string value to be decoded.quoteSymbol- A string quote character.- Returns:
- A decoded string.
-
-