Le 15/10/2012 01:46, Lex Trotman a écrit :
On 15 October 2012 02:35, Jean-Max Reymond <jmreymond@free.fr mailto:jmreymond@free.fr> wrote:
Hi, I have written a filetype for awk files but I have some troubles with lexer_filetype In order to work correctly, I have to add a line lexer_filetype=C (whitout this line, nothing is colored). So, my keywords are highligted but the commentary does not work, only the C syntax is highligted. What's wrong ? Thanks for your tips,
Hi,
The lexer is the piece of code that parses your file to decide what colour each character should be, thats why you need to specify one. The lexer_filetype=X says use the lexer that is used for filetype X. So that line tells your filetype to use the C lexer, so thats why only C comments are highlighted. Note the C lexer is hard coded to C syntax, if you set the various comment settings in the filetype file they affect things like menu->edit->format->comment/uncomment/toggle comment not the lexer. I don't remember the awk details but I would think C is probably the nearest other language.
The lexers are part of the Scintilla project whose editing widget we use (www.scintilla.org http://www.scintilla.org). Unfortunately they don't have an awk specific one so someone would have to write one to get exact awk syntax colouration.
thanks for your answer. You're right that C is the nearest language so I use the lexer_filetype=C I is very surprising that comment_single=# in the [settings] section is overridden by lexer_filetype . Now, I have to fix the Symbols tab which does not display the variables and functions