Mercurial > hg > Applications > Grep
diff c/regexParser/regexParser.cc @ 132:fb4c8adf3a80 pairPro
fix include '|' in regex
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 02 Dec 2015 23:30:48 +0900 |
parents | 7925e9abb078 |
children | ccc673449351 |
line wrap: on
line diff
--- a/c/regexParser/regexParser.cc Wed Dec 02 18:01:32 2015 +0900 +++ b/c/regexParser/regexParser.cc Wed Dec 02 23:30:48 2015 +0900 @@ -132,7 +132,7 @@ ri->ptr++; ri->tokenType = '|'; ri->tokenValue = NULL; - ri->orFlag = true; + ri->orFlag++; return; } else if (ri->ptr[0] == '*'){ ri->ptr++; @@ -187,15 +187,15 @@ NodePtr n1 = regex(ri); n = createNode(ri,'|',n,n1); } else if (ri->tokenType == ')') { - if (ri->orFlag == true) { - ri->ptr--; - ri->orFlag = false; + if (ri->orFlag != 0) { + if (ri->ptr[0] != ')') ri->ptr--; + ri->orFlag--; } return n; } else { // return NULL NodePtr n1 = regex(ri); - n = createNode(ri,'a',n,n1); + n = createNode(ri,'+',n,n1); } } return n; }