| 5 | const int EOZ = -1; |
| 6 | |
| 7 | std::vector<Word> identify::ParseToWords(std::string_view identify) { |
| 8 | TextReader reader(identify); |
| 9 | std::vector<Word> words; |
| 10 | while (true) { |
| 11 | switch (Lex(reader)) { |
| 12 | case IdentifyType::Unknown: { |
| 13 | words.clear(); |
| 14 | goto endLoop; |
| 15 | } |
| 16 | case IdentifyType::Ascii: { |
| 17 | auto range = reader.GetTokenRange(); |
| 18 | if (range.Length > 3) { |
| 19 | auto text = reader.GetSaveText(); |
| 20 | words.emplace_back(range, text); |
| 21 | } |
| 22 | break; |
| 23 | } |
| 24 | case IdentifyType::Ignore: { |
| 25 | break; |
| 26 | } |
| 27 | default:// end |
| 28 | { |
| 29 | goto endLoop; |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | endLoop: |
| 34 | return words; |
| 35 | } |
| 36 | |
| 37 | identify::IdentifyType identify::Lex(TextReader &reader) { |
| 38 | reader.ResetBuffer(); |
nothing calls this directly
no test coverage detected