diff c/regexParser/regexParser.cc @ 126:639b0b437ebf pairPro

remove error (do not work)
author masa
date Tue, 01 Dec 2015 21:42:05 +0900
parents 4d6ac69801ad
children b061cd8205cc
line wrap: on
line diff
--- a/c/regexParser/regexParser.cc	Tue Dec 01 21:11:27 2015 +0900
+++ b/c/regexParser/regexParser.cc	Tue Dec 01 21:42:05 2015 +0900
@@ -6,7 +6,7 @@
 #include "error.h"
 
 static NodePtr allocateNode();
-static NodePtr createNode(RegexInfoPtr,unsigned char*,NodePtr,NodePtr);
+static NodePtr createNode(RegexInfoPtr,unsigned char,NodePtr,NodePtr);
 static NodePtr charClass(RegexInfoPtr);
 static NodePtr group(RegexInfoPtr);
 static void token(RegexInfoPtr);
@@ -30,13 +30,15 @@
 }
 
 static
-CharClassPtr createChaClassWord(RegexInfoPtr ri) {
+CharClassPtr createCharClassWord(RegexInfoPtr ri) {
     CharClassPtr cc = NEW(CharClass);
     cc->type = 'a';
     cc->cond = NEW(Condition);
     cc->cond->w = NEW(Word);
     cc->cond->w->word = ri->tokenValue;
     cc->cond->w->length = ri->ptr - ri->tokenValue;
+
+    return cc;
 }
 
 static
@@ -67,29 +69,29 @@
     ri->nodeNumber++;
 
     CharClassPtr cc = NEW(CharClass);
+    cc->type = 'r';
     cc->cond = NEW(Condition);
-    cc->cond->type = 'r';
-    cc->cond->rangeList = NEW(struct utf8Range);
-    cc->cond->rangeList->begin = ri->ptr;
-    cc->cond->rangeList->end = ri->ptr + 1;
-    cc->cond->rangeList->next = NULL;
+    cc->cond->range = NEW(RangeList);
+    cc->cond->range->begin = ri->ptr;
+    cc->cond->range->end = ri->ptr + 1;
+    cc->cond->range->next = NULL;
 
     int i = 0;
 
-    struct utf8Range *rangeList= cc->cond->rangeList;
+    RangeListPtr rangeList = cc->cond->range;
   
     while (ri->ptr[i] != ']') {
         if (ri->ptr[i] == '-') i++;
 
         rangeList->end = ri->ptr + i;
-        rangeList->next = NEW(struct utf8Range);
+        rangeList->next = NEW(RangeList);
         rangeList = rangeList->next;
         rangeList->begin = ri->ptr+i+1;
         rangeList->next = NULL;
         i++;
     }
 
-    rangeList->end = ri->ptr[i-1];
+    rangeList->end = ri->ptr + i - 1;
 
     return n;
 }
@@ -97,7 +99,7 @@
 // <literal> ::= [a-z][A-Z][0-9]
 static
 NodePtr literal(RegexInfoPtr ri) {
-    NodePtr n = createNode(ri,ri->ptr,0,0);
+    NodePtr n = createNode(ri,'a',0,0);
     return n;
 }