| 1800 | } |
| 1801 | |
| 1802 | ParseResult ParserContext::parse_syntax(Input &input) |
| 1803 | { |
| 1804 | _get_parsers_having_first_token_cache.clear(); |
| 1805 | auto pr = _lua_parser->tryParse(input, 0, false); |
| 1806 | bool success = pr.state() == ParserState::SUCCESS && pr.result()->next_input().pos() >= input.source()->size() && get_error().length() < 1; |
| 1807 | if (!success) |
| 1808 | { |
| 1809 | // 如果pr.state是SUCCESS,则用last_error_token,如果pr.state不是SUCCESS,则用last_match_token |
| 1810 | std::cout << this->simple_token_error() << std::endl; |
| 1811 | pr.set_state(ParserState::FAILURE); |
| 1812 | } |
| 1813 | else |
| 1814 | { |
| 1815 | pr.set_result(pr.result()->invoke_parser_post_callback()); |
| 1816 | } |
| 1817 | return pr; |
| 1818 | } |
| 1819 | |
| 1820 | ParserFunctor *ParserContext::union_parsers(std::vector<ParserFunctor*> &parsers) |
| 1821 | { |
no test coverage detected