Mercurial > hg > Applications > Grep
view regexParser/test/ccMerge.cc @ 213:11b6332f0a42
fix tgv.tg->totalStateCount increment
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 28 Dec 2015 19:02:14 +0900 |
parents | 2ec95755238e |
children | 4852bfa85db4 |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "regexParser.h" #include "node.h" #include "subsetConstraction.h" void printCCTree(CharClassPtr cc) { if (cc->left != NULL) { printCCTree(cc->left); } printf("range : [%c-%c] NextState : %lu\n",(unsigned char)cc->cond.range.begin,(unsigned char)cc->cond.range.end, cc->nextState.bitContainer); if (cc->right != NULL) { printCCTree(cc->right); } } int main(int argc, char **argv) { RegexInfo ri; NodePtr n = NULL; StatePtr s = NULL; TGValue tgv = createTGValue(); for (int i = 1; i < argc; i++) { if (strcmp(argv[i],"-regex") == 0) { ri.ptr = (unsigned char*)argv[i+1]; i++; printf("regex : %s\n",ri.ptr); NodePtr nMerge = regex(&ri); StatePtr sMerge = createState(tgv,nMerge); setState(sMerge->cc,sMerge->bitState); if (s == NULL) { s = sMerge; n = nMerge; printCCTree(s->cc); continue; } CharClassPtr cc = mergeTransition(s,sMerge->cc); s->cc = cc; printCCTree(s->cc); } } return 0; }