MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / tokenize

Function tokenize

src/lexing.cpp:42–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42std::vector<std::string_view>
43tokenize(const char* start, const char* end, const std::vector<lexer>& lexers)
44{
45 std::vector<std::string_view> result;
46 while(start != end)
47 {
48 bool error = true;
49 for(const auto& l : lexers)
50 {
51 const auto* next = l(start, end);
52 if(next != start)
53 {
54 result.emplace_back(start, next - start);
55 start = next;
56 error = false;
57 break;
58 }
59 }
60
61 if(error)
62 {
63 MIGRAPHX_THROW("TOKENIZE: no token found!");
64 }
65 }
66
67 return result;
68}
69
70} // namespace MIGRAPHX_INLINE_NS
71} // namespace migraphx

Callers 3

json_tokenizeFunction · 0.85
parse_equationMethod · 0.85
encode_promptMethod · 0.85

Calls 1

emplace_backMethod · 0.80

Tested by

no test coverage detected