Ignore:
Timestamp:
Dec 31, 2014, 9:19:55 AM (5 years ago)
Author:
cameron
Message:

Add support for \p{property=value}, Names are now namespace/name pairs.

File:
1 edited

Legend:

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

    r4358 r4377  
    364364
    365365RE * makeDigitSet() {
    366   return makeName("Nd", Name::Type::UnicodeCategory);
     366  return makeName("Nd", Name::Type::UnicodeProperty);
    367367}
    368368
     
    463463Name * RE_Parser::parse_property_expression() {
    464464    const cursor_t start = _cursor;
    465     while (_cursor != _end && *_cursor != '}' and *_cursor != ':') {
     465    while (_cursor != _end && *_cursor != '}' and *_cursor != ':' and *_cursor != '=') {
    466466        _cursor++;
    467467    }
    468     return makeName(std::string(start, _cursor), Name::Type::UnicodeCategory);
    469 }
    470    
     468    if (_cursor != _end && *_cursor == '=') {
     469        const cursor_t prop_end = _cursor;
     470        _cursor++;
     471        const cursor_t val_start = _cursor;
     472        while (_cursor != _end && *_cursor != '}' and *_cursor != ':') {
     473            _cursor++;
     474        }
     475        // We have a property-name = value expression
     476        return makeName(std::string(start, prop_end), std::string(val_start, _cursor), Name::Type::UnicodeProperty);
     477    }
     478    else return makeName(std::string(start, _cursor), Name::Type::UnicodeProperty);
     479}
     480
    471481CharsetOperatorKind RE_Parser::getCharsetOperator() {
    472482    throw_incomplete_expression_error_if_end_of_stream();
Note: See TracChangeset for help on using the changeset viewer.