source: icGREP/icgrep-devel/icgrep/re/re_utility.cpp

Last change on this file was 5267, checked in by nmedfort, 10 months ago

Code clean-up. Removed Pablo Call, SetIthBit? and Prototype.

File size: 1.5 KB
Line 
1/*
2 *  Copyright (c) 2016 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#include "re_utility.h"
8#include <re/re_any.h>
9#include <re/re_name.h>
10#include <re/re_alt.h>
11#include <re/re_seq.h>
12#include <re/re_diff.h>
13#include <re/re_assertion.h>
14
15namespace re {
16   
17RE * makeComplement(RE * s) {
18  return makeDiff(makeAny(), s);
19}
20
21                           
22Name * makeDigitSet() {
23    return makeName("nd", Name::Type::UnicodeProperty);
24}
25
26Name * makeAlphaNumeric() {
27    return makeName("alnum", Name::Type::UnicodeProperty);
28}
29
30Name * makeWhitespaceSet() {
31    return makeName("whitespace", Name::Type::UnicodeProperty);
32}
33
34Name * makeWordSet() {
35    return makeName("word", Name::Type::UnicodeProperty);
36}
37
38RE * makeWordBoundary() {
39    Name * wordC = makeWordSet();
40    return makeAlt({makeSeq({makeNegativeLookBehindAssertion(wordC), makeLookAheadAssertion(wordC)}),
41        makeSeq({makeLookBehindAssertion(wordC), makeNegativeLookAheadAssertion(wordC)})});
42}
43
44RE * makeWordNonBoundary() {
45    Name * wordC = makeWordSet();
46    return makeAlt({makeSeq({makeNegativeLookBehindAssertion(wordC), makeNegativeLookAheadAssertion(wordC)}),
47        makeSeq({makeLookBehindAssertion(wordC), makeLookAheadAssertion(wordC)})});
48}
49
50RE * makeWordBegin() {
51    Name * wordC = makeWordSet();
52    return makeNegativeLookBehindAssertion(wordC);
53}
54
55RE * makeWordEnd() {
56    Name * wordC = makeWordSet();
57    return makeNegativeLookAheadAssertion(wordC);
58}
59
60   
61}
Note: See TracBrowser for help on using the repository browser.