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

Function fxCharSetUnicodeProperty

xs/sources/xsre.c:11299–11379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11297}
11298
11299void* fxCharSetUnicodeProperty(txPatternParser* parser)
11300{
11301 txString name = NULL;
11302 txString value = NULL;
11303 txString p = parser->error;
11304 txString q = p + sizeof(parser->error) - 1;
11305 txInteger c;
11306 txCharSetUnicodeProperty* it = NULL;
11307 txBoolean isStringProperty = 0;
11308 txCharSet* result = NULL;
11309
11310 fxPatternParserNext(parser);
11311 c = parser->character;
11312 if (c != '{')
11313 fxPatternParserError(parser, gxErrors[mxInvalidEscape]);
11314 fxPatternParserNext(parser);
11315 c = parser->character;
11316 name = p;
11317 while ((('a' <= c) && (c <= 'z')) || (('A' <= c) && (c <= 'Z')) || (c == '_') || (('0' <= c) && (c <= '9'))) {
11318 if (p == q)
11319 fxPatternParserError(parser, gxErrors[mxNameOverflow]);
11320 *p++ = (char)c;
11321 fxPatternParserNext(parser);
11322 c = parser->character;
11323 }
11324 *p = 0;
11325 if (c == '=') {
11326 if (p == q)
11327 fxPatternParserError(parser, gxErrors[mxNameOverflow]);
11328 p++;
11329 fxPatternParserNext(parser);
11330 c = parser->character;
11331 value = p;
11332 while ((('a' <= c) && (c <= 'z')) || (('A' <= c) && (c <= 'Z')) || (c == '_') || (('0' <= c) && (c <= '9'))) {
11333 if (p == q)
11334 fxPatternParserError(parser, gxErrors[mxNameOverflow]);
11335 *p++ = (char)c;
11336 fxPatternParserNext(parser);
11337 c = parser->character;
11338 }
11339 *p = 0;
11340 }
11341 if (c != '}')
11342 fxPatternParserError(parser, gxErrors[mxInvalidEscape]);
11343 if (value) {
11344 if (!c_strcmp(name, "General_Category") || !c_strcmp(name, "gc"))
11345 it = (txCharSetUnicodeProperty*)c_bsearch(value, gxCharSet_General_Category, mxCharSet_General_Category, sizeof(txCharSetUnicodeProperty), fxCharSetUnicodePropertyCompare);
11346 else if (!c_strcmp(name, "Script") || !c_strcmp(name, "sc"))
11347 it = (txCharSetUnicodeProperty*)c_bsearch(value, gxCharSet_Script, mxCharSet_Script, sizeof(txCharSetUnicodeProperty), fxCharSetUnicodePropertyCompare);
11348 else if (!c_strcmp(name, "Script_Extensions") || !c_strcmp(name, "scx"))
11349 it = (txCharSetUnicodeProperty*)c_bsearch(value, gxCharSet_Script_Extensions, mxCharSet_Script_Extensions, sizeof(txCharSetUnicodeProperty), fxCharSetUnicodePropertyCompare);
11350 }
11351 else {
11352 it = (txCharSetUnicodeProperty*)c_bsearch(name, gxCharSet_General_Category, mxCharSet_General_Category, sizeof(txCharSetUnicodeProperty), fxCharSetUnicodePropertyCompare);
11353 if (!it)
11354 it = (txCharSetUnicodeProperty*)c_bsearch(name, gxCharSet_Binary_Property, mxCharSet_Binary_Property, sizeof(txCharSetUnicodeProperty), fxCharSetUnicodePropertyCompare);
11355 if (parser->flags & XS_REGEXP_V) {
11356 if (!it) {

Callers 1

fxCharSetParseEscapeFunction · 0.85

Calls 3

fxPatternParserNextFunction · 0.85
fxPatternParserErrorFunction · 0.85

Tested by

no test coverage detected