| 1 | #cxx . . $ `<file>/melder/regularExp.h`/ifndef _regularExp_h_ |
| 2 | #define _regularExp_h_cxx . . $ `melder/regularExp.h:2:9`! |
| 3 | /******************************************************************************* |
| 4 | * * |
| 5 | * regularExp.h -- Nirvana Editor Regular Expression Package Header File * |
| 6 | * * |
| 7 | * Copyright 2002 The NEdit Developers * |
| 8 | * * |
| 9 | * This is free software; you can redistribute it and/or modify it under the * |
| 10 | * terms of the GNU General Public License as published by the Free Software * |
| 11 | * Foundation; either version 2 of the License, or (at your option) any later * |
| 12 | * version. In addition, you may distribute version of this program linked to * |
| 13 | * Motif or Open Motif. See README for details. * |
| 14 | * * |
| 15 | * This software is distributed in the hope that it will be useful, but WITHOUT * |
| 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * |
| 18 | * for more details. * |
| 19 | * * |
| 20 | * You should have received a copy of the GNU General Public License along with * |
| 21 | * software; if not, write to the Free Software Foundation, Inc., 59 Temple * |
| 22 | * Place, Suite 330, Boston, MA 02111-1307 USA * |
| 23 | * * |
| 24 | * Nirvana Text Editor * |
| 25 | * July 31, 2001 * |
| 26 | * * |
| 27 | * * |
| 28 | *******************************************************************************/ |
| 29 | /* |
| 30 | djmw 20080110 Extra parameter for SubstituteRE to allow error differentiation |
| 31 | */ |
| 32 | |
| 33 | /* Number of text capturing parentheses allowed. */ |
| 34 | |
| 35 | #include "melder.h"cxx . . $ `<file>/melder/melder.h`/ |
| 36 | |
| 37 | #define NSUBEXPcxx . . $ `melder/regularExp.h:37:9`! 50 |
| 38 | |
| 39 | /* Structure to contain the compiled form of a regular expression plus |
| 40 | pointers to matched text. `program' is the actual compiled regex code. */ |
| 41 | |
| 42 | typedef struct regexpcxx . . $ regexp# { |
| 43 | char32cxx . . $ char32# *startpcxx . . $ regexp#startp. [NSUBEXPcxx . . $ `melder/regularExp.h:37:9`!]; /* Captured text starting locations. */ |
| 44 | char32cxx . . $ char32# *endpcxx . . $ regexp#endp. [NSUBEXPcxx . . $ `melder/regularExp.h:37:9`!]; /* Captured text ending locations. */ |
| 45 | char32cxx . . $ char32# *extentpBWcxx . . $ regexp#extentpBW.; /* Points to the maximum extent of text scanned by |
| 46 | ExecRE in front of the string to achieve a match |
| 47 | (needed because of positive look-behind.) */ |
| 48 | char32cxx . . $ char32# *extentpFWcxx . . $ regexp#extentpFW.; /* Points to the maximum extent of text scanned by |
| 49 | ExecRE to achieve a match (needed because of |
| 50 | positive look-ahead.) */ |
| 51 | int top_branchcxx . . $ regexp#top_branch.; /* Zero-based index of the top branch that matches. |
| 52 | Used by syntax highlighting only. */ |
| 53 | char32cxx . . $ char32# match_startcxx . . $ regexp#match_start.; /* Internal use only. */ |
| 54 | char32cxx . . $ char32# anchorcxx . . $ regexp#anchor.; /* Internal use only. */ |
| 55 | char32cxx . . $ char32# programcxx . . $ regexp#program. [1]; /* Unwarranted chumminess with compiler. */ |
| 56 | } regexpcxx . . $ regexp#; |
| 57 | |
| 58 | /* Flags for CompileRE default settings (Markus Schwarzenberg) */ |
| 59 | |
| 60 | typedef enumcxx . . $ $anonymous_type_9b7b2e54ffcf7bcd_0# { |
| 61 | REDFLT_STANDARDcxx . . $ REDFLT_STANDARD. = 0, |
| 62 | REDFLT_CASE_INSENSITIVEcxx . . $ REDFLT_CASE_INSENSITIVE. = 1 |
| 63 | /* REDFLT_MATCH_NEWLINE = 2 Currently not used. */ |
| 64 | } RE_DEFAULT_FLAGcxx . . $ RE_DEFAULT_FLAG#; |
| 65 | |
| 66 | /* Compiles a regular expression into the internal format used by `ExecRE'. */ |
| 67 | |
| 68 | regexpcxx . . $ regexp# * CompileREcxx . . $ CompileRE(5071b94b786a4c4b). ( |
| 69 | conststring32cxx . . $ conststring32# exp, /* String containing the regex specification. */ |
| 70 | conststring32cxx . . $ conststring32# *errorText, /* Text of any error message produced. */ |
| 71 | int defaultFlags); /* Flags for default RE-operation */ |
| 72 | |
| 73 | regexpcxx . . $ regexp# *CompileRE_throwablecxx . . $ CompileRE_throwable(883f0876ef3038d2). (conststring32cxx . . $ conststring32# exp, int defaultFlags); |
| 74 | |
| 75 | /* Match a `regexp' structure against a string. */ |
| 76 | |
| 77 | int ExecREcxx . . $ ExecRE(adb1c5d556f61044). ( |
| 78 | regexpcxx . . $ regexp# *prog, /* Compiled regex. */ |
| 79 | regexpcxx . . $ regexp# *cross_regex_backref, /* Pointer to a `regexp' that was used in a |
| 80 | previous execution of ExecRE. Used to |
| 81 | implement back references across regular |
| 82 | expressions for use in syntax |
| 83 | highlighting.*/ |
| 84 | conststring32cxx . . $ conststring32# string, /* Text to search within. */ |
| 85 | const char32cxx . . $ char32# *end, /* Pointer to the end of `string'. If NULL will |
| 86 | scan from `string' until '\0' is found. */ |
| 87 | int reverse, /* Backward search. */ |
| 88 | char32cxx . . $ char32# prev_char, /* Character immediately prior to `string'. Set |
| 89 | to '\n' or '\0' if true beginning of text. */ |
| 90 | char32cxx . . $ char32# succ_char, /* Character immediately after `end'. Set |
| 91 | to '\n' or '\0' if true beginning of text. */ |
| 92 | conststring32cxx . . $ conststring32# look_behind_to,/* Boundary for look-behind; defaults to |
| 93 | "string" if NULL */ |
| 94 | conststring32cxx . . $ conststring32# match_till); /* Boundary to where match can extend. |
| 95 | \0 is assumed to be the boundary if not |
| 96 | set. Lookahead can cross the boundary. */ |
| 97 | |
| 98 | |
| 99 | /* Perform substitutions after a `regexp' match. */ |
| 100 | |
| 101 | int SubstituteREcxx . . $ SubstituteRE(282979b5b66f071a). ( |
| 102 | const regexpcxx . . $ regexp# *prog, |
| 103 | conststring32cxx . . $ conststring32# source, |
| 104 | mutablestring32cxx . . $ mutablestring32# dest, |
| 105 | int max, |
| 106 | int *errorType); // djmw 20080110 0: ok; 1: is not enough memory |
| 107 | |
| 108 | /* Enable (or disable) brace counting quantifiers, e.g. `(foo){0,3}'. */ |
| 109 | |
| 110 | void EnableCountingQuantifiercxx . . $ EnableCountingQuantifier(d4f767463ce0a6b3). (int is_enabled); |
| 111 | |
| 112 | #endif /* _regularExp_h_ */ |