This class can be used to parse or preprocess any markup or programming language using a finite state machine.
First it is necessary to define each state transition by specifying a regular expression to determine the format of the text to expect, the code to execute when the expected text is found, the next states of the transaction to when the expected text is found or is not found.
FSM program can be loaded from file or string.
Then the state machine parse function starts parsing a given text string by executing the previsouly defined states and transitions.
A simple XML parser is supplied as an example. |