bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about some fields in regex's re_pattern_buffer


From: Reuben Thomas
Subject: Question about some fields in regex's re_pattern_buffer
Date: Thu, 29 Jul 2010 18:50:04 +0100

(Thanks for helping with my last question; here's another:)

re_pattern_buffer contains the following three fields:

  /* If set, a beginning-of-line anchor doesn't match at the beginning
     of the string.  */
  unsigned __REPB_PREFIX(not_bol) : 1;

  /* Similarly for an end-of-line anchor.  */
  unsigned __REPB_PREFIX(not_eol) : 1;

  /* If true, an anchor at a newline matches.  */
  unsigned __REPB_PREFIX(newline_anchor) : 1;

These look as though it should be possible to set them before calls to
re_search and friends, rather like the POSIX execution flags
REG_NOTBOL &c. However, the only documentation I can find says (of
re_pattern_buffer):

/* This data structure represents a compiled pattern.  Before calling
   the pattern compiler, the fields `buffer', `allocated', `fastmap',
   `translate', and `no_sub' can be set.  After the pattern has been
   compiled, the `re_nsub' field is available.  All other fields are
   private to the regex routines.  */

Note in particular that last sentence. Is is true? Looking at the code
suggests the opposite: regexec.c contains the following:

  eflags |= (bufp->not_bol) ? REG_NOTBOL : 0;
  eflags |= (bufp->not_eol) ? REG_NOTEOL : 0;

Unfortunately I can only tell from this that I could use not_bol &
friends as I imagine in practise, not that it's intended behavior on
which I can rely...

-- 
http://rrt.sc3d.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]