pike.git / src / post_modules / _Regexp_PCRE / pcre_glue.cmod

version» Context lines:

pike.git/src/post_modules/_Regexp_PCRE/pcre_glue.cmod:99:    &errptr,&erroffset,    NULL /* table */ );       if (!THIS->re)    Pike_error("error calling pcre_compile [%d]: %s\n",    erroffset,errptr);    }      /*! @decl object study()    *! -  *! (from the pcreapi man-page) -  *! "When a pattern is going to be used several times, it is worth spending -  *! more time analyzing it in order to speed up the time taken for match- -  *! ing." +  *! (from the pcreapi man-page) "When a pattern is going to be +  *! used several times, it is worth spending more time analyzing +  *! it in order to speed up the time taken for match- ing."    */       PIKEFUN object study()    {    const char *errmsg=NULL;    if (!THIS->re)    Pike_error("need to initialize before study() is called\n");       if (THIS->extra) (*pcre_free)(THIS->extra); /* -> free() usually */   
pike.git/src/post_modules/_Regexp_PCRE/pcre_glue.cmod:324:      /*! @decl int|array exec(string subject,void|int startoffset)    *! Matches the regexp against @[subject], starting at    *! @[startoffset] if it is given.    *!    *! If the match is successful, the return value is an array that    *! holds the offsets of all matches:    *!    *! Elements 0 and 1 have the start and end offsets, respectively,    *! of the match for the whole regexp. The start offset is -  *! inclusive while the end is exclusive, i.e. the matching -  *! string is @expr{@[subject][res[0]..res[1]-1]@}. +  *! inclusive while the end is exclusive, i.e. the matching string +  *! is @expr{@[subject][res[0]..res[1]-1]@}.    *!    *! Elements 2 and 3 have the offsets of the first capturing    *! submatch (if any) in the same way, elements 4 and 5 are for    *! the second capturing submatch, etc. If a submatch didn't match    *! anything, the corresponding elements are set to -1. If a    *! submatch has matched successfully several times, the offsets    *! of the last match are returned.    *!    *! The returned array is always of length 2*n + 1, where n is the    *! total number of capturing submatches in the regexp.
pike.git/src/post_modules/_Regexp_PCRE/pcre_glue.cmod:415:       if (!THIS->re)    Pike_error("need to initialize before exec() is called\n");       if (startoffset)    off = startoffset->u.integer;       /* FIXME: also MATCH_LIMIT and CALLOUT_DATA ... later */       if (off > subject->len) { -  /* If we don't check this then pcre_exec might return an -  * empty string match past the end of the input string. -  * That's arguably a bug in the pcre lib (observed in -  * version 7.8). */ +  /* If we don't check this then pcre_exec might return an empty +  * string match past the end of the input string. That's +  * arguably a bug in the pcre lib (observed in version 7.8). */    push_int (PCRE_ERROR_NOMATCH);    }       else {    int rc=pcre_exec(THIS->re,THIS->extra,    subject->str,subject->len,    off,opts,    ovector,OVECTOR_SIZE);       if (rc<0)
pike.git/src/post_modules/_Regexp_PCRE/pcre_glue.cmod:487:    THIS->pattern=NULL;    }   #endif       EXIT    gc_trivial;    {    if (THIS->re) (*pcre_free)(THIS->re); /* -> free() usually */    if (THIS->extra) (*pcre_free)(THIS->extra); /* -> free() usually */    } -  +    }      /*! @endclass    */      #endif /* HAVE_LIBPCRE */      /*! @decl array(string) split_subject(string subject, @    *! array(int) previous_result)    *! Convenience function that
pike.git/src/post_modules/_Regexp_PCRE/pcre_glue.cmod:599:    {    int outcome;    if (pcre_config(PCRE_CONFIG_UTF8,&outcome)==0 && outcome)    add_integer_constant("UTF8_SUPPORTED",1,0);    }   #endif      #define FIGURE_BUILD_TIME_OPTION(X,T) \    do \    { \ -  T outcome; \ +  T outcome; \    if (pcre_config(PCRE_CONFIG_##X,&outcome)==0) \ -  add_integer_constant("buildconfig_"#X,outcome,0); \ +  add_integer_constant("buildconfig_"#X,outcome,0); \    } \    while (0)      #ifdef PCRE_CONFIG_UTF8    FIGURE_BUILD_TIME_OPTION(UTF8,int);   #endif   #ifdef PCRE_CONFIG_NEWLINE    FIGURE_BUILD_TIME_OPTION(NEWLINE,int);   #endif   #ifdef PCRE_CONFIG_LINK_SIZE
pike.git/src/post_modules/_Regexp_PCRE/pcre_glue.cmod:628:    FIGURE_BUILD_TIME_OPTION(MATCH_LIMIT,unsigned long int);   #endif      /*! @module OPTION    *! contains all option constants    */       start_new_program();      /*! @decl constant ANCHORED -  *! (from the pcreapi manpage) -  *! If this bit is set, the pattern is forced to be "anchored", that is, it -  *! is constrained to match only at the first matching point in the string -  *! which is being searched (the "subject string"). This effect can also be -  *! achieved by appropriate constructs in the pattern itself, which is the -  *! only way to do it in Perl. +  *! (from the pcreapi manpage) If this bit is set, the pattern is +  *! forced to be "anchored", that is, it is constrained to match +  *! only at the first matching point in the string which is being +  *! searched (the "subject string"). This effect can also be +  *! achieved by appropriate constructs in the pattern itself, which +  *! is the only way to do it in Perl.    */    add_integer_constant("ANCHORED",PCRE_ANCHORED,0);       /*! @decl constant CASELESS -  *! (from the pcreapi manpage) -  *! If this bit is set, letters in the pattern match both upper and lower -  *! case letters. It is equivalent to Perl's /i option, and it can be -  *! changed within a pattern by a (?i) option setting. +  *! (from the pcreapi manpage) If this bit is set, letters in the +  *! pattern match both upper and lower case letters. It is +  *! equivalent to Perl's /i option, and it can be changed within a +  *! pattern by a (?i) option setting.    */    add_integer_constant("CASELESS",PCRE_CASELESS,0);       /*! @decl constant DOLLAR_ENDONLY -  *! (from the pcreapi manpage) -  *! If this bit is set, a dollar metacharacter in the pattern matches only -  *! at the end of the subject string. Without this option, a dollar also -  *! matches immediately before the final character if it is a newline (but -  *! not before any other newlines). The PCRE_DOLLAR_ENDONLY option is -  *! ignored if PCRE_MULTILINE is set. There is no equivalent to this option -  *! in Perl, and no way to set it within a pattern. +  *! (from the pcreapi manpage) If this bit is set, a dollar +  *! metacharacter in the pattern matches only at the end of the +  *! subject string. Without this option, a dollar also matches +  *! immediately before the final character if it is a newline (but +  *! not before any other newlines). The PCRE_DOLLAR_ENDONLY +  *! option is ignored if PCRE_MULTILINE is set. There is no +  *! equivalent to this option in Perl, and no way to set it within +  *! a pattern.    */    add_integer_constant("DOLLAR_ENDONLY",PCRE_DOLLAR_ENDONLY,0);       /*! @decl constant DOTALL -  *! (from the pcreapi manpage) -  *! If this bit is set, a dot metacharater in the pattern matches all -  *! characters, including newlines. Without it, newlines are excluded. This -  *! option is equivalent to Perl's /s option, and it can be changed within -  *! a pattern by a (?s) option setting. A negative class such as [^a] -  *! always matches a newline character, independent of the setting of this -  *! option. +  *! (from the pcreapi manpage) If this bit is set, a dot +  *! metacharater in the pattern matches all characters, including +  *! newlines. Without it, newlines are excluded. This option is +  *! equivalent to Perl's /s option, and it can be changed within a +  *! pattern by a (?s) option setting. A negative class such as +  *! [^a] always matches a newline character, independent of the +  *! setting of this option.    */    add_integer_constant("DOTALL",PCRE_DOTALL,0);       /*! @decl constant EXTENDED -  *! (from the pcreapi manpage) -  *! If this bit is set, whitespace data characters in the pattern are -  *! totally ignored except when escaped or inside a character class. -  *! Whitespace does not include the VT character (code 11). In addition, -  *! characters between an unescaped # outside a character class and the -  *! next newline character, inclusive, are also ignored. This is equivalent -  *! to Perl's /x option, and it can be changed within a pattern by a (?x) -  *! option setting. +  *! (from the pcreapi manpage) If this bit is set, whitespace data +  *! characters in the pattern are totally ignored except when +  *! escaped or inside a character class. Whitespace does not +  *! include the VT character (code 11). In addition, characters +  *! between an unescaped # outside a character class and the next +  *! newline character, inclusive, are also ignored. This is +  *! equivalent to Perl's /x option, and it can be changed within a +  *! pattern by a (?x) option setting.    *! -  *! This option makes it possible to include comments inside complicated -  *! patterns. Note, however, that this applies only to data characters. -  *! Whitespace characters may never appear within special character -  *! sequences in a pattern, for example within the sequence (?( which -  *! introduces a conditional subpattern. +  *! This option makes it possible to include comments inside +  *! complicated patterns. Note, however, that this applies only +  *! to data characters. Whitespace characters may never appear +  *! within special character sequences in a pattern, for example +  *! within the sequence (?( which introduces a conditional +  *! subpattern.    */    add_integer_constant("EXTENDED",PCRE_EXTENDED,0);       /*! @decl constant EXTRA -  *! (from the pcreapi manpage) -  *! This option was invented in order to turn on additional functionality -  *! of PCRE that is incompatible with Perl, but it is currently of very -  *! little use. When set, any backslash in a pattern that is followed by a -  *! letter that has no special meaning causes an error, thus reserving -  *! these combinations for future expansion. By default, as in Perl, a -  *! backslash followed by a letter with no special meaning is treated as a -  *! literal. There are at present no other features controlled by this -  *! option. It can also be set by a (?X) option setting within a pattern. +  *! (from the pcreapi manpage) This option was invented in order +  *! to turn on additional functionality of PCRE that is +  *! incompatible with Perl, but it is currently of very little +  *! use. When set, any backslash in a pattern that is followed by +  *! a letter that has no special meaning causes an error, thus +  *! reserving these combinations for future expansion. By +  *! default, as in Perl, a backslash followed by a letter with no +  *! special meaning is treated as a literal. There are at present +  *! no other features controlled by this option. It can also be +  *! set by a (?X) option setting within a pattern.    */    add_integer_constant("EXTRA",PCRE_EXTRA,0);       /*! @decl constant MULTILINE -  *! (from the pcreapi manpage) -  *! By default, PCRE treats the subject string as consisting of a single -  *! "line" of characters (even if it actually contains several newlines). -  *! The "start of line" metacharacter (^) matches only at the start of the -  *! string, while the "end of line" metacharacter ($) matches only at the -  *! end of the string, or before a terminating newline (unless PCRE_DOL- -  *! LAR_ENDONLY is set). This is the same as Perl. +  *! (from the pcreapi manpage) By default, PCRE treats the subject +  *! string as consisting of a single "line" of characters (even if +  *! it actually contains several newlines). The "start of line" +  *! metacharacter (^) matches only at the start of the string, +  *! while the "end of line" metacharacter ($) matches only at the +  *! end of the string, or before a terminating newline (unless +  *! PCRE_DOL- LAR_ENDONLY is set). This is the same as Perl.    *! -  *! When PCRE_MULTILINE it is set, the "start of line" and "end of line" -  *! constructs match immediately following or immediately before any new- -  *! line in the subject string, respectively, as well as at the very start -  *! and end. This is equivalent to Perl's /m option, and it can be changed -  *! within a pattern by a (?m) option setting. If there are no "\n" charac- -  *! ters in a subject string, or no occurrences of ^ or $ in a pattern, +  *! When PCRE_MULTILINE it is set, the "start of line" and "end of +  *! line" constructs match immediately following or immediately +  *! before any new- line in the subject string, respectively, as +  *! well as at the very start and end. This is equivalent to +  *! Perl's /m option, and it can be changed within a pattern by a +  *! (?m) option setting. If there are no "\n" charac- ters in a +  *! subject string, or no occurrences of ^ or $ in a pattern,    *! setting PCRE_MULTILINE has no effect. -  *! +     */    add_integer_constant("MULTILINE",PCRE_MULTILINE,0);      #ifdef PCRE_NO_AUTO_CAPTURE    /*! @decl constant NO_AUTO_CAPTURE -  *! (from the pcreapi manpage) -  *! If this option is set, it disables the use of numbered capturing paren- -  *! theses in the pattern. Any opening parenthesis that is not followed by -  *! ? behaves as if it were followed by ?: but named parentheses can still -  *! be used for capturing (and they acquire numbers in the usual way). -  *! There is no equivalent of this option in Perl. +  *! (from the pcreapi manpage) If this option is set, it disables +  *! the use of numbered capturing paren- theses in the +  *! pattern. Any opening parenthesis that is not followed by ? +  *! behaves as if it were followed by ?: but named parentheses can +  *! still be used for capturing (and they acquire numbers in the +  *! usual way). There is no equivalent of this option in Perl.    */    add_integer_constant("NO_AUTO_CAPTURE",PCRE_NO_AUTO_CAPTURE,0);   #endif       /*! @decl constant UNGREEDY -  *! (from the pcreapi manpage) -  *! This option inverts the "greediness" of the quantifiers so that they -  *! are not greedy by default, but become greedy if followed by "?". It is -  *! not compatible with Perl. It can also be set by a (?U) option setting -  *! within the pattern. +  *! (from the pcreapi manpage) This option inverts the +  *! "greediness" of the quantifiers so that they are not greedy by +  *! default, but become greedy if followed by "?". It is not +  *! compatible with Perl. It can also be set by a (?U) option +  *! setting within the pattern.    */    add_integer_constant("UNGREEDY",PCRE_UNGREEDY,0);      #ifdef PCRE_UTF8    /*! @decl constant UTF8 -  *! (from the pcreapi manpage) -  *! This option causes PCRE to regard both the pattern and the subject as -  *! strings of UTF-8 characters instead of single-byte character strings. -  *! However, it is available only if PCRE has been built to include UTF-8 -  *! support. If not, the use of this option provokes an error. Details of -  *! how this option changes the behaviour of PCRE are given in the section -  *! on UTF-8 support in the main pcre page. +  *! (from the pcreapi manpage) This option causes PCRE to regard +  *! both the pattern and the subject as strings of UTF-8 +  *! characters instead of single-byte character strings. However, +  *! it is available only if PCRE has been built to include UTF-8 +  *! support. If not, the use of this option provokes an +  *! error. Details of how this option changes the behaviour of +  *! PCRE are given in the section on UTF-8 support in the main +  *! pcre page.    */    add_integer_constant("UTF8",PCRE_UTF8,0);   #endif      #define END_PROGRAM_MAKE_SUBMODULE(X) \    do \    { \    struct program *p=end_program(); \    struct object *obj=clone_object(p,0); \    add_object_constant(X,obj,0); \