Mercurial > hg > th-libs
comparison th_regex.c @ 642:3a35db5c1873
Cleanup.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 24 Jan 2020 09:39:09 +0200 |
parents | 9a1ed82abefd |
children | a2bf1ea05b05 |
comparison
equal
deleted
inserted
replaced
641:9a1ed82abefd | 642:3a35db5c1873 |
---|---|
421 if ((res = th_regex_parse_ctx_get_prev_node(&ctx, &pnode)) != THERR_OK) | 421 if ((res = th_regex_parse_ctx_get_prev_node(&ctx, &pnode)) != THERR_OK) |
422 goto exit; | 422 goto exit; |
423 | 423 |
424 if (cch == '?') | 424 if (cch == '?') |
425 { | 425 { |
426 // Check if previous was a count ("*?" or "+?") | 426 // Check if previous was a count |
427 if (pnode->mode == TH_RE_MATCH_COUNT_GREEDY) | |
428 pnode->mode = TH_RE_MATCH_COUNT_NONGREEDY; | |
429 else | |
430 if (pnode->mode == TH_RE_MATCH_COUNT_NONGREEDY) | 427 if (pnode->mode == TH_RE_MATCH_COUNT_NONGREEDY) |
431 { | 428 { |
432 res = THERR_INVALID_DATA; | 429 res = THERR_INVALID_DATA; |
433 goto exit; | 430 goto exit; |
434 } | 431 } |
435 else | 432 else |
433 if (pnode->mode != TH_RE_MATCH_COUNT_GREEDY) | |
436 { | 434 { |
437 // Previous token is optional (repeat 0-1 times) | 435 // Previous token is optional (repeat 0-1 times) |
438 pnode->mode = TH_RE_MATCH_COUNT_NONGREEDY; | |
439 pnode->repeatMin = 0; | 436 pnode->repeatMin = 0; |
440 pnode->repeatMax = 1; | 437 pnode->repeatMax = 1; |
441 } | 438 } |
439 | |
440 pnode->mode = TH_RE_MATCH_COUNT_NONGREEDY; | |
442 } | 441 } |
443 else | 442 else |
444 { | 443 { |
445 // Check if previous was a count ("**", "*+", etc.) | 444 // Check if previous was a count ("**", "*+", etc.) |
446 if (pnode->mode == TH_RE_MATCH_COUNT_GREEDY || | 445 if (pnode->mode == TH_RE_MATCH_COUNT_GREEDY || |