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

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

Re: What is this syntax for in php-mode.el


From: Lennart Borgman (gmail)
Subject: Re: What is this syntax for in php-mode.el
Date: Fri, 20 Apr 2007 16:17:40 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666

Robert D. Crawford wrote:
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:

Thanks Ted. Now I only wonder about that strange
font-lock-syntactic-keywords spec that I can not find in the Emacs
lisp manual.

This might help, fetched with apropos:

font-lock-syntactic-keywords is a variable defined in `font-lock.el'.
Its value is nil


Documentation:
A list of the syntactic keywords to put syntax properties on.
The value can be the list itself, or the name of a function or variable
whose value is the list.

See `font-lock-keywords' for a description of the form of this list;
only the differences are stated here.  MATCH-HIGHLIGHT should be of the form:

 (SUBEXP SYNTAX OVERRIDE LAXMATCH)

where SYNTAX can be a string (as taken by `modify-syntax-entry'), a syntax
table, a cons cell (as returned by `string-to-syntax') or an expression whose
value is such a form.  OVERRIDE cannot be `prepend' or `append'.

Here are two examples of elements of `font-lock-syntactic-keywords'
and what they do:

 ("\\$\\(#\\)" 1 ".")

 gives a hash character punctuation syntax (".") when following a
 dollar-sign character.  Hash characters in other contexts will still
 follow whatever the syntax table says about the hash character.

 ("\\('\\).\\('\\)"
  (1 "\"")
  (2 "\""))

 gives a pair single-quotes, which surround a single character, a SYNTAX of
 "\"" (meaning string quote syntax).  Single-quote characters in other
 contexts will not be affected.

This is normally set via `font-lock-defaults'.


Maybe. My trouble is that I can not fit something like the below into this format:

    (list
     ;; Mark _all_ # chars as being comment-start.  That will be
     ;; ignored when inside a quoted string.
     '("\\(\#\\)"
       (1 (11 . nil)))
     ;; Mark all newlines ending a line with # as being comment-end.
     ;; This causes a problem, premature end-of-comment, when '#'
     ;; appears inside a multiline C-style comment.  Oh well.
     '("#.*?\\([\n]\\)"
       (1 (12 . nil)))

This code works except for trouble of the kind noted in the comment. I am trying to understand if there is any way around this problem.




reply via email to

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