Iago Rubio wrote:
Hello all,
I barely use SQL files but when I have to move some data from my local
MySQL server to another location, so the only SQL I use to see is
generated by MySQL.
The current lexer parses fine those files but for a small glitch that
have been hiting my eyes lately.
MySQL use backticks `` to mark the table and fields' names resulting in
code like:
CREATE TABLE `auth` (
`type` int(10) unsigned NOT NULL auto_increment,
`user` varchar(100) NOT NULL default '',
PRIMARY KEY (`type`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
As you can see there are a lot of strings marked with backticks but the
current lexer does not identify them as strings - of course, as they're
not strings in SQL syntax - and highlights them as SQL keywords if there
is a match with any of the keywords' lists.
In the example above `user` and `type` are marked as keywords when
they're not.
To deal with this I have made some tiny changes to the current lexer to
recognize text surrounded by backticks as string, if you set the
property "sql.backticks.string".
Good idea.
Note this change will work only for MySQL when using these backticks, alas.
If I have, for example, text, value or class as field names (I see a
table with all three...), it seems to be accepted (OK in SQL context I
suppose) but it is highlighted as keywords. Idem for password,
highlighted as SQL*Plus keyword.
And we cannot do much to avoid this, unless making a full SQL lexer with
context checking...
It won't break any existing configuration so I let it here for your
review in the hope you'd find it interesting.
http://iagorubio.com/scintilla/LexSQL.patch
http://iagorubio.com/scintilla/LexSQL.cxx.zip
I didn't looked at your code yet.
Did you use old (official) lexer or the one I rewrote?
I don't know if Neil integrated it finally.
If that's the old code, I can integrate your changes in my version.
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest