Advance parser state machine by a single step. Perform single step of parser state machine: if character matches one from transition tables - trigger transition to next state; otherwise, validate if current token is in legal state (throw Parse_error if not) and then add character to current token; State transition includes preparing various vars for next state and invoking state transition h
| 69 | where whole tokens are validated. |
| 70 | */ |
| 71 | inline void process_char(const char c, Parser_state& cstate, Parser_state& pstate, |
| 72 | const Transitions& transitions, string& target, Validator validate) { |
| 73 | for (const auto& transition : transitions) { |
| 74 | if (c == get<0>(transition)) { |
| 75 | if (get<2>(transition)) get<2>(transition)(target); |
| 76 | pstate = cstate; |
| 77 | cstate = get<1>(transition); |
| 78 | return; |
| 79 | } |
| 80 | } |
| 81 | validate(target, c); |
| 82 | target.push_back(c); |
| 83 | } |
| 84 | |
| 85 | /// Validate normal (major, minor, patch) version components. |
| 86 | inline void normal_version_validator(const string& tgt, const char c) { |