jEdit Community - Resources for users of the jEdit Text Editor
Terminating a rule set at a newline
Submitted by silverquick on Monday, 5 September, 2005 - 05:59

After using (and loving) jEdit for a little while, I realised that, in PHP mode, code like the following is highlighted incorrectly:

...
// this is a comment ?>

The problem is that PHP always ends parsing at the closing tag ('?>'), even if the line it's on is commented with // or #. However jEdit's highlighting does not reflect this. This issue is covered in a bug report at:

http://sourceforge.net/tracker/?group_id=588&atid=100588&func=detail&aid=958013

However, I thought I'd bring the discussion here, too. I tried putting the following in the php.xml file:

<SEQ DELEGATE="PHP_LINECOMMENT">//</SEQ>
<SEQ DELEGATE="PHP_LINECOMMENT">#</SEQ>

<RULES SET="PHP_LINECOMMENT" DEFAULT="COMMENT1">
	<SEQ TYPE="NULL" DELEGATE="MAIN">?></SEQ>
	<SEQ TYPE="NULL" DELEGATE="PHP">&#xA;</SEQ>
</RULES>

What this does is delegate any code following // or # to my special PHP_LINECOMMENT rule set. This rule set should then end at either a PHP closing tag, going back to HTML mode; or at an end-of-line, going back to normal PHP mode. The former works and the latter doesn't.

This is the main point I wanted to raise for discussion. Why doesn't the newline character (&#xA or &#10) work, and is there a possible workaround? Using the newline character is also applicable to other highlighting issues, including (X/HT)ML attributes, because they can be spread over multiple lines.

User login
Browse archives
« November 2017  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
33%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1092
Syndication
file   ver   dls
German Localization light   4.4.2.1   50827
Context Free Art (*.cfdg)   0.31   40995
JBuilder scheme   .001   16907
ColdFusion scheme   1.0   16489
BBEdit scheme   1.0   16475
R Edit Mode - extensive version   0.1   14731
Advanced HTML edit mode   1.0   13965
Matlab Edit Mode   1.0   13887
jEdit XP icons   1.0   13345
XP icons for jEdit   1.1   12367