Ignore:
Timestamp:
Dec 8, 2017, 8:20:54 PM (18 months ago)
Author:
cameron
Message:

Regular expression group nodes; case-insensitive logic

File:
1 edited

Legend:

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

    r5663 r5765  
    1717#include <re/re_seq.h>
    1818#include <re/re_start.h>
     19#include <re/re_range.h>
    1920#include <re/re_diff.h>
    2021#include <re/re_intersect.h>
    2122#include <re/re_assertion.h>
     23#include <re/re_group.h>
    2224
    2325using namespace re;
     
    4749        for (const auto & i : *re_cc) {
    4850            retVal += "[";
    49             retVal += std::to_string(lo_codepoint(i)) + ",";
    50             retVal += std::to_string(hi_codepoint(i));
     51            retVal += std::to_string(lo_codepoint(i));
     52            if (hi_codepoint(i) != lo_codepoint(i))
     53                retVal += "-" + std::to_string(hi_codepoint(i));
    5154            retVal += "]";
    5255        }
     
    6265            retVal += "=(" + PrintRE(re_name->getDefinition()) + ")";
    6366        }
     67    } else if (const Range* rg = dyn_cast<const Range>(re)) {
     68        retVal = "Range (";
     69        retVal += PrintRE(rg->getLo());
     70        retVal += " , ";
     71        retVal += PrintRE(rg->getHi());
     72        retVal += ") ";
    6473    } else if (const Assertion * a = dyn_cast<const Assertion>(re)) {
    6574        retVal = (a->getSense() == Assertion::Sense::Positive) ? "" : "Negative";
     
    116125        }
    117126        retVal.append("])");
     127    } else if (const Group * g = dyn_cast<const Group>(re)) {
     128        retVal = "Group(";
     129        if (g->getMode() == Group::Mode::GraphemeMode) {
     130            retVal.append((g->getSense() == Group::Sense::On) ? "+g:" : "-g:");
     131        }
     132        else if (g->getMode() == Group::Mode::CaseInsensitiveMode) {
     133            retVal.append((g->getSense() == Group::Sense::On) ? "+i:" : "-i:");
     134        }
     135        retVal.append(PrintRE(g->getRE()));
     136        retVal.append(")");
    118137    } else if (isa<const Start>(re)) {
    119138        retVal = "Start";
Note: See TracChangeset for help on using the changeset viewer.