unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* changing syntax for a forward slash
@ 2006-07-02 22:57 Tim Johnson
  2006-07-05 16:47 ` Kevin Rodgers
       [not found] ` <mailman.3789.1152118126.9609.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Tim Johnson @ 2006-07-02 22:57 UTC (permalink / raw)


Hello:
I am working with a major mode derived from 'scheme-mode.
The forward slash '/' has a significance in the rebol language
that is similar to '.' in python or '->' in perl. 
In rebol. '/' is referred to as the "refinement operator".

for the following function call: append/only
I would like 
append 
to be highlighted as a keyword
but not 
only

The output from describe-syntax shows the following entry:
- .. /			_ 	which means: symbol

I take this to mean that the syntax table stores '/' as
a part of the symbol syntax class.

I use the following form as part of font-lock-keywords:
(,(concat "\\<\\(" rebol-functions-regexp "\\)\\>") 
  0 font-lock-keyword-face)

I am unclear as to whether I should be modifying the syntax
table or whether I should be modifying the last argument to
concat 

Any help and/or pointers to documentation is welcome.
Thanks

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: changing syntax for a forward slash
  2006-07-02 22:57 changing syntax for a forward slash Tim Johnson
@ 2006-07-05 16:47 ` Kevin Rodgers
       [not found] ` <mailman.3789.1152118126.9609.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2006-07-05 16:47 UTC (permalink / raw)


Tim Johnson wrote:
> Hello:
> I am working with a major mode derived from 'scheme-mode.
> The forward slash '/' has a significance in the rebol language
> that is similar to '.' in python or '->' in perl. 
> In rebol. '/' is referred to as the "refinement operator".
> 
> for the following function call: append/only
> I would like 
> append 
> to be highlighted as a keyword
> but not 
> only
> 
> The output from describe-syntax shows the following entry:
> - .. /			_ 	which means: symbol
> 
> I take this to mean that the syntax table stores '/' as
> a part of the symbol syntax class.
> 
> I use the following form as part of font-lock-keywords:
> (,(concat "\\<\\(" rebol-functions-regexp "\\)\\>") 
>   0 font-lock-keyword-face)
> 
> I am unclear as to whether I should be modifying the syntax
> table or whether I should be modifying the last argument to
> concat 

As / seems to be an operator in your language I suggest changing its
syntax from symbol to punctuation.

-- 
Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: changing syntax for a forward slash
       [not found] ` <mailman.3789.1152118126.9609.help-gnu-emacs@gnu.org>
@ 2006-07-06 16:56   ` Tim Johnson
  2006-07-06 17:24     ` Johan Bockgård
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Johnson @ 2006-07-06 16:56 UTC (permalink / raw)


On 2006-07-05, Kevin Rodgers <ihs_4664@yahoo.com> wrote:
> Tim Johnson wrote:
>> - .. /			_ 	which means: symbol
>> I use the following form as part of font-lock-keywords:
>> (,(concat "\\<\\(" rebol-functions-regexp "\\)\\>") 
>>   0 font-lock-keyword-face)
>
> As / seems to be an operator in your language I suggest changing its
> syntax from symbol to punctuation.

  Thank you Kevin:
  I'm following your advice. I have also changed the 'boundary
  subexpression to identify the end of a keyword:
  it is now: "\\)\\(\\>\\|/\\)"

  and the relevant sexp looks like this
 (,(concat "\\<\\(" rebol-functions-regexp "\\)\\(\\>\\|/\\)") 
   0 font-lock-keyword-face)
 
  Now, when I code: append/only the 'append/' is highlighted
  and 'only' is not.
 
  One more step: I would like to exclude '/' from being highlighted
  so that one 'append' is highlighted.

  So I would like to know how to prevent the '/' from being
  "consumed" by the regexp.

  I'm now reading the info page on regexps but still do not
  deduce a solution.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: changing syntax for a forward slash
  2006-07-06 16:56   ` Tim Johnson
@ 2006-07-06 17:24     ` Johan Bockgård
  0 siblings, 0 replies; 4+ messages in thread
From: Johan Bockgård @ 2006-07-06 17:24 UTC (permalink / raw)


Tim Johnson <tim@johnsons-web.com> writes:

>  (,(concat "\\<\\(" rebol-functions-regexp "\\)\\(\\>\\|/\\)") 
>    0 font-lock-keyword-face)
     ^
This number says which subexpression to highlight.

>   One more step: I would like to exclude '/' from being highlighted
>   so that one 'append' is highlighted.

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-07-06 17:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-02 22:57 changing syntax for a forward slash Tim Johnson
2006-07-05 16:47 ` Kevin Rodgers
     [not found] ` <mailman.3789.1152118126.9609.help-gnu-emacs@gnu.org>
2006-07-06 16:56   ` Tim Johnson
2006-07-06 17:24     ` Johan Bockgård

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).