Changeset 6169


Ignore:
Timestamp:
Oct 1, 2018, 10:13:20 PM (3 months ago)
Author:
cameron
Message:

-K flag for compatibility mode

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

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/re/grapheme_clusters.h

    r5881 r6169  
    55   
    66class RE;
    7     class Name;
     7class Name;
    88   
    99bool hasGraphemeClusterBoundary(const RE * re);
  • icGREP/icgrep-devel/icgrep/re/parsers/parser.cpp

    r5938 r6169  
    152152            case 'i': modeBit = CASE_INSENSITIVE_MODE_FLAG; break;
    153153            case 'g': modeBit = GRAPHEME_CLUSTER_MODE; break;
     154            case 'K': modeBit = COMPATIBLE_EQUIVALENCE_MODE; break;
    154155            case 'm': modeBit = MULTILINE_MODE_FLAG; break;
    155156                //case 's': modeBit = DOTALL_MODE_FLAG; break;
     
    176177            group_expr = makeGroup(Group::Mode::GraphemeMode, group_expr,
    177178                                   (fModeFlagSet & GRAPHEME_CLUSTER_MODE) == 0 ? Group::Sense::Off : Group::Sense::On);
     179        }
     180        if ((changed & COMPATIBLE_EQUIVALENCE_MODE) != 0) {
     181            group_expr = makeGroup(Group::Mode::CompatibilityMode, group_expr,
     182                                   (fModeFlagSet & COMPATIBLE_EQUIVALENCE_MODE) == 0 ? Group::Sense::Off : Group::Sense::On);
    178183        }
    179184        fModeFlagSet = savedModeFlagSet;
     
    193198                group_expr = makeGroup(Group::Mode::GraphemeMode, group_expr,
    194199                                       (fModeFlagSet & GRAPHEME_CLUSTER_MODE) == 0 ? Group::Sense::Off : Group::Sense::On);
     200            }
     201            if ((changed & COMPATIBLE_EQUIVALENCE_MODE) != 0) {
     202                group_expr = makeGroup(Group::Mode::CompatibilityMode, group_expr,
     203                                       (fModeFlagSet & COMPATIBLE_EQUIVALENCE_MODE) == 0 ? Group::Sense::Off : Group::Sense::On);
    195204            }
    196205            return group_expr;
     
    224233        } else if (accept('|')) { // negative look ahead
    225234            group_expr = makeBranchResetGroup(parse_alt());
    226         } else if (atany("-dimsxg")) { // mode switches
     235        } else if (atany("-dimsxgK")) { // mode switches
    227236            bool closing_paren_parsed;
    228237            group_expr = parse_mode_group(closing_paren_parsed);
  • icGREP/icgrep-devel/icgrep/re/parsers/parser.h

    r6168 r6169  
    2525    IGNORE_SPACE_MODE_FLAG = 8,
    2626    UNIX_LINES_MODE_FLAG = 16,
    27     GRAPHEME_CLUSTER_MODE = 32
     27    GRAPHEME_CLUSTER_MODE = 32,
     28    COMPATIBLE_EQUIVALENCE_MODE = 64
    2829};
    2930
  • icGREP/icgrep-devel/icgrep/re/printer_re.cpp

    r5847 r6169  
    135135            retVal.append((g->getSense() == Group::Sense::On) ? "+i:" : "-i:");
    136136        }
     137        else if (g->getMode() == Group::Mode::CompatibilityMode) {
     138            retVal.append((g->getSense() == Group::Sense::On) ? "+K:" : "-K:");
     139        }
    137140        retVal.append(PrintRE(g->getRE()));
    138141        retVal.append(")");
  • icGREP/icgrep-devel/icgrep/re/re_diff.cpp

    r6159 r6169  
    1515
    1616RE * makeDiff(RE * lh, RE * rh) {
    17     if (defined<CC>(lh) && defined<CC>(rh)) {
    18         CC * lh_cc = defCast<CC>(lh);
    19         CC * rh_cc = defCast<CC>(rh);
    20         if (lh_cc->getAlphabet() == rh_cc->getAlphabet())
    21             return subtractCC(lh_cc, rh_cc);
    22     }
    2317    return new Diff(lh, rh);
    2418}
  • icGREP/icgrep-devel/icgrep/re/re_group.h

    r5767 r6169  
    1616    static inline bool classof(const void *) {return false;}
    1717   
    18     enum class Mode {CaseInsensitiveMode, GraphemeMode};
     18    enum class Mode {CaseInsensitiveMode, GraphemeMode, CompatibilityMode};
    1919    enum class Sense {On, Off};
    2020    Mode getMode() const {return mMode;}
Note: See TracChangeset for help on using the changeset viewer.