Alexander Kuleshov a écrit le 2010-01-27 00:30 :
> Hi to all. I begin to make java server page highlighting. I made a
> small part, the base functional. But thi highlights not working on
> this time. I can't understand what's wrong.
A trick to find easily problems is to launch gedit in a console. For
example, I added your ".lang" file in my local folder
"~/.local/share/gtksourceview-2.0/language-specs/" and then I launched
gedit with a ".jsp" file as argument:
$ gedit a-file.jsp
(gedit:19888): GtkSourceView-WARNING **: Failed to load
'~/.local/share/gtksourceview-2.0/language-specs/jsp.lang': in file
~/.local/share/gtksourceview-2.0/language-specs/jsp.lang on line 38:
Opening and ending tag mismatch: definitions line 37 and define-regex
We can read that line 38 causes problem:
define-regex id="prefix">[a-zA-Z_][a-zA-Z0-9._-]*</define-regex>
Actually it lacks a <, so replace the line by:
<define-regex id="prefix">[a-zA-Z_][a-zA-Z0-9._-]*</define-regex>
Note that you must close gedit and reopen it after modifications to a
".lang" file. So close gedit and reopen it:
$ gedit a-file.jsp
(gedit:20133): GtkSourceView-WARNING **: Failed to load
'~/.local/share/gtksourceview-2.0/language-specs/jsp.lang': in file
~/.local/share/gtksourceview-2.0/language-specs/jsp.lang on line 44:
Opening and ending tag mismatch: context line 41 and scontext
Line 41:
</scontext>
must be changed for:
</context>
Then, close and reopen gedit. Another problem:
$ gedit a-file.jsp
(gedit:20301): GtkSourceView-WARNING **: Failed to load
'~/.local/share/gtksourceview-2.0/language-specs/jsp.lang': id de
contexte « java:java » en double
Actually lines 69, 77 and 85 all have:
<context id="java:java"/>
An "id" must be unique. You must use the "ref" attribute instead of "id"
for the 3 lines:
<context ref="java:java"/>
Close and reopen gedit:
$ gedit a-file.jsp
(gedit:20803): GtkSourceView-WARNING **: Failed to load
'~/.local/share/gtksourceview-2.0/language-specs/jsp.lang': référence de
contexte « jsp:number » non valide
The line 95 has a problem:
<context ref="number"/>
The context "number" included for "jsp" doesn't exist. Actually the
context is named "numeric" to the line 52:
<context id="numeric" style-ref="number">
so you must change the reference of the line 95:
<context ref="numeric"/>
Close and reopen gedit:
$ gedit a-file.jsp
and now it works. There's no longer error message. See the attachment to
this e-mail. It's the working "jsp.lang" file.
Regards,
Jean-Philippe
Attachment:
jsp.lang.zip
Description: Zip archive