Mercurial > hg > Applications > Grep
changeset 151:6ba059ce9109 pairPro
test file
author | Nozomi |
---|---|
date | Wed, 16 Dec 2015 17:09:56 +0900 |
parents | a4940a8dd263 |
children | 1c9e8ba64f6a |
files | c/regexParser/Makefile c/regexParser/regexParser.cc |
diffstat | 2 files changed, 12 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/c/regexParser/Makefile Wed Dec 16 16:42:18 2015 +0900 +++ b/c/regexParser/Makefile Wed Dec 16 17:09:56 2015 +0900 @@ -61,3 +61,7 @@ ./$(TARGET) -regex '[d-ge-i]' ./$(TARGET) -regex '[d-gg-i]' ./$(TARGET) -regex '[d-gh-i]' + ./$(TARGET) -regex '[d-ga-cx-z]' + ./$(TARGET) -regex '[d-ga-de-d]' + ./$(TARGET) -regex '[d-ga-db-e]' + ./$(TARGET) -regex '[d-gh-ja-e]'
--- a/c/regexParser/regexParser.cc Wed Dec 16 16:42:18 2015 +0900 +++ b/c/regexParser/regexParser.cc Wed Dec 16 17:09:56 2015 +0900 @@ -106,21 +106,21 @@ } return cc; } else if (begin > cc->cond.range.end ) { // 13 - CharClassPtr cc1 = createCharClassRange(cc->cond.range.begin,cc->cond.range.end,cc->left,cc->right); if (cc->right) { - cc1->right = insertCharClass(cc->right,begin,end); - return cc1; + cc->right = insertCharClass(cc->right,begin,end); } else { - CharClassPtr cc2 = createCharClassRange(begin,end,0,0); - cc1->right = cc2; - return cc1; + cc->right = createCharClassRange(begin,end,0,0); } + return cc; } if (cc->right) { - return insertCharClass(cc->right,cc->cond.range.begin,end); + CharClassPtr right = cc->right; + begin = cc->cond.range.begin; + free(cc); + return insertCharClass(right,begin,end); } if (begin >= cc->cond.range.begin && begin <= cc->cond.range.end) { // 12 - if (end > cc->cond.range.end) cc->cond.range.end = end; // 11 + if (end > cc->cond.range.end) cc->cond.range.end = end; // 11,8 } else if (begin < cc->cond.range.begin) { // 5 cc->cond.range.begin = begin; cc->cond.range.end = end;