help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Regex Problem => "overlapping words"


From: Tim Johnson
Subject: Re: Regex Problem => "overlapping words"
Date: Sat, 3 Dec 2005 11:24:21 -0900
User-agent: Mutt/1.4.2.1i

* Stefan Monnier <monnier@iro.umontreal.ca> [051202 18:31]:
Hi Stefan:
> > '("\\([^][ \t\r\n{}()]+\\):[ 
> > ]*\\(d\\(ef\\|oes\\)\\|func\\(tion\\)\\|has\\|sub?\\)\\>" (1 prepend) (2 
> > font-lock-keyword-face))
> 
> You want to remove the ? after `sub' (it causes your regexp to match both
> `sub' and `su') and you want to add a ? right after the \\(tion\\) group.
   Understood. And done. Thanks!
It know looks as follows:
'("\\([^][ \t\r\n{}()]+\\):[ 
]*\\(d\\(?:ef\\|oes\\)\\|func\\(?:tion\\)?\\|has\\|sub\\)\\>" (1 prepend) (2 
font-lock-keyword-face))

There is still a problem tho': Emacs seems to think that "-" is a
word or symbol boundary. Example
type "def" and it is highlighted. Adding a hyphen, we now have "def-"
the the "def" substring remains highlighted.

Perhaps this is not a regex issue, but some other setting to the mode? 
Example, in c-mode, "_" is considered part of a symbol? In lisp mode
"-" should be considered part of a symbol. In this mode, which is called
"Rebol Mode" "-" should be part of a symbol. I've hacked on this mode,
which appears to have been abandoned by the original author, and I
should probably be looking for some expression that defines what
constitutes characters that make up symbols.

Am I correct? If so, what should I be looking for.

Thanks again.
cheers
tim

-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com




reply via email to

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