changeset 70:87dff3a124ab

resolve segmentation fault(But not correct performance)
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Tue, 25 Aug 2015 13:02:56 +0900
parents eecddded9b91
children 58d2b10988c9
files c/regexParser/main.cc
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/c/regexParser/main.cc	Wed Aug 12 15:10:50 2015 +0900
+++ b/c/regexParser/main.cc	Tue Aug 25 13:02:56 2015 +0900
@@ -98,11 +98,11 @@
 
 // <group> ::= '('<regex>')'
 NodePtr group() {
-    token();
+    ptr++;
     NodePtr n = regex();
-    token();
     if (*ptr == ')') {
         n = createNode('(',n,0);
+        ptr++;
     } else {
         // ) reqiured
     }
@@ -113,7 +113,7 @@
 void token() {
     while (*ptr != '\0') {
         if ((*ptr == '(') || (*ptr == ')')) {
-            tokenType = *ptr++;
+            tokenType = '(';
             tokenValue = 0;
             if (ptr[1] == ')') {
                 ptr++;