Ignore:
Timestamp:
Dec 21, 2017, 9:01:44 PM (18 months ago)
Author:
cameron
Message:

makeByte uses the Byte alphabet

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

Legend:

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

    r5795 r5797  
    5353    friend CC * subtractCC(const CC * a, const CC * b);
    5454    friend CC * intersectCC(const CC * a, const CC * b);
     55    friend CC * makeByte(const codepoint_t codepoint);
     56    friend CC * makeByte(const codepoint_t lo, const codepoint_t hi);
    5557
    5658    CC(const cc::Alphabet * alphabet);
     
    109111}
    110112
    111     inline CC * makeCC(const codepoint_t codepoint, const cc::Alphabet * alphabet = &cc::Unicode) {
     113inline CC * makeCC(const codepoint_t codepoint, const cc::Alphabet * alphabet = &cc::Unicode) {
    112114    return new CC(codepoint, alphabet);
    113115}
     
    143145}
    144146
     147inline CC * makeByte(const codepoint_t codepoint) {
     148    return new CC(codepoint, &cc::Byte);
     149}
     150
     151inline CC * makeByte(const codepoint_t lo, const codepoint_t hi) {
     152    return new CC(lo, hi, &cc::Byte);
     153}
     154   
    145155}
    146156
  • icGREP/icgrep-devel/icgrep/re/re_name.h

    r5781 r5797  
    4646    friend Name * makeZeroWidth(const std::string & name, RE * zerowidth);
    4747    friend Name * makeName(CC * const cc);
    48     friend Name * makeByte(CC * const cc);
    4948    friend Name * makeName(const std::string &, Type);
    5049    friend Name * makeName(const std::string &, const std::string &, Type);
     
    163162}
    164163
    165 inline Name * makeByte(CC * const cc) {
    166     assert(cc->max_codepoint() <= 0xFF);
    167     const std::string name = cc->canonicalName(CC_type::ByteClass);
    168     return new Name(nullptr, 0, name.c_str(), name.length(), Name::Type::Byte, cc);
    169 }
    170    
    171     inline Name * makeCapture(const std::string & name, RE * captured) {
     164inline Name * makeCapture(const std::string & name, RE * captured) {
    172165    return new Name(nullptr, 0, name.c_str(), name.length(), Name::Type::Capture, captured);
    173166}
  • icGREP/icgrep-devel/icgrep/re/re_parser.cpp

    r5792 r5797  
    123123    if ((flags & ModeFlagType::MULTILINE_MODE_FLAG) == 0) return makeZeroWidth("^s");  //single-line mode
    124124    if ((flags & ModeFlagType::UNIX_LINES_MODE_FLAG) != 0) {
    125         return makeNegativeLookBehindAssertion(makeByte(makeCC(makeCC(0, '\n'-1), makeCC('\n'+1, 0xFF))));
     125        return makeNegativeLookBehindAssertion(makeCC(makeByte(0, '\n'-1), makeByte('\n'+1, 0xFF)));
    126126    }
    127127    return makeStart();
     
    130130    if ((flags & ModeFlagType::MULTILINE_MODE_FLAG) == 0) return makeZeroWidth("$s");  //single-line mode
    131131    if ((flags & ModeFlagType::UNIX_LINES_MODE_FLAG) != 0) {
    132         return makeNegativeLookAheadAssertion(makeByte(makeCC(makeCC(0, '\n'-1), makeCC('\n'+1, 0xFF))));
     132        return makeNegativeLookAheadAssertion(makeCC(makeByte(0, '\n'-1), makeByte('\n'+1, 0xFF)));
    133133    }
    134134    return makeEnd();
     
    349349        codepoint_t cp = parse_escaped_codepoint();
    350350        if ((cp >= 0x80) && (cp <= 0xFF)) {
    351             return makeByte(makeCC(cp));
     351            return makeByte(cp);
    352352        }
    353353        else return createCC(cp);
Note: See TracChangeset for help on using the changeset viewer.