Mercurial > hg > Applications > Grep
diff c/regexParser/regexParser.cc @ 116:66c633575b53 pairPro
remove error and warning
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 24 Nov 2015 17:07:08 +0900 |
parents | ca30f8334741 |
children | 31b0ba0050fa 2f0653f8eabb |
line wrap: on
line diff
--- a/c/regexParser/regexParser.cc Tue Nov 24 14:38:26 2015 +0900 +++ b/c/regexParser/regexParser.cc Tue Nov 24 17:07:08 2015 +0900 @@ -3,13 +3,6 @@ #include "regexParser.h" #include "error.h" -typedef struct regexInfo { - unsigned char *ptr; - unsigned char tokenType; - int tokenValue; - int nodeNumber; -} RegexInfo, *RegexInfoPtr; - static NodePtr createNode(RegexInfoPtr,unsigned char,NodePtr,NodePtr); static NodePtr charClass(RegexInfoPtr); static NodePtr group(RegexInfoPtr); @@ -24,15 +17,22 @@ * stateTransitionTable */ +NodePtr allocateNode() { + NodePtr n = (NodePtr)malloc(sizeof(node)); + n->cc = (CharClassPtr)malloc(sizeof(CharClass)); + n->cc->cond = (ConditionList)malloc(sizeof(Condition)); + return n; +} + static NodePtr createNode(RegexInfoPtr ri,unsigned char character, NodePtr left, NodePtr right) { - NodePtr n = (NodePtr)malloc(sizeof(Node)); + NodePtr n = allocateNode(); if (n == NULL) { mallocFailedMessage(); } n->tokenType = ri->tokenType; - n->cc->conditionList->character = character; + n->cc->cond->character = character; n->left = left; n->right = right;