MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / set_contains

Function set_contains

codegraph-kernel/grammars/lua/tree_sitter/parser.h:154–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152};
153
154static inline bool set_contains(const TSCharacterRange *ranges, uint32_t len, int32_t lookahead) {
155 uint32_t index = 0;
156 uint32_t size = len - index;
157 while (size > 1) {
158 uint32_t half_size = size / 2;
159 uint32_t mid_index = index + half_size;
160 const TSCharacterRange *range = &ranges[mid_index];
161 if (lookahead >= range->start && lookahead <= range->end) {
162 return true;
163 } else if (lookahead > range->end) {
164 index = mid_index;
165 }
166 size -= half_size;
167 }
168 const TSCharacterRange *range = &ranges[index];
169 return (lookahead >= range->start && lookahead <= range->end);
170}
171
172/*
173 * Lexer Macros

Callers 1

ts_lexFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected