Tokenizer
in package
implements
TokenizerInterface
FinalYes
Convert EDI messages into tokens for parsing.
Table of Contents
Interfaces
- TokenizerInterface
- Convert EDI messages into tokens for parsing.
Properties
- $char : string
- $characters : CharactersInterface
- $isEscaped : bool
- $message : string
- $position : int
- $string : string
Methods
- getTokens() : iterable<string|int, Token>
- Convert the passed message into tokens.
- endOfMessage() : bool
- Check if we've reached the end of the message
- extractStoredChars() : string
- Get the previously stored characters.
- getNextChar() : string
- Get the next character from the message.
- getNextToken() : Token|null
- Get the next token from the message.
- isControlCharacter() : bool
- Check if the current character is a control character.
- readNextChar() : void
- Read the next character from the message.
- storeCurrentCharAndReadNext() : void
- Store the current character and read the next one from the message.
Properties
$char
private
string
$char
= ""
The current character from the message we are dealing with.
$characters
private
CharactersInterface
$characters
The control characters for the message.
$isEscaped
private
bool
$isEscaped
= false
If the current character has been escaped.
$message
private
string
$message
= ""
The message that we are tokenizing.
$position
private
int
$position
= 0
The current position in the message.
$string
private
string
$string
= ""
The stored characters for the next token.
Methods
getTokens()
Convert the passed message into tokens.
public
getTokens(string $message, CharactersInterface $characters) : iterable<string|int, Token>
Parameters
- $message : string
- $characters : CharactersInterface
Tags
Return values
iterable<string|int, Token>endOfMessage()
Check if we've reached the end of the message
private
endOfMessage() : bool
Return values
boolextractStoredChars()
Get the previously stored characters.
private
extractStoredChars() : string
Return values
stringgetNextChar()
Get the next character from the message.
private
getNextChar() : string
Return values
stringgetNextToken()
Get the next token from the message.
private
getNextToken() : Token|null
Tags
Return values
Token|nullisControlCharacter()
Check if the current character is a control character.
private
isControlCharacter() : bool
Return values
boolreadNextChar()
Read the next character from the message.
private
readNextChar() : void
storeCurrentCharAndReadNext()
Store the current character and read the next one from the message.
private
storeCurrentCharAndReadNext() : void