Ignore:
Timestamp:
Jan 19, 2017, 2:41:02 PM (2 years ago)
Author:
nmedfort
Message:

Code clean-up. Removed Pablo Call, SetIthBit? and Prototype.

Location:
icGREP/icgrep-devel/icgrep/re
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/re/printer_re.cpp

    r5091 r5267  
    2222
    2323using namespace re;
     24using namespace llvm;
    2425
    25 const std::string Printer_RE::PrintRE(const RE * re)
    26 {
     26const std::string Printer_RE::PrintRE(const RE * re) {
    2727    std::string retVal = "";
    2828
    2929    if (re == nullptr) {
    3030        retVal = "<NULL>";
    31     }
    32     else if (const Alt* re_alt = dyn_cast<const Alt>(re))
    33     {
     31    } else if (const Alt* re_alt = dyn_cast<const Alt>(re)) {
    3432        retVal += "(Alt[";
    3533        bool comma = false;
     
    4240        }
    4341        retVal += "])";
    44     }
    45     else if (const CC* re_cc = dyn_cast<const CC>(re))
    46     {
     42    } else if (const CC* re_cc = dyn_cast<const CC>(re)) {
    4743        retVal = "CC \"";
    4844        retVal += re_cc->canonicalName(UnicodeClass);
     
    5551            retVal += "]";
    5652        }
    57     }
    58     else if (const Name* re_name = dyn_cast<const Name>(re))
    59     {
     53    } else if (const Name* re_name = dyn_cast<const Name>(re)) {
    6054        retVal = "Name \"";
    6155        retVal += re_name->getName();
    6256        retVal += "\" ";
    63     }
    64     else if (const Assertion * a = dyn_cast<const Assertion>(re)) {
     57    } else if (const Assertion * a = dyn_cast<const Assertion>(re)) {
    6558        retVal = (a->getSense() == Assertion::Sense::Positive) ? "" : "Negative";
    6659        retVal += (a->getKind() == Assertion::Kind::Lookahead) ? "Lookahead" : "Lookbehind";
     
    6861        retVal += PrintRE(a->getAsserted());
    6962        retVal += ") ";
    70     }
    71     else if (const Diff* diff = dyn_cast<const Diff>(re))
    72     {
     63    } else if (const Diff* diff = dyn_cast<const Diff>(re)) {
    7364        retVal = "Diff (";
    7465        retVal += PrintRE(diff->getLH());
     
    7667        retVal += PrintRE(diff->getRH());
    7768        retVal += ") ";
    78     }
    79     else if (const Intersect* x = dyn_cast<const Intersect>(re))
    80     {
     69    } else if (const Intersect* x = dyn_cast<const Intersect>(re)) {
    8170        retVal = "Intersect (";
    8271        retVal += PrintRE(x->getLH());
     
    8473        retVal += PrintRE(x->getRH());
    8574        retVal += ") ";
    86     }
    87     else if (isa<const End>(re))
    88     {
     75    } else if (isa<const End>(re)) {
    8976        retVal = "End";
    90     }
    91     else if (const Rep* re_rep = dyn_cast<const Rep>(re))
    92     {
     77    } else if (const Rep* re_rep = dyn_cast<const Rep>(re)) {
    9378        retVal = "Rep(";
    9479        retVal.append(PrintRE(re_rep->getRE()));
     
    10388        }
    10489        retVal.append(")");
    105     }
    106     else if (const Seq* re_seq = dyn_cast<const Seq>(re))
    107     {
     90    } else if (const Seq* re_seq = dyn_cast<const Seq>(re)) {
    10891        retVal = "(Seq[";
    10992        bool comma = false;
     
    11699        }
    117100        retVal.append("])");
    118     }
    119     else if (isa<const Start>(re))
    120     {
     101    } else if (isa<const Start>(re)) {
    121102        retVal = "Start";
    122     }
    123     else if (isa<const Any>(re))
    124     {
     103    } else if (isa<const Any>(re)) {
    125104        retVal = "Any";
    126     }
    127     else
    128     {
     105    } else {
    129106        retVal = "???";
    130107    }
  • icGREP/icgrep-devel/icgrep/re/re_alt.h

    r4852 r5267  
    99
    1010#include "re_re.h"
    11 #include "re_cc.h"
     11#include <llvm/Support/Casting.h>
    1212
    1313namespace re {
     
    3636    void flatten(iterator begin, iterator end) {
    3737        for (auto i = begin; i != end; ++i) {
    38             if (LLVM_UNLIKELY(isa<Alt>(*i))) {
    39                 flatten<Alt::iterator>(cast<Alt>(*i)->begin(), cast<Alt>(*i)->end());
     38            if (LLVM_UNLIKELY(llvm::isa<Alt>(*i))) {
     39                flatten<Alt::iterator>(llvm::cast<Alt>(*i)->begin(), llvm::cast<Alt>(*i)->end());
    4040            } else {
    4141                push_back(*i);
  • icGREP/icgrep-devel/icgrep/re/re_analysis.cpp

    r5233 r5267  
    1414#include <re/printer_re.h>
    1515#include <limits.h>
     16
     17using namespace llvm;
    1618
    1719namespace re {
     
    3638        if (n->getType() == Name::Type::Byte) {
    3739            return true;
    38         }
    39         else if (n->getType() == Name::Type::Capture || n->getType() == Name::Type::Reference) {
     40        } else if (n->getType() == Name::Type::Capture || n->getType() == Name::Type::Reference) {
    4041            return isByteLength(n->getDefinition());
    4142        }
     
    6970        if (n->getType() == Name::Type::Unicode || n->getType() == Name::Type::UnicodeProperty || n->getType() == Name::Type::Byte) {
    7071            return true;
    71         }
    72         else if (n->getType() == Name::Type::Capture || n->getType() == Name::Type::Reference) {
     72        } else if (n->getType() == Name::Type::Capture || n->getType() == Name::Type::Reference) {
    7373            return isUnicodeUnitLength(n->getDefinition());
    7474        }
     
    8080std::pair<int, int> getUnicodeUnitLengthRange(const RE * re) {
    8181    if (const Alt * alt = dyn_cast<Alt>(re)) {
    82         std::pair<int, int> range = std::make_pair(std::numeric_limits<int>::max(), 0);
     82        std::pair<int, int> range = std::make_pair(INT_MAX, 0);
    8383        for (const RE * re : *alt) {
    8484            auto r = getUnicodeUnitLengthRange(re);
     
    9191        for (const RE * re : *seq) {
    9292            auto tmp = getUnicodeUnitLengthRange(re);
    93             if (LLVM_LIKELY(tmp.first < std::numeric_limits<int>::max() - range.first)) {
     93            if (LLVM_LIKELY(tmp.first < (INT_MAX - range.first))) {
    9494                range.first += tmp.first;
    9595            } else {
    96                 range.first = std::numeric_limits<int>::max();
     96                range.first = INT_MAX;
    9797            }
    98             if (LLVM_LIKELY(tmp.second < std::numeric_limits<int>::max() - range.second)) {
     98            if (LLVM_LIKELY(tmp.second < (INT_MAX - range.second))) {
    9999                range.second += tmp.second;
    100100            } else {
    101                 range.second = std::numeric_limits<int>::max();
     101                range.second = INT_MAX;
    102102            }
    103103        }
     
    105105    } else if (const Rep * rep = dyn_cast<Rep>(re)) {
    106106        auto range = getUnicodeUnitLengthRange(rep->getRE());
    107         if (LLVM_LIKELY(rep->getLB() != Rep::UNBOUNDED_REP && range.first < std::numeric_limits<int>::max())) {
     107        if (LLVM_LIKELY(rep->getLB() != Rep::UNBOUNDED_REP && range.first < INT_MAX)) {
    108108            range.first *= rep->getLB();
    109109        } else {
    110             range.first = std::numeric_limits<int>::max();
     110            range.first = INT_MAX;
    111111        }
    112         if (LLVM_LIKELY(rep->getUB() != Rep::UNBOUNDED_REP && range.second < std::numeric_limits<int>::max())) {
     112        if (LLVM_LIKELY(rep->getUB() != Rep::UNBOUNDED_REP && range.second < INT_MAX)) {
    113113            range.second *= rep->getUB();
    114114        } else {
    115             range.second = std::numeric_limits<int>::max();
     115            range.second = INT_MAX;
    116116        }
    117117        return range;
     
    139139                return std::make_pair(0, 0);
    140140            case Name::Type::Unknown:
    141                 return std::make_pair(0, std::numeric_limits<int>::max());
     141                return std::make_pair(0, INT_MAX);
    142142        }
    143143    }
     
    152152        }
    153153        return minAltLength;
    154     }
    155     else if (Seq * seq = dyn_cast<Seq>(re)) {
     154    } else if (Seq * seq = dyn_cast<Seq>(re)) {
    156155        int minSeqLength = 0;
    157156        for (RE * re : *seq) {
     
    159158        }
    160159        return minSeqLength;
    161     }
    162     else if (Rep * rep = dyn_cast<Rep>(re)) {
     160    } else if (Rep * rep = dyn_cast<Rep>(re)) {
    163161        if (rep->getLB() == 0) return 0;
    164162        else return (rep->getLB()) * minMatchLength(rep->getRE());
    165     }
    166     else if (isa<Assertion>(re)) {
     163    } else if (isa<Assertion>(re)) {
    167164        return 0;
    168     }
    169     else if (Diff * diff = dyn_cast<Diff>(re)) {
     165    } else if (Diff * diff = dyn_cast<Diff>(re)) {
    170166        return minMatchLength(diff->getLH());
    171     }
    172     else if (Intersect * e = dyn_cast<Intersect>(re)) {
     167    } else if (Intersect * e = dyn_cast<Intersect>(re)) {
    173168        return std::min(minMatchLength(e->getLH()), minMatchLength(e->getRH()));
    174     }
    175     else if (isa<Any>(re)) {
     169    } else if (isa<Any>(re)) {
    176170        return 1;
    177171    } else if (const Name * n = dyn_cast<Name>(re)) {
  • icGREP/icgrep-devel/icgrep/re/re_analysis.h

    r4829 r5267  
    22#define RE_ANALYSIS_H
    33
    4 //Regular Expressions
    5 #include "re_seq.h"
    6 #include <list>
     4#include <utility>
     5namespace re { class RE; }
    76
    87namespace re {
    98
    10 bool isByteLength(const RE *re);
     9bool isByteLength(const RE * re);
    1110   
    1211bool isUnicodeUnitLength(const RE * re);
  • icGREP/icgrep-devel/icgrep/re/re_any.h

    r4245 r5267  
    77#ifndef ANY_H
    88#define ANY_H
    9 
    10 #include "re_re.h"
    119
    1210#include "re_re.h"
  • icGREP/icgrep-devel/icgrep/re/re_cc.h

    r5037 r5267  
    99
    1010#include "re_re.h"
    11 
    12 #include <string>
    13 #include <vector>
    1411#include <UCD/unicode_set.h>
    15 #include <util/slab_allocator.h>
    1612
    1713namespace re {
     
    5551    friend CC * subtractCC(const CC * a, const CC * b);
    5652    friend CC * intersectCC(const CC * a, const CC * b);
    57     friend CC * caseInsensitize(const CC * a, const CC * b);
    5853
    5954    inline CC()
  • icGREP/icgrep-devel/icgrep/re/re_compiler.cpp

    r5234 r5267  
    44 *  icgrep is a trademark of International Characters.
    55 */
    6 #include <re/re_compiler.h>
    7 #include <re/re_toolchain.h>
    8 #include <re/re_name_resolve.h>
    9 //Regular Expressions
    10 #include <re/re_name.h>
     6
     7
     8
     9#include "re_compiler.h"
     10#include <pablo/pe_ones.h>          // for Ones
     11#include <pablo/pe_var.h>           // for Var
     12#include <pablo/pe_zeroes.h>        // for Zeroes
     13#include <re/printer_re.h>
     14#include <re/re_alt.h>
     15#include <re/re_analysis.h>         // for isByteLength, isUnicodeUnitLength
    1116#include <re/re_any.h>
     17#include <re/re_assertion.h>        // for Assertion, Assertion::Sense, Asse...
     18#include <re/re_cc.h>               // for makeCC
     19#include <re/re_diff.h>             // for Diff
     20#include <re/re_end.h>
     21#include <re/re_intersect.h>        // for Intersect
     22#include <re/re_name.h>             // for Name, Name::Type, Name::Type::Zer...
     23#include <re/re_name_resolve.h>     // for resolveNames
     24#include <re/re_rep.h>              // for Rep, Rep::::UNBOUNDED_REP
     25#include <re/re_seq.h>              // for Seq
    1226#include <re/re_start.h>
    13 #include <re/re_end.h>
    14 #include <re/re_alt.h>
    15 #include <re/re_cc.h>
    16 #include <re/re_seq.h>
    17 #include <re/re_rep.h>
    18 #include <re/re_diff.h>
    19 #include <re/re_intersect.h>
    20 #include <re/re_assertion.h>
    21 #include <re/re_analysis.h>
    22 #include <re/re_memoizer.hpp>
    23 #include <re/printer_re.h>
    24 #include <pablo/codegenstate.h>
    25 #include <pablo/pablo_kernel.h>
    26 #include <UCD/ucd_compiler.hpp>
    27 #include <UCD/resolve_properties.h>
    28 #include <assert.h>
    29 #include <stdexcept>
    30 #include <iostream>
    31 #include <pablo/printer_pablos.h>
    32 #include "llvm/Support/CommandLine.h"
    33 #include <sstream>
    34 #include <unordered_set>
     27#include <re/re_toolchain.h>        // for AlgorithmOptionIsSet, RE_Algorith...
     28#include "cc/cc_compiler.h"         // for CC_Compiler
     29#include "pablo/builder.hpp"        // for PabloBuilder
     30namespace pablo { class PabloAST; }
     31namespace pablo { class PabloKernel; }
     32namespace re { class Alt; }
     33namespace re { class RE; }
    3534
    3635
     
    3837
    3938using namespace pablo;
     39using namespace llvm;
    4040
    4141namespace re {
     
    5151
    5252void RE_Compiler::initializeRequiredStreams_utf16() {
    53 
    54 
    55 
    5653    PabloAST * LF = mCCCompiler.compileCC("LF", makeCC(0x000A), mPB);
    5754    PabloAST * CR = mCCCompiler.compileCC("CR", makeCC(0x000D), mPB);
  • icGREP/icgrep-devel/icgrep/re/re_compiler.h

    r5233 r5267  
    88#define RE_TO_PABLO_COMPILER_H
    99
    10 #include <re/re_re.h>
    11 #include <re/re_seq.h>
    12 #include <cc/cc_compiler.h>
    13 #include <pablo/builder.hpp>
     10#include <re/re_seq.h>  // for Seq
    1411#include <boost/container/flat_map.hpp>
     12#include <vector>       // for vector<>::iterator
     13namespace cc { class CC_Compiler; }
     14namespace pablo { class PabloAST; }
     15namespace pablo { class PabloBuilder; }
     16namespace pablo { class PabloKernel; }
     17namespace re { class Alt; }
     18namespace re { class Assertion; }
     19namespace re { class Diff; }
     20namespace re { class Intersect; }
     21namespace re { class Name; }
     22namespace re { class RE; }
     23namespace re { class Rep; }
    1524
    16 namespace UCD {
    17 class UnicodeSet;
    18 }
     25//namespace UCD {
     26//class UnicodeSet;
     27//}
    1928
    2029/*   Marker streams represent the results of matching steps.
  • icGREP/icgrep-devel/icgrep/re/re_diff.cpp

    r4321 r5267  
    88#include "re_cc.h"
    99#include <llvm/Support/Casting.h>
     10
     11using namespace llvm;
    1012
    1113namespace re {
  • icGREP/icgrep-devel/icgrep/re/re_diff.h

    r4516 r5267  
    33
    44#include <re/re_re.h>
    5 #include <re/re_cc.h>
    65
    76namespace re {
  • icGREP/icgrep-devel/icgrep/re/re_intersect.cpp

    r4321 r5267  
    88#include "re_cc.h"
    99#include <llvm/Support/Casting.h>
     10
     11using namespace llvm;
    1012
    1113namespace re {
  • icGREP/icgrep-devel/icgrep/re/re_memoizer.hpp

    r5037 r5267  
    99struct MemoizerComparator {
    1010    inline bool operator() (const RE * lh, const RE * rh) const{
    11         if (LLVM_LIKELY(isa<Name>(lh) && isa<Name>(rh))) {
    12             return *cast<Name>(lh) < *cast<Name>(rh);
    13         } else if (isa<Name>(lh)) {
    14             return *cast<Name>(lh) < *cast<CC>(rh);
     11        if (LLVM_LIKELY(llvm::isa<Name>(lh) && llvm::isa<Name>(rh))) {
     12            return *llvm::cast<Name>(lh) < *llvm::cast<Name>(rh);
     13        } else if (llvm::isa<Name>(lh)) {
     14            return *llvm::cast<Name>(lh) < *llvm::cast<CC>(rh);
    1515        }
    16         return *cast<Name>(rh) > *cast<CC>(lh);
     16        return *llvm::cast<Name>(rh) > *llvm::cast<CC>(lh);
    1717    }
    1818};
     
    2323        auto f = find(cc);
    2424        if (f != end()) {
    25             return cast<Name>(*f);
     25            return llvm::cast<Name>(*f);
    2626        } else {
    2727            Name * name = makeName(cc);
     
    3232
    3333    inline Name * memoize(Name * name) {
    34         return cast<Name>(*insert(name).first);
     34        return llvm::cast<Name>(*insert(name).first);
    3535    }
    3636};
  • icGREP/icgrep-devel/icgrep/re/re_name.h

    r5234 r5267  
    44#include <re/re_re.h>
    55#include <re/re_cc.h>
    6 #include <string>
     6#include <llvm/Support/Casting.h>
    77
    88namespace UCD {
     
    102102
    103103inline bool Name::operator < (const Name & other) const {
    104     if (LLVM_LIKELY(mDefinition && other.mDefinition && isa<CC>(mDefinition) && isa<CC>(other.mDefinition))) {
    105         return *cast<CC>(mDefinition) < *cast<CC>(other.mDefinition);
     104    if (LLVM_LIKELY(mDefinition && other.mDefinition && llvm::isa<CC>(mDefinition) && llvm::isa<CC>(other.mDefinition))) {
     105        return *llvm::cast<CC>(mDefinition) < *llvm::cast<CC>(other.mDefinition);
    106106    } else if (mNamespaceLength < other.mNamespaceLength) {
    107107        return true;
     
    123123
    124124inline bool Name::operator < (const CC & other) const {
    125     if (mDefinition && isa<CC>(mDefinition)) {
    126         return *cast<CC>(mDefinition) < other;
     125    if (mDefinition && llvm::isa<CC>(mDefinition)) {
     126        return *llvm::cast<CC>(mDefinition) < other;
    127127    }
    128128    return false;
     
    130130
    131131inline bool Name::operator > (const CC & other) const {
    132     if (mDefinition && isa<CC>(mDefinition)) {
    133         return other < *cast<CC>(mDefinition);
     132    if (mDefinition && llvm::isa<CC>(mDefinition)) {
     133        return other < *llvm::cast<CC>(mDefinition);
    134134    }
    135135    return true;
     
    145145
    146146inline Name * makeName(const std::string & name, RE * cc) {
    147     if (isa<Name>(cc)) {
    148         return cast<Name>(cc);
     147    if (llvm::isa<Name>(cc)) {
     148        return llvm::cast<Name>(cc);
    149149    }
    150     else if (isa<CC>(cc)) {
    151         Name::Type ccType = cast<CC>(cc)->max_codepoint() <= 0x7F ? Name::Type::Byte : Name::Type::Unicode;
     150    else if (llvm::isa<CC>(cc)) {
     151        Name::Type ccType = llvm::cast<CC>(cc)->max_codepoint() <= 0x7F ? Name::Type::Byte : Name::Type::Unicode;
    152152        return new Name(nullptr, 0, name.c_str(), name.length(), ccType, cc);
    153153    }
  • icGREP/icgrep-devel/icgrep/re/re_name_resolve.cpp

    r5241 r5267  
     1#include "re_name_resolve.h"
    12#include <re/re_name.h>
    2 #include <re/re_any.h>
    3 #include <re/re_start.h>
    4 #include <re/re_end.h>
    53#include <re/re_alt.h>
    64#include <re/re_cc.h>
     
    1715#include <sstream>
    1816
    19 #include <re/printer_re.h>
    20 #include <iostream>
    21 
    2217using NameMap = UCD::UCDCompiler::NameMap;
    2318
    2419using namespace boost::container;
     20using namespace llvm;
    2521
    2622namespace re {
  • icGREP/icgrep-devel/icgrep/re/re_nullable.cpp

    r5150 r5267  
    11#include "re_nullable.h"
    2 #include <re/re_cc.h>
    3 #include <re/re_start.h>
    4 #include <re/re_end.h>
    5 #include <re/re_alt.h>
    6 #include <re/re_rep.h>
    7 #include <re/re_any.h>
    8 #include <re/re_diff.h>
    9 #include <re/re_intersect.h>
    10 #include <re/re_assertion.h>
    11 #include <re/re_name.h>
     2#include <re/re_alt.h>             // for Alt, makeAlt
     3#include <re/re_any.h>             // for makeAny, Any
     4#include <re/re_assertion.h>       // for Assertion, Assertion::Sense, Asser...
     5#include <re/re_diff.h>            // for Diff, makeDiff
     6#include <re/re_intersect.h>       // for Intersect
     7#include <re/re_name.h>            // for Name
     8#include <re/re_rep.h>             // for Rep, makeRep
     9#include <re/re_seq.h>             // for Seq, makeSeq
     10#include <vector>                  // for vector, allocator
     11#include <llvm/Support/Casting.h>  // for dyn_cast, isa
    1212
    1313/*
     
    1818
    1919*/
     20
     21using namespace llvm;
    2022
    2123namespace re {
  • icGREP/icgrep-devel/icgrep/re/re_nullable.h

    r5147 r5267  
    22#define RE_NULLABLE_H
    33
    4 //Regular Expressions
    5 #include "re_re.h"
    6 #include "re_seq.h"
    7 #include <vector>
     4namespace re { class RE; }
     5namespace re { class Vector; }
    86
    97namespace re {
  • icGREP/icgrep-devel/icgrep/re/re_parser.cpp

    r5241 r5267  
    1313#include <re/re_name.h>
    1414#include <re/re_alt.h>
     15#include <re/re_any.h>
    1516#include <re/re_end.h>
    1617#include <re/re_rep.h>
     
    2829#include <algorithm>
    2930#include <iostream>
     31#include <llvm/Support/Casting.h>
     32#include <llvm/Support/ErrorHandling.h>
     33
     34using namespace llvm;
    3035
    3136namespace re {
    32    
     37
     38template<typename T, typename... Args>
     39std::unique_ptr<T> make_unique(Args&&... args) {
     40    return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
     41}
    3342
    3443RE * RE_Parser::parse(const std::string & regular_expression, ModeFlagSet initialFlags, RE_Syntax syntax) {
     
    3645    switch (syntax) {
    3746        case RE_Syntax::PCRE:
    38             parser = llvm::make_unique<RE_Parser_PCRE>(regular_expression);
     47            parser = make_unique<RE_Parser_PCRE>(regular_expression);
    3948            break;
    4049        case RE_Syntax::ERE:
    41             parser = llvm::make_unique<RE_Parser_ERE>(regular_expression);
     50            parser = make_unique<RE_Parser_ERE>(regular_expression);
    4251            break;
    4352        case RE_Syntax ::BRE:
    44             parser = llvm::make_unique<RE_Parser_BRE>(regular_expression);
     53            parser = make_unique<RE_Parser_BRE>(regular_expression);
    4554            break;
    4655        case RE_Syntax ::PROSITE:
    47             parser = llvm::make_unique<RE_Parser_PROSITE>(regular_expression);
     56            parser = make_unique<RE_Parser_PROSITE>(regular_expression);
    4857            break;
    4958        default:
     
    11281137}
    11291138
    1130 }
     1139LLVM_ATTRIBUTE_NORETURN void RE_Parser::ParseFailure(std::string errmsg) {
     1140    llvm::report_fatal_error(errmsg);
     1141}
     1142
     1143}
  • icGREP/icgrep-devel/icgrep/re/re_parser.h

    r5241 r5267  
    88#define RE_PARSER_H
    99
    10 #include <re/re_re.h>
    11 #include <re/re_any.h>
    12 #include <re/re_name.h>
    13 #include <UCD/resolve_properties.h>
    14 #include <string>
    15 #include <list>
    16 #include <memory>
    17 #include <map>
    18 #include <re/re_memoizer.hpp>
    19 #include <llvm/Support/ErrorHandling.h>
     10#include <map>                           // for map
     11#include <re/re_memoizer.hpp>            // for Memoizer
     12#include "re/re_cc.h"                    // for codepoint_t, CC (ptr only)
     13namespace re { class Name; }
    2014
    2115namespace re {
    2216
    2317enum RE_Syntax {FixedStrings, BRE, ERE, PCRE, PROSITE};
     18
    2419enum CharsetOperatorKind
    2520    {intersectOp, setDiffOp, ampChar, hyphenChar, rangeHyphen, posixPropertyOpener, setOpener, setCloser, backSlash, emptyOperator};
     
    3833const int MAX_REPETITION_UPPER_BOUND = 2048;
    3934
    40 typedef unsigned ModeFlagSet;
     35using ModeFlagSet = unsigned;
    4136
     37class RE_Parser {
     38public:
    4239
    43 class RE_Parser
    44 {
    45 public:
     40    static LLVM_ATTRIBUTE_NORETURN void ParseFailure(std::string errmsg);
    4641
    4742    static RE * parse(const std::string &input_string, ModeFlagSet initialFlags, RE_Syntax syntax = RE_Syntax::PCRE);
    4843
    49    
    50     static LLVM_ATTRIBUTE_NORETURN void ParseFailure(std::string errmsg) {
    51         llvm::report_fatal_error(errmsg);
    52     }
    53    
    5444protected:
     45
    5546    using NameMap = std::map<std::pair<std::string, std::string>, re::Name *>;
    5647
  • icGREP/icgrep-devel/icgrep/re/re_parser_bre.cpp

    r5206 r5267  
    88#include <re/re_parser_helper.h>
    99#include <re/re_alt.h>
     10#include <re/re_any.h>
    1011#include <re/re_seq.h>
    1112#include <re/re_start.h>
     
    1314#include <re/re_assertion.h>
    1415#include <re/re_rep.h>
     16
    1517
    1618namespace re{
  • icGREP/icgrep-devel/icgrep/re/re_parser_ere.h

    r5206 r5267  
    99
    1010#include <re/re_parser.h>
     11
    1112namespace re {
    1213    class RE_Parser_ERE : public RE_Parser  {
  • icGREP/icgrep-devel/icgrep/re/re_parser_pcre.h

    r5206 r5267  
    99
    1010#include <re/re_parser.h>
     11
    1112namespace re {
    1213    class RE_Parser_PCRE : public RE_Parser {
  • icGREP/icgrep-devel/icgrep/re/re_parser_prosite.cpp

    r5233 r5267  
    88#include <re/re_parser_helper.h>
    99#include <re/re_alt.h>
     10#include <re/re_any.h>
    1011#include <re/re_seq.h>
    1112#include <re/re_start.h>
  • icGREP/icgrep-devel/icgrep/re/re_re.h

    r5240 r5267  
    88#define RE_H
    99
     10#include <util/slab_allocator.h>
    1011#include <vector>
    11 #include <assert.h>
    12 #include <llvm/Support/Casting.h>
    13 #include <util/slab_allocator.h>
    14 
    15 using namespace llvm;
    1612
    1713namespace re {
    18 
    19 class Vector;
    20 class Pair;
    21 
    22 class Alt;
    23 class Any;
    24 class Assertion;
    25 class CC;
    26 class Diff;
    27 class End;
    28 class Intersect;
    29 class Name;
    30 class Permute;
    31 class Rep;
    32 class Seq;
    33 class Start;
    34 class SymDiff;
    35 class Union;
    3614
    3715class RE {
  • icGREP/icgrep-devel/icgrep/re/re_rep.cpp

    r4971 r5267  
    55 */
    66
     7#include "re_rep.h"
    78#include "re_assertion.h"
    8 #include "re_rep.h"
    99#include "re_seq.h"
     10#include <llvm/Support/Casting.h>
     11
     12using namespace llvm;
    1013
    1114namespace re {
  • icGREP/icgrep-devel/icgrep/re/re_seq.h

    r5197 r5267  
    99
    1010#include "re_re.h"
    11 #include <string>
    12 #include <initializer_list>
     11#include <llvm/Support/Casting.h>
    1312
    1413namespace re {
     
    4443void Seq::flatten(itr begin, itr end) {
    4544    for (auto i = begin; i != end; ++i) {
    46         if (LLVM_UNLIKELY(isa<Seq>(*i))) {
    47             flatten<Seq::iterator>(cast<Seq>(*i)->begin(), cast<Seq>(*i)->end());
     45        if (LLVM_UNLIKELY(llvm::isa<Seq>(*i))) {
     46            flatten<Seq::iterator>(llvm::cast<Seq>(*i)->begin(), llvm::cast<Seq>(*i)->end());
    4847        } else {
    4948            push_back(*i);
  • icGREP/icgrep-devel/icgrep/re/re_simplifier.cpp

    r5091 r5267  
    1515#include <memory>
    1616#include <queue>
     17
     18using namespace llvm;
    1719
    1820namespace re {
  • icGREP/icgrep-devel/icgrep/re/re_toolchain.cpp

    r5234 r5267  
    55 */
    66
    7 #include <string>
     7#include <re/re_toolchain.h>
     8#include <cc/cc_compiler.h>            // for CC_Compiler
     9#include <llvm/Support/CommandLine.h>  // for clEnumVal, clEnumValEnd, Optio...
     10#include <re/re_compiler.h>            // for RE_Compiler
     11#include <re/re_nullable.h>            // for RE_Nullable
     12#include <re/re_simplifier.h>          // for RE_Simplifier
     13#include <re/printer_re.h>
    814#include <iostream>
    9 #include <fstream>
    10 
    11 #include <re/re_toolchain.h>
    12 #include <re/re_cc.h>
    13 #include <re/re_nullable.h>
    14 #include <re/re_simplifier.h>
    15 #include <re/re_alt.h>
    16 #include <re/re_parser.h>
    17 #include <re/re_compiler.h>
    18 #include <utf8_encoder.h>
    19 #include <cc/cc_compiler.h>
    20 #include <pablo/pablo_kernel.h>
    21 #include <re/printer_re.h>
    22 #include <llvm/Support/CommandLine.h>
    23 
    2415
    2516using namespace pablo;
     17using namespace llvm;
     18
    2619namespace re {
    2720
  • icGREP/icgrep-devel/icgrep/re/re_toolchain.h

    r5217 r5267  
    88#define RE_TOOLCHAIN_H
    99
    10 #include <llvm/Support/CommandLine.h>
    11 
    12 namespace pablo {
    13     class PabloKernel;
    14 }
     10namespace llvm { namespace cl { class OptionCategory; } }
     11namespace pablo { class PabloKernel; }
     12namespace re { class RE; }
    1513
    1614namespace re {
    17 
    18 class RE;
    1915
    2016enum RE_PrintFlags {
  • icGREP/icgrep-devel/icgrep/re/re_utility.cpp

    r5197 r5267  
    55 */
    66
     7#include "re_utility.h"
    78#include <re/re_any.h>
    89#include <re/re_name.h>
    910#include <re/re_alt.h>
    1011#include <re/re_seq.h>
    11 #include <re/re_start.h>
    12 #include <re/re_end.h>
    1312#include <re/re_diff.h>
    1413#include <re/re_assertion.h>
  • icGREP/icgrep-devel/icgrep/re/re_utility.h

    r5197 r5267  
    88#define RE_UTILITY_H
    99
    10 #include <re/re_re.h>
    11 #include <re/re_name.h>
     10namespace re { class RE; }
     11namespace re { class Name; }
    1212
    1313namespace re {
Note: See TracChangeset for help on using the changeset viewer.