Changeset 3993


Ignore:
Timestamp:
Aug 12, 2014, 7:08:28 AM (4 years ago)
Author:
cameron
Message:

Parse negated classes \P{}

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

Legend:

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

    r3955 r3993  
    331331        else if (s.operator [](1) == 'p')
    332332        {
    333             return cc_retVal = parse_unicode_category(s.substr(2, s.length() - 2));
     333            return cc_retVal = parse_unicode_category(s.substr(2, s.length() - 2), /* negated = */ false);
     334        }
     335        else if (s.operator [](1) == 'P')
     336        {
     337            return cc_retVal = parse_unicode_category(s.substr(2, s.length() - 2), /* negated = */ true);
    334338        }
    335339        else
     
    446450}
    447451
    448 parse_result_retVal RE_Parser::parse_unicode_category(std::string s)
     452parse_result_retVal RE_Parser::parse_unicode_category(std::string s, bool negated)
    449453{
    450454    parse_result_retVal result_retVal;
     
    454458        Name* name = new Name();
    455459        name->setType(Name::UnicodeCategory);
     460        name->setNegated(negated);
    456461        result_retVal = parse_unicode_category1(s.substr(1,1), s.substr(2, s.length() - 2), name);
    457462    }
  • icGREP/icgrep-devel/icgrep/re_parser.h

    r3935 r3993  
    6464    static parse_result_retVal parse_utf8_suffix_byte(int suffix_byte_num, std::string s, Seq* seq_sofar);
    6565
    66     static parse_result_retVal parse_unicode_category(std::string s);
     66    static parse_result_retVal parse_unicode_category(std::string s, bool negated);
    6767    static parse_result_retVal parse_unicode_category1(std::string character, std::string s, Name* name_sofar);
    6868    static bool isValidUnicodeCategoryName(Name* name);
Note: See TracChangeset for help on using the changeset viewer.