[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regexp not stateless?
From: |
Stefan Monnier |
Subject: |
Re: Regexp not stateless? |
Date: |
Sun, 29 Apr 2007 23:24:09 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) |
> (defconst mumamo-script-tag-start-regex
> (rx "<script"
> (1+ space)
> "type"
> (0+ space)
> "="
> (0+ space)
> ?\"
> ;;(or "text" "application")
> ;;"/"
> ;;(or "javascript" "ecmascript")
> "text/javascript"
> ?\"
> (0+ (not (any ">")))
> ">"
> (optional (0+ space) "<![CDATA[" )
> ))
> This matches at the start of this text with `looking-at':
> <script type="text/javascript">
> <![CDATA[
> However sometimes it matches just to the end of the first line and sometimes
> to the end of the second line (as it should). I am using this little
> function to test:
Some things come to mind:
1 - it's not a bug. It's just that somehow one of the "space" chars between
the two tags gets a syntax-table property and is thus not a `space'
any more. Try to replace `space' by "[ \n\t]".
2 - it's a bug in regexp.c, but it depends on the position of the gap
(i.e. the location of the last text insertion/deletion).
3 - could also be a bug in the way the syntax-table property is
checked/used, but this should only be possible if the buffer has some
syntax-table text properties nearby.
4 - one of the "spaces" is not a space, but a NBSP or some other
funny char.
5 - there's some other (invisible) text in there.
6 - ...
Stefan