GNOME Bugzilla – Bug 130470
Operators should be highlighted in Haskell syntax file
Last modified: 2007-05-26 21:24:43 UTC
Hello, here's a Haskell syntax file. Is it ok to add?
Created attachment 22878 [details] Haskell Syntax File
Looks great. Please commit with a changelog entry. Thanks.
I have an 'improved' Haskell syntax file which I would like to contribute however I'm having trouble makeing it do exactly what I want when it comes to operators. Improvements: * Allow quote characters ' at end of variables and data types, without them being matched as charcter constants, eg foo' * Allow hash chars at end of data types, eg data Int = I# Int# * pragma brackets {-# OPTION bla bla bla #-} * cpp preprocessor stuff, #if, #else etc * extra GHC keywords, 'with' and 'forall' * allow '.' in module/type/constructor names, eg Data.FiniteMap.FM * patterns for numbers that reflect the language report, haskell has no long or unsigned numeric constant qualifiers (http://haskell.org/onlinereport/lexemes.html#sect2.5) * highlighting for reserved symbols: => -> <- | = @ ~ * attempt at highliting for operators: eg ++,==,||,&&,>>= This last bit doesn't entirely work right, my problem is that all sequences of the operator characters are valid user-defined operators except a fixed list of reserved operators. I tried using a keyword list of reserved operators but the operators regexp got priority over the keyword list. If I use two regexps then then sometimes the reserved operators are classes as ordinary operators - there is no fixed priority of one class over the other. In the attached haskell.lang file, I've commented out the operator class. Any suggestions would be apreciated. In NEdit, the order in which the classes are listed determines the priority, so with NEdit the following has the desired effect: symbols:"::|-\\>|\\<-|=\\>|~|,":::Symbols:: operators:"\\.|:|==|/=|\\<|\\<=|\\>|\\>=|-|\\+|\\*|\\*\\*|/|!|\\^|\\$!|\\$|&|\\|\\||%|\\>\\>=|\\>\\>|=\\<\\<":::Operators:: symbols:"\\||=":::Symbols::
Created attachment 25265 [details] Haskell syntax file
There's no way currently to prioritize a given pattern over another. I've filed bug 140097 to address this issue. I'm marking this bug as dependant on it.
Can we get Haskell highliting into an upcomming release? We can just ignore highliting of operators for now, everything else works ok I believe.
I'm committing the current .lang file to CVS HEAD. Changing the summary. 2004-07-21 Duncan <dc_junk@yahoo.co.uk> * gtksourceview/language-specs/haskell.lang: new file, adds support for Haskell language. First version of the file by Anders Carlsson <andersca@gnome.org>.
I'm closing this bug since there is not activity on it. If you have some improvements to the current .lang file, please re-open this report.
Has there been any progress on bug #140097 ? If there has then I'll certainly have a go at improving the operater highlighting.