Mercurial > hg > Members > masakoha > testcode
view regexParser/test/ccMerge.cc @ 272:5aa9d01926f1
Cerium version no compile errors
author | kono |
---|---|
date | Fri, 29 Jan 2016 20:38:18 +0900 |
parents | 4852bfa85db4 |
children | 1188debbef10 |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "regexParser.h" #include "node.h" #include "subsetConstruction.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; }