comparison 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
comparison
equal deleted inserted replaced
115:ca30f8334741 116:66c633575b53
1 #include <stdlib.h> 1 #include <stdlib.h>
2 #include <stdio.h> 2 #include <stdio.h>
3 #include "regexParser.h" 3 #include "regexParser.h"
4 #include "error.h" 4 #include "error.h"
5
6 typedef struct regexInfo {
7 unsigned char *ptr;
8 unsigned char tokenType;
9 int tokenValue;
10 int nodeNumber;
11 } RegexInfo, *RegexInfoPtr;
12 5
13 static NodePtr createNode(RegexInfoPtr,unsigned char,NodePtr,NodePtr); 6 static NodePtr createNode(RegexInfoPtr,unsigned char,NodePtr,NodePtr);
14 static NodePtr charClass(RegexInfoPtr); 7 static NodePtr charClass(RegexInfoPtr);
15 static NodePtr group(RegexInfoPtr); 8 static NodePtr group(RegexInfoPtr);
16 static void token(RegexInfoPtr); 9 static void token(RegexInfoPtr);
22 * tokenType 15 * tokenType
23 * regexPosition(state) 16 * regexPosition(state)
24 * stateTransitionTable 17 * stateTransitionTable
25 */ 18 */
26 19
20 NodePtr allocateNode() {
21 NodePtr n = (NodePtr)malloc(sizeof(node));
22 n->cc = (CharClassPtr)malloc(sizeof(CharClass));
23 n->cc->cond = (ConditionList)malloc(sizeof(Condition));
24 return n;
25 }
26
27 static 27 static
28 NodePtr createNode(RegexInfoPtr ri,unsigned char character, NodePtr left, NodePtr right) { 28 NodePtr createNode(RegexInfoPtr ri,unsigned char character, NodePtr left, NodePtr right) {
29 NodePtr n = (NodePtr)malloc(sizeof(Node)); 29 NodePtr n = allocateNode();
30 if (n == NULL) { 30 if (n == NULL) {
31 mallocFailedMessage(); 31 mallocFailedMessage();
32 } 32 }
33 33
34 n->tokenType = ri->tokenType; 34 n->tokenType = ri->tokenType;
35 n->cc->conditionList->character = character; 35 n->cc->cond->character = character;
36 n->left = left; 36 n->left = left;
37 n->right = right; 37 n->right = right;
38 38
39 if (ri->tokenType == 'a') { 39 if (ri->tokenType == 'a') {
40 n->nodeNumber = ri->nodeNumber; 40 n->nodeNumber = ri->nodeNumber;