Ignore:
Timestamp:
Jan 6, 2015, 6:29:25 PM (5 years ago)
Author:
cameron
Message:

AST support for Lookahead/Lookbehind? assertions

File:
1 edited

Legend:

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

    r4402 r4405  
    1414#include <re/re_diff.h>
    1515#include <re/re_intersect.h>
     16#include <re/re_assertion.h>
    1617#include <re/parsefailure.h>
    1718#include <UCD/CaseFolding_txt.h>
     
    4748
    4849RE * makeLookAheadAssertion(RE * r) {
    49     throw ParseFailure("Lookahead assertion not supported.");
     50    return makeAssertion(r, Assertion::Kind::Lookahead, Assertion::Sense::Positive);
    5051}
    5152
    5253RE * makeNegativeLookAheadAssertion(RE * r) {
    53     throw ParseFailure("Lookahead assertion not supported.");
     54    return makeAssertion(r, Assertion::Kind::Lookahead, Assertion::Sense::Negative);
    5455}
    5556
    5657RE * makeLookBehindAssertion(RE * r) {
    57     throw ParseFailure("Lookbehind assertion not supported.");
     58    return makeAssertion(r, Assertion::Kind::Lookbehind, Assertion::Sense::Positive);
    5859}
    5960
    6061RE * makeNegativeLookBehindAssertion(RE * r) {
    61     throw ParseFailure("Lookbehind assertion not supported.");
     62    return makeAssertion(r, Assertion::Kind::Lookbehind, Assertion::Sense::Negative);
    6263}
    6364
     
    198199                throw_incomplete_expression_error_if_end_of_stream();
    199200                if (*_cursor == '=') {
     201                    ++_cursor;
    200202                    subexpr = parse_alt();
    201203                    group_expr = makeLookBehindAssertion(subexpr);
    202204                }
    203205                else if (*_cursor == '!') {
     206                    ++_cursor;
    204207                    subexpr = parse_alt();
    205208                    group_expr = makeNegativeLookBehindAssertion(subexpr);
Note: See TracChangeset for help on using the changeset viewer.