Ignore:
Timestamp:
Dec 9, 2017, 4:37:51 PM (19 months ago)
Author:
cameron
Message:

Restructure to eliminate unnecessary dependencies on RegExpCompiler? and UCDLIB

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

Legend:

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

    r5768 r5770  
    11#include <re/casing.h>
    22#include <re/re_cc.h>
     3#include <UCD/unicode_set.h>
     4#include <UCD/CaseFolding.h>
    35#include <re/re_alt.h>             // for Alt, makeAlt
    46#include <re/re_any.h>             // for makeAny, Any
     
    2224RE * resolveCaseInsensitiveMode(RE * re, bool inCaseInsensitiveMode) {
    2325    if (isa<CC>(re)) {
    24         if (inCaseInsensitiveMode) return caseInsensitize(cast<CC>(re));
     26        if (inCaseInsensitiveMode) {
     27            UCD::UnicodeSet * cased = caseInsensitize(cast<CC>(re));
     28            return makeCC(std::move(*cased));
     29        }
    2530        else return re;
    2631    }
  • icGREP/icgrep-devel/icgrep/re/re_analysis.cpp

    r5736 r5770  
    1212#include <re/re_intersect.h>
    1313#include <re/re_assertion.h>
     14#include <re/re_group.h>
    1415#include <re/re_nullable.h>
    1516#include <re/printer_re.h>
     
    5253    } else if (isa<CC>(re)) {
    5354        return false;
     55    } else if (const Group * g = dyn_cast<Group>(re)) {
     56        return matchesEmptyString(g->getRE());
    5457    } else if (const Name * n = dyn_cast<Name>(re)) {
    5558        return matchesEmptyString(n->getDefinition());
     
    368371    } else if (isa<Start>(re) || isa<End>(re) || isa<Assertion>(re)) {
    369372        return true;
     373    } else if (const Group * g = dyn_cast<Group>(re)) {
     374        if ((g->getMode() == Group::Mode::GraphemeMode) && (g->getSense() == Group::Sense::On)) {
     375            return true;
     376        }
     377        else {
     378            return hasAssertion(g->getRE());
     379        }
    370380    }
    371381    else llvm_unreachable("Unknown RE type");
  • icGREP/icgrep-devel/icgrep/re/re_cc.cpp

    r5748 r5770  
    77#include "re_cc.h"
    88#include <llvm/Support/Compiler.h>
    9 #include <UCD/CaseFolding.h>
    109#include <sstream>
    1110
     
    3433}
    3534   
    36 CC * caseInsensitize(const CC * cc) {
    37     CC * cci = makeCC();
    38     for (const interval_t i : *cc) {
    39         caseInsensitiveInsertRange(cci, lo_codepoint(i), hi_codepoint(i));
    40     }
    41     return cci;
    42 }
    43 
    4435CC::CC()
    4536: RE(ClassTypeId::CC)
  • icGREP/icgrep-devel/icgrep/re/re_cc.h

    r5748 r5770  
    136136}
    137137
    138 CC * caseInsensitize(const CC * cc);
    139 
    140138}
    141139
  • icGREP/icgrep-devel/icgrep/re/re_parser.cpp

    r5769 r5770  
    856856                    }
    857857                }
    858                 if (fModeFlagSet & CASE_INSENSITIVE_MODE_FLAG) {
    859                     if (CC * cc1 = dyn_cast<CC>(newOperand)) {
    860                         newOperand = caseInsensitize(cc1);
    861                     }
    862                 }
    863858                return negated ? makeComplement(newOperand) : newOperand;
    864859            }
Note: See TracChangeset for help on using the changeset viewer.