MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxIsKeyword

Function fxIsKeyword

modules/piu/PC/Code/piuCodeJS.c:121–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119}
120
121xsBooleanValue fxIsKeyword(char* string, uint32_t length, xsBooleanValue* noRegExp)
122{
123 char* keywordString;
124 uint32_t keywordLength;
125 int low, high, index, delta;
126 for (low = 0, high = XS_KEYWORD_COUNT; high > low; (delta < 0) ? (low = index + 1) : (high = index)) {
127 index = low + ((high - low) / 2);
128 keywordString = gxKeywords[index].string;
129 keywordLength = c_strlen(keywordString);
130 delta = c_strncmp(gxKeywords[index].string, (const char*)string, length);
131 if (delta == 0) {
132 if (keywordLength < length)
133 delta = 1;
134 else if (keywordLength > length)
135 delta = -1;
136 else {
137 *noRegExp = gxKeywords[index].noRegExp;
138 return 1;
139 }
140 }
141 }
142 return 0;
143}
144
145void fxParseJSCode(PiuCodeParser parser, xsBooleanValue template)
146{

Callers 1

fxParseJSCodeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected