changeset 128:f827682d4687 pairPro

fix
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Tue, 01 Dec 2015 22:50:58 +0900
parents b061cd8205cc
children b930be74a16e
files c/regexParser/regexParser.cc
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/c/regexParser/regexParser.cc	Tue Dec 01 21:50:09 2015 +0900
+++ b/c/regexParser/regexParser.cc	Tue Dec 01 22:50:58 2015 +0900
@@ -166,13 +166,15 @@
     token(ri);
     NodePtr n = NULL;
     if (ri->tokenType == 'c') n = charClass(ri);
+    if (ri->tokenType == 'a') n = literal(ri);
+    if (ri->tokenType == '(') n = group(ri);
 
     return n;
 }
 
 // <regex> ::= <regexAtom> | <regexAtom>'*' | <regexAtom>'|'<regex> | <regexAtom><regex> | '(' regex ')'
 NodePtr regex(RegexInfoPtr ri) {
-    NodePtr n = NULL;
+    NodePtr n = regexAtom(ri);
     while (ri->ptr[0]) {
         token(ri);
         if (ri->tokenType == '*') {
@@ -182,11 +184,6 @@
             n = createNode(ri,'|',n,n1);
         } else if (ri->tokenType == ')') {
             return n;
-        } else if (ri->tokenType == 'a') {
-            NodePtr n1 = literal(ri);
-            unsigned char *syntax = (unsigned char*)malloc(sizeof(unsigned char));
-            syntax[0] = '+';
-            n = createNode(ri,syntax,n,n1);
         } else {
             // return NULL
             NodePtr n1 = regex(ri);