Handle branches in subregexes correctly
authorMikko Rasa <tdb@tdb.fi>
Tue, 25 Nov 2008 06:45:28 +0000 (06:45 +0000)
committerMikko Rasa <tdb@tdb.fi>
Tue, 25 Nov 2008 06:45:28 +0000 (06:45 +0000)
source/regex.cpp

index c2590f2c8f8d9109606d06499da24b6b51c87e80..4dc1b830be562d7822498e5637057abf7c53b6c9 100644 (file)
@@ -116,11 +116,11 @@ Regex::Code Regex::compile(const string &expr, string::const_iterator &iter, uns
                        }
                        --level;
                }
-               else if(*end=='|')
+               else if(*end=='|' && level==0)
                {
                        if(branch)
                                break;
-                       else if(level==0)
+                       else
                                has_branches=true;
                }
                else if(*end=='[')