File size: 3,363 Bytes
72629ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#if !defined PAWNREGEX_INC_
    #define PAWNREGEX_INC_
    #define _pawnregex_included
    #if !defined PACK_PLUGIN_VERSION
        #define PACK_PLUGIN_VERSION(%0,%1,%2) (((%0) << 16) | ((%1) << 8) | (%2))

    #endif

    #define PAWNREGEX_VERSION PACK_PLUGIN_VERSION(1, 2, 3)

    #define PAWNREGEX_INCLUDE_VERSION PAWNREGEX_VERSION

    enum E_REGEX_GRAMMAR

    {

        REGEX_ECMASCRIPT,

        REGEX_BASIC,

        REGEX_EXTENDED,

        REGEX_AWK,

        REGEX_GREP,

        REGEX_EGREP

    };

    enum E_REGEX_FLAG

    {

        REGEX_DEFAULT = 1 << 0,

        REGEX_ICASE = 1 << 1,

        REGEX_NOSUBS = 1 << 2,

        REGEX_OPTIMIZE = 1 << 3,

        REGEX_COLLATE = 1 << 4,

    };

    enum E_MATCH_FLAG

    {

        MATCH_DEFAULT = 1 << 0,

        MATCH_NOT_BOL = 1 << 1,

        MATCH_NOT_EOL = 1 << 2,

        MATCH_NOT_BOW = 1 << 3,

        MATCH_NOT_EOW = 1 << 4,

        MATCH_ANY = 1 << 5,

        MATCH_NOT_NULL = 1 << 6,

        MATCH_CONTINUOUS = 1 << 7,

        MATCH_PREV_AVAIL = 1 << 8,

        MATCH_FORMAT_SED = 1 << 9,

        MATCH_FORMAT_NO_COPY = 1 << 10,

        MATCH_FORMAT_FIRST_ONLY = 1 << 11,

    };

    #if !defined __cplusplus

        public _pawnregex_version = PAWNREGEX_VERSION;

        #pragma unused _pawnregex_version

        native Regex:Regex_New(const pattern[], E_REGEX_FLAG:flags = REGEX_DEFAULT, E_REGEX_GRAMMAR:grammar = REGEX_ECMASCRIPT);

        native Regex_Delete(&Regex:r);

        native Regex_Check(const str[], Regex:r, E_MATCH_FLAG:flags = MATCH_DEFAULT);

        native Regex_Match(const str[], Regex:r, &RegexMatch:m, E_MATCH_FLAG:flags = MATCH_DEFAULT);

        native Regex_Search(const str[], Regex:r, &RegexMatch:m, &pos, startpos = 0, E_MATCH_FLAG:flags = MATCH_DEFAULT);

        native Regex_Replace(const str[], Regex:r, const fmt[], dest[], E_MATCH_FLAG:flags = MATCH_DEFAULT, size = sizeof dest);

        native Match_GetGroup(RegexMatch:m, index, dest[], &length, size = sizeof dest);

        native Match_Free(&RegexMatch:m);

        #pragma deprecated Use Regex_New instead

        native regex:regex_new(const pattern[], E_REGEX_FLAG:flags = REGEX_DEFAULT, E_REGEX_GRAMMAR:grammar = REGEX_ECMASCRIPT) = Regex_New;

        #pragma deprecated Use Regex_Delete instead

        native regex_delete(&regex:r) = Regex_Delete;

        #pragma deprecated Use Regex_Check instead

        native regex_check(const str[], regex:r, E_MATCH_FLAG:flags = MATCH_DEFAULT) = Regex_Check;

        #pragma deprecated Use Regex_Match instead

        native regex_match(const str[], regex:r, &match_results:m, E_MATCH_FLAG:flags = MATCH_DEFAULT) = Regex_Match;

        #pragma deprecated Use Regex_Search instead

        native regex_search(const str[], regex:r, &match_results:m, &pos, startpos = 0, E_MATCH_FLAG:flags = MATCH_DEFAULT) = Regex_Search;

        #pragma deprecated Use Regex_Replace instead

        native regex_replace(const str[], regex:r, const fmt[], dest[], E_MATCH_FLAG:flags = MATCH_DEFAULT, size = sizeof dest) = Regex_Replace;

        #pragma deprecated Use Match_GetGroup instead

        native match_get_group(match_results:m, index, dest[], &length, size = sizeof dest) = Match_GetGroup;

        #pragma deprecated Use Match_Free instead

        native match_free(&match_results:m) = Match_Free;

    #endif

#endif