Changeset 5803


Ignore:
Timestamp:
Dec 24, 2017, 7:31:39 AM (3 weeks ago)
Author:
cameron
Message:

Regular expression toolchain progress

Location:
icGREP/icgrep-devel/icgrep
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/grep_engine.cpp

    r5801 r5803  
    125125    std::vector<StreamSetBuffer *> MatchResultsBufs(n);
    126126
    127     for(unsigned i = 0; i < n; ++i){
     127    for(unsigned i = 0; i < n; ++i) {
     128        REs[i] = resolveModesAndExternalSymbols(REs[i]);
     129        REs[i] = excludeUnicodeLineBreak(REs[i]);
    128130#define USE_MULTIPLEX_CC
    129131#ifdef USE_MULTIPLEX_CC
  • icGREP/icgrep-devel/icgrep/re/re_name_resolve.cpp

    r5802 r5803  
    6464            a->setAsserted(resolveUnicodeProperties(a->getAsserted()));
    6565        } else if (Range * rg = dyn_cast<Range>(re)) {
    66             rg->setLo(resolveUnicodeProperties(rg->getLo()));
    67             rg->setHi(resolveUnicodeProperties(rg->getHi()));
     66            return makeRange(resolveUnicodeProperties(rg->getLo()),
     67                             resolveUnicodeProperties(rg->getHi()));
    6868        } else if (Diff * diff = dyn_cast<Diff>(re)) {
    6969            diff->setLH(resolveUnicodeProperties(diff->getLH()));
     
    131131            a->setAsserted(resolve(a->getAsserted()));
    132132        } else if (Range * rg = dyn_cast<Range>(re)) {
    133             rg->setLo(resolve(rg->getLo()));
    134             rg->setHi(resolve(rg->getHi()));
     133            return makeRange(resolve(rg->getLo()), resolve(rg->getHi()));
    135134        } else if (Diff * diff = dyn_cast<Diff>(re)) {
    136135            diff->setLH(resolve(diff->getLH()));
  • icGREP/icgrep-devel/icgrep/re/re_toolchain.cpp

    r5795 r5803  
    6161                         cl::cat(RegexOptions));
    6262
     63RE * resolveModesAndExternalSymbols(RE * r) {
     64    r = resolveGraphemeMode(r, false /* not in grapheme mode at top level*/);
     65    if (PrintOptions.isSet(ShowAllREs)) {
     66        errs() << "resolveGraphemeMode:\n" << Printer_RE::PrintRE(r) << '\n';
     67    }
     68    r = re::resolveUnicodeProperties(r);
     69    if (PrintOptions.isSet(ShowAllREs)) {
     70        errs() << "resolveUnicodeProperties:\n" << Printer_RE::PrintRE(r) << '\n';
     71    }
     72    r = resolveCaseInsensitiveMode(r, grep::IgnoreCaseFlag);
     73    if (PrintOptions.isSet(ShowAllREs)) {
     74        errs() << "resolveCaseInsensitiveMode:\n" << Printer_RE::PrintRE(r) << '\n';
     75    }
     76}
     77
     78RE * excludeUnicodeLineBreak(RE * r) {
     79    r = exclude_CC(r, re::makeCC(re::makeCC(0x0A, 0x0D), re::makeCC(re::makeCC(0x85), re::makeCC(0x2028, 0x2029))));
     80    if (PrintOptions.isSet(ShowAllREs)) {
     81        errs() << "excludeUnicodeLineBreak:\n" << Printer_RE::PrintRE(r) << '\n';
     82    }
     83}
    6384
    6485RE * multiplexing_prepasses(RE * r) {
     
    81102    }
    82103    r = RE_Star_Normal::star_normal(r);
    83 
    84     r = resolveGraphemeMode(r, false /* not in grapheme mode at top level*/);
    85     if (PrintOptions.isSet(ShowAllREs)) {
    86         errs() << "resolveGraphemeMode:\n" << Printer_RE::PrintRE(r) << '\n';
    87     }
    88     r = re::resolveUnicodeProperties(r);
    89     if (PrintOptions.isSet(ShowAllREs) || PrintOptions.isSet(ShowStrippedREs)) {
    90         errs() << "resolveUnicodeProperties:\n" << Printer_RE::PrintRE(r) << '\n';
    91     }
    92 
    93     r = RE_Simplifier::simplify(r);
    94    
    95     if (PrintOptions.isSet(ShowAllREs) || PrintOptions.isSet(ShowSimplifiedREs)) {
    96         //Print to the terminal the AST that was generated by the simplifier.
    97         errs() << "Simplifier:\n" << Printer_RE::PrintRE(r) << '\n';
    98     }
    99104    if (PrintOptions.isSet(ShowAllREs) || PrintOptions.isSet(ShowSimplifiedREs)) {
    100105        //Print to the terminal the AST that was transformed to the star normal form.
    101106        errs() << "Star_Normal_Form:\n" << Printer_RE::PrintRE(r) << '\n';
    102     }
    103     r = resolveCaseInsensitiveMode(r, grep::IgnoreCaseFlag);
    104     if (PrintOptions.isSet(ShowAllREs)) {
    105         errs() << "resolveCaseInsensitiveMode:\n" << Printer_RE::PrintRE(r) << '\n';
    106107    }
    107108    r = re::resolveNames(r);
     
    109110        errs() << "resolveNames:\n" << Printer_RE::PrintRE(r) << '\n';
    110111    }
    111     r = exclude_CC(r, re::makeCC(re::makeCC(0x0A, 0x0D), re::makeCC(re::makeCC(0x85), re::makeCC(0x2028, 0x2029))));
    112     if (PrintOptions.isSet(ShowAllREs)) {
    113         errs() << "exclude_CC:\n" << Printer_RE::PrintRE(r) << '\n';
     112
     113    r = RE_Simplifier::simplify(r);
     114    if (PrintOptions.isSet(ShowAllREs) || PrintOptions.isSet(ShowSimplifiedREs)) {
     115        //Print to the terminal the AST that was generated by the simplifier.
     116        errs() << "Simplifier:\n" << Printer_RE::PrintRE(r) << '\n';
    114117    }
    115118    return r;
  • icGREP/icgrep-devel/icgrep/re/re_toolchain.h

    r5795 r5803  
    3030const llvm::cl::OptionCategory * re_toolchain_flags();
    3131
    32 RE * regular_expression_passes(RE * re_ast);
     32RE * resolveModesAndExternalSymbols(RE * r);
     33
     34RE * excludeUnicodeLineBreak(RE * r);
     35
     36RE * regular_expression_passes(RE * r);
    3337
    3438RE * multiplexing_prepasses(RE * r);
Note: See TracChangeset for help on using the changeset viewer.