changeset 73:0a5dd7486bb2

fix
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Thu, 27 Aug 2015 16:57:28 +0900
parents c4b934048e2a
children b11dfc48f698
files c/regexParser/main.cc
diffstat 1 files changed, 15 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/c/regexParser/main.cc	Thu Aug 27 15:37:46 2015 +0900
+++ b/c/regexParser/main.cc	Thu Aug 27 16:57:28 2015 +0900
@@ -86,11 +86,11 @@
 
 // <group> ::= '('<regex>')'
 NodePtr group() {
-    NodePtr n = regex();
+    NodePtr n = NULL;
     if (*ptr == ')') {
         n = createNode('(',n,0);
     } else {
-        // ) reqiured
+        n = regex();
     }
     return n;
 }
@@ -125,21 +125,20 @@
             tokenType = '*';
             tokenValue = 0;
             return;
+        } else if (*ptr == '\\'){
+            // need more proccesing 
+            /*
+                \277
+                \0xa5
+                \[
+                \\
+                \utf-8 etc...
+            */
+        } else {
+            tokenType = 'a';
+            tokenValue = *ptr;
+            return;
         }
-
-        tokenType = 'a';
-        tokenValue = *ptr;
-        return;
-
-        if (*ptr == '\\') ptr++; // need more proccesing 
-        /*
-            \277
-            \0xa5
-            \[
-            \\
-            \utf-8 etc...
-        */
-
     }
 
     tokenType = 0;