|
Milo
0.1
Milo:EquationManipulationProgram
|
#include <xml.h>
Public Member Functions | |
| FSM () | |
| State | getState () |
| const std::string & | getTag () |
| void | next (State new_state, const std::string &tag=std::string()) |
| bool | finished () |
Private Member Functions | |
| void | advance (State new_state) |
Private Attributes | |
| State | m_state |
| Current state. Initialized to NEW. | |
| std::stack< std::string > | m_tags |
| Stack of header name tags. | |
| const std::vector< std::array< int, 2 > > | transitions |
XML Finite State Machine. This class used for both input and output to keep track of current state of XML and to make sure the next state is a legal transition
|
inline |
|
private |
Check the transition of old state (m_state) => new_state is legal. If legal, m_state is new_state otherwise it is set to illegal.
|
inline |
Check if FSM is finished when last closing footer is encountered.
|
inline |
Return string with tag last added or next to be processed.
| void XML::FSM::next | ( | State | new_state, |
| const std::string & | tag = std::string() |
||
| ) |
Advance FSM to new_state and check if this is a legal transition. If tag is non-empty it also checked. Either m_state is set to new_state or ILLEGAL.
| new_state | Expected next state after transition |
| tag | Expected next tag (may be empty if not relevent). |
|
private |
The array transitions implments the following state machine to check XML syntax.
+---—+ NEW +-----—+
^ | | | |
| V V V |
FOOTER<–+---—>HEADER--—+ |
^ ^ | | | |
| | +-—+ | +-+ | |
| | | | | | | |
| | V V V | | |
| ATOM_END<-NAME_VALUE | |
| | | |
| V | |
+–ELEMENT<—HEADER_END<-+ |
| |
+------—+
1.8.11