[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What is this syntax for in php-mode.el
From: |
Stefan Monnier |
Subject: |
Re: What is this syntax for in php-mode.el |
Date: |
Fri, 20 Apr 2007 10:56:51 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux) |
> I am looking at php-mode.el from Turadg. I can not understand this:
> (defconst php-font-lock-syntactic-keywords
> (if xemacsp nil
> ;; Mark shell-style comments. font-lock handles this in a
> ;; separate pass from normal syntactic scanning (somehow), so we
> ;; get a chance to mark these in addition to C and C++ style
> ;; comments. This only works in GNU Emacs, not XEmacs 21 which
> ;; seems to ignore this same code if we try to use it.
> (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)))
> )))
> What is it for? Does php use # as a comment somewhere?
> And what about the format for the list entries? I tried to look at
> font-lock-syntactic-keywords, but I can not see that these entries follows
> the spec there.
> How does this work?
Please tell the author that he doesn't need this gymnastics.
Just set # to comment-starter in the syntax-table and be done with it.
Make sure it has the comment-style (a or b) corresponding to the one of \n
(presumably it's b, if I read the problem-comment above correctly):
(modify-syntax-entry ?# "< b" php-mode-syntax-table)
-- Stefan
- Re: What is this syntax for in php-mode.el,
Stefan Monnier <=