Mercurial > hg > Members > masakoha > testcode
view c/regexParser/subsetConstraction.cc @ 137:c292c67b3100 pairPro
add generateTransitionList function
author | masa |
---|---|
date | Fri, 04 Dec 2015 20:32:09 +0900 |
parents | 166136236891 |
children | 6c258910cacb |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include "subsetConstraction.h" typedef struct transitionGenerator { TransitionListPtr tl; StatePtr state; long stateMax; } TransitionGenerator, *TransitionGeneratorPtr; typedef struct tgValue { TransitionListPtr tl; bool asterisk; } TGValue, *TGValuePtr; TGValue generateTransitionList(NodePtr n,TransitionGeneretorPtr tg) { if (n->left != NULL) { TGValue tl = generateTransitionList(n->left, tg); } if (n->tokenType == 'a') { printf("%*c",d*4, ' '); for (int i = 0; i < n->cc->cond->w->length; i++) { putchar(n->cc->cond->w->word[i]); } printf("(%lu)\n",n->nodeNumber); } else if (n->tokenType == 'c') { TGValue tl = generateTransitionList(n->cc,tg); } else { printf("%*c%c(%lu)\n",d*4, ' ',n->tokenType,n->nodeNumber); } if (n->right != NULL) { TGValue tl = generateTransitionList(n->right, tg); } }