Mercurial > hg > Applications > Grep
changeset 139:6c258910cacb pairPro
remove some warning and error
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 07 Dec 2015 02:20:13 +0900 |
parents | ea2810db8d87 |
children | 84a2a5209d3a |
files | c/regexParser/Makefile c/regexParser/main.cc c/regexParser/node.cc c/regexParser/subsetConstraction.cc c/regexParser/subsetConstraction.h |
diffstat | 5 files changed, 29 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/c/regexParser/Makefile Sun Dec 06 15:54:05 2015 +0900 +++ b/c/regexParser/Makefile Mon Dec 07 02:20:13 2015 +0900 @@ -3,7 +3,7 @@ CC= clang++ SRCS_TMP = $(wildcard *.cc) -SRCS_EXCLUDE = determinize.cc subsetConstraction.cc +SRCS_EXCLUDE = determinize.cc SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) OBJS = $(SRCS:.cc=.o)
--- a/c/regexParser/main.cc Sun Dec 06 15:54:05 2015 +0900 +++ b/c/regexParser/main.cc Mon Dec 07 02:20:13 2015 +0900 @@ -1,7 +1,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "bitVector.h" +#include "subsetConstraction.h" extern NodePtr regex(RegexInfoPtr); extern void printTree(NodePtr); @@ -11,6 +11,7 @@ int main(int argc, char **argv) { RegexInfoPtr ri = (RegexInfoPtr)malloc(sizeof(RegexInfo)); + TransitionGeneratorPtr tg = (TransitionGeneratorPtr)malloc(sizeof(TransitionGenerator)); ri->nodeNumber = 1; ri->orNum = 0; ri->asterFlag = false;
--- a/c/regexParser/node.cc Sun Dec 06 15:54:05 2015 +0900 +++ b/c/regexParser/node.cc Mon Dec 07 02:20:13 2015 +0900 @@ -1,13 +1,13 @@ #include <stdio.h> #include "node.h" -static void printCharacterClass(CharClassPtr cc, int d) { +static void printCharacterClass(CharClassPtr cc, long nodeNumber,int d) { if (cc->type == 'r') { printf("%*c",d*4, ' '); for (RangeListPtr range = cc->cond->range; range; range = range->next) { - printf("%c-%c ",*range->begin,*range->end); + printf("[%c-%c] ",*range->begin,*range->end); } - printf("\n"); + printf("(%lu)\n",nodeNumber); } } @@ -24,7 +24,7 @@ } printf("(%lu)\n",n->nodeNumber); } else if (n->tokenType == 'c') { - printCharacterClass(n->cc,d); + printCharacterClass(n->cc,n->nodeNumber,d); } else { printf("%*c%c(%lu)\n",d*4, ' ',n->tokenType,n->nodeNumber); }
--- a/c/regexParser/subsetConstraction.cc Sun Dec 06 15:54:05 2015 +0900 +++ b/c/regexParser/subsetConstraction.cc Mon Dec 07 02:20:13 2015 +0900 @@ -3,35 +3,21 @@ #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) { - +TGValuePtr generateTransition(NodePtr n,TransitionGeneratorPtr tg) { + TGValuePtr t = NULL; if (n->left != NULL) { - TGValue tl = generateTransitionList(n->left, tg); + t = generateTransition(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); + t = generateTransition(n,tg); } else { - printf("%*c%c(%lu)\n",d*4, ' ',n->tokenType,n->nodeNumber); + } if (n->right != NULL) { - TGValue tl = generateTransitionList(n->right, tg); + t = generateTransition(n->right, tg); } + return t; }
--- a/c/regexParser/subsetConstraction.h Sun Dec 06 15:54:05 2015 +0900 +++ b/c/regexParser/subsetConstraction.h Mon Dec 07 02:20:13 2015 +0900 @@ -1,6 +1,14 @@ -#include "bitVector.h" -extern BitVectorListPtr initBitVector(); -void printBitVectorList(BitVectorListPtr); -const BitVectorListPtr descendTreeNode(NodePtr,BitVectorListPtr, BitVectorListPtr, bool&, bool&); -const BitVectorListPtr setNextBitVectorList(unsigned char, BitVectorListPtr, BitVectorListPtr); -BitVectorListPtr createBitVectorList(NodePtr); +#include "transition.h" + +typedef struct transitionGenerator { + TransitionPtr t; + StatePtr state; + long stateMax; +} TransitionGenerator, *TransitionGeneratorPtr; + +typedef struct tgValue { + TransitionPtr t; + bool asterisk; +} TGValue, *TGValuePtr; + +extern TGValuePtr generateTransition(NodePtr n,TransitionGeneratorPtr tg);