Commit 7670526f authored by jan.koester's avatar jan.koester
Browse files

test

parent 6ce64788
Loading
Loading
Loading
Loading
+8 −1
Changes for lib/awk/awk.cpp: 8 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -81,7 +81,14 @@ static std::string awkEre(const std::string &pat){
                j++;
                while(j<n && isdigit((unsigned char)pat[j])) j++;
            }
            bool interval=digits && j<n && pat[j]=='}' && !out.empty();
            // an interval needs something before it to repeat
            bool atom=!out.empty();
            if(atom){
                char last=out.back();
                bool escaped=out.size()>=2 && out[out.size()-2]=='\\';
                if(!escaped && (last=='^' || last=='(' || last=='|')) atom=false;
            }
            bool interval=digits && j<n && pat[j]=='}' && atom;
            if(interval){ out.append(pat,i,j-i+1); i=j+1; continue; }
            out+="\\{";
            i++;