all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@online.de>
To: "Stephen J. Turnbull" <turnbull@sk.tsukuba.ac.jp>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
	Emacs developers <emacs-devel@gnu.org>
Subject: Re: Possible problem with looking-back function
Date: Thu, 19 Aug 2010 11:32:12 +0200	[thread overview]
Message-ID: <4C6CFA1C.7080609@online.de> (raw)
In-Reply-To: <8739ubug9r.fsf@uwakimon.sk.tsukuba.ac.jp>

Am 19.08.2010 11:02, schrieb Stephen J. Turnbull:
> Andreas Röhler writes:
>
>   >  that surprises me.  Check must be done against the string already
>   >  found.  So workload should grow lineary resp. slightly ascending.
>
> That's incorrect.  In regexp matching abstractly defined, there is no
> "string already matched."  In general backtracking must be done to get
> a correct POSIX match, and it's potentially very expensive.  It would
> be sometimes possible (as in this case) to identify a non-backtracking
> algorithm as you suggest, but that would mean that different regexps
> would be treated differently, or that some regexps would be
> ridiculously expensive.
>
>    

Hi,

just for the curious:
Coming upon the matter, as in markup languages point may be inside the 
start tag.
Solved it whith function below

--begstr is the startup-tag
Sometimes begstr is used inside beg-end function quoted: (regexp-quote 
begstr),
therefor the startup tag is delivered in both forms here, making 
looking-at working
- not sure, if its really necessary btw--


(defun ar-leave-begstr-backward (begstr unquoted-beg)
   (let* ((stringcount (length unquoted-beg))
          (collected (char-to-string (char-after)))
          (indx (string-match (regexp-quote collected) unquoted-beg)))
     (while (and indx (not (ignore-errors (looking-at begstr)))(< 1 
stringcount))
       (forward-char -1)
       (setq collected (concat (char-to-string (char-after)) collected))
       (setq indx (string-match (regexp-quote collected) unquoted-beg))
       (setq stringcount (1- stringcount)))))

See beg-end.el

at

https://code.launchpad.net/s-x-emacs-werkstatt/



  reply	other threads:[~2010-08-19  9:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-19  1:15 Possible problem with looking-back function Vinicius Jose Latorre
2010-08-19  2:43 ` Davis Herring
2010-08-19  6:09   ` Andreas Röhler
2010-08-19  8:01     ` Stefan Monnier
2010-08-19  9:02     ` Stephen J. Turnbull
2010-08-19  9:32       ` Andreas Röhler [this message]
2010-08-20  2:11   ` Vinicius Jose Latorre
2010-08-20 13:07     ` Stefan Monnier
2010-08-21  0:08       ` Vinicius Jose Latorre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C6CFA1C.7080609@online.de \
    --to=andreas.roehler@online.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=turnbull@sk.tsukuba.ac.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.