Mercurial > hg > Members > masakoha > testcode
changeset 174:b9e913030a47 pairPro
allocate nodeNumber to character and cclist (not allocate nodenumber '+' '*' '|')
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Dec 2015 18:48:11 +0900 |
parents | cca8bb5aeded |
children | 3be0fbcd4b52 |
files | regexParser/node.cc regexParser/regexParser.cc |
diffstat | 2 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/regexParser/node.cc Tue Dec 22 18:14:17 2015 +0900 +++ b/regexParser/node.cc Tue Dec 22 18:48:11 2015 +0900 @@ -34,8 +34,10 @@ printf("(%lu)\n",n->nodeNumber); } else if (n->tokenType == 'c') { printCharacterClass(n->cc,n->nodeNumber,d); + } else if (n->tokenType == 'a') { + printf("%*c%c(%lu)\n",d*4, ' ',n->tokenType,n->nodeNumber); } else { - printf("%*c%c(%lu)\n",d*4, ' ',n->tokenType,n->nodeNumber); + printf("%*c%c\n",d*4, ' ',n->tokenType); } if (n->right != NULL) {
--- a/regexParser/regexParser.cc Tue Dec 22 18:14:17 2015 +0900 +++ b/regexParser/regexParser.cc Tue Dec 22 18:48:11 2015 +0900 @@ -33,8 +33,12 @@ n->cc = cc; n->left = left; n->right = right; - n->nodeNumber = ri->nodeNumber; - ri->nodeNumber++; + if (n->tokenType == 'a' || n->tokenType == 'c') { + n->nodeNumber = ri->nodeNumber; + ri->nodeNumber++; + } else { + n->nodeNumber = 0; + } return n; }