emacs-devel
[Top][All Lists]
Advanced

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

Re: c-mode syntax strings and regexp word boundaries


From: Andreas Röhler
Subject: Re: c-mode syntax strings and regexp word boundaries
Date: Fri, 06 Sep 2013 14:21:07 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130801 Thunderbird/17.0.8

Am 06.09.2013 07:14, schrieb Jon Dufresne:
Hi,

I am trying to modify a major mode derived from c-mode. I am adding support
for an alternative string syntax (PHP heredoc). To do this I am using
"syntax-propertize-function" and
"syntax-propertize-extend-region-functions". (As an aside I am not sure
this is the best approach, but it is best I have come up with so far.)

When trying to extend the propertize region, a regexp fails, but I am not
clear as to why. I have isolated the problem with the following test case.

---
(with-temp-buffer
   (c-mode)
   (insert "END;\n")
   (goto-char (point-min))
   (message "Search forward first time")
   (re-search-forward "^END\\b")
   (put-text-property (1- (point)) (point)
                      'syntax-table (string-to-syntax "|"))
   (goto-char (point-min))
   (message "Search forward second time")
   (re-search-forward "^END\\b"))
---

Running this give me the output:

Search forward first time
Search forward second time
Search failed: "^END\\b"

I do not understand why the second regexp fails. I suppose it has to do
with the text property string boundary. What is the correct way to look for
the boundary in this case?

Thanks for any help.


For me it's strange too.

Second

(re-search-forward "^END\\s.")

matches that way.

Can't see why the word-boundary isn't recognised any more.

Andreas



reply via email to

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