Haskell filetype improvements and support for Literal Haskell

Closes #155 and also closes #139
This commit is contained in:
exbb2 2013-07-21 19:45:28 +03:00 committed by Matthew Brush
parent b518770dea
commit 09e7d8398f
5 changed files with 31 additions and 10 deletions

View File

@ -30,7 +30,7 @@ FreeBasic=*.bas;*.bi;
Genie=*.gs;
GLSL=*.glsl;*.frag;*.vert;
Go=*.go;
Haskell=*.hs;*.lhs;
Haskell=*.hs;*.lhs;*.hs-boot;*.lhs-boot;
Haxe=*.hx;
HTML=*.htm;*.html;*.shtml;*.hta;*.htd;*.htt;*.cfm;
Java=*.java;*.jsp;

View File

@ -6,8 +6,11 @@ commentline=comment_line
commentblock=comment
commentblock2=comment
commentblock3=comment
literate_comment=comment
literate_codedelim=preprocessor
number=number_1
keyword=keyword_1
reserved_operator=keyword_1
import=preprocessor
string=string_1
character=character
@ -15,20 +18,27 @@ class=class
operator=operator
identifier=identifier_1
instance=type
capital=string_2
capital=type
module=function
data=number_2
pragma=preprocessor
preprocessor=preprocessor
stringeol=string_eol
reserved_operator=operator
literate_comment=comment
literate_codedelim=other
[keywords]
# all items must be in one line
keywords=as case class data deriving do else if import in infixl infixr instance let module of primitive qualified then type where
keywords=case class data default deriving do else forall foreign if import in infix infixl infixr instance let module newtype of then type where
ffi=capi ccall export import interruptible prim safe stdcall unsafe
reserved_operators=-> .. :: <- = => @ \ | ~ ← → ∀ ∷ ★
[lexer_properties]
lexer.haskell.allow.hash=1
lexer.haskell.allow.quotes=1
lexer.haskell.allow.questionmark=0
lexer.haskell.import.safe=1
lexer.haskell.cpp=1
styling.within.preprocessor=0
fold.haskell.imports=0
[settings]
# default extension used when saving files

View File

@ -2900,7 +2900,9 @@ static gint get_multiline_comment_style(GeanyEditor *editor, gint line_start)
style_comment = SCE_H_COMMENT;
break;
}
case SCLEX_HASKELL: style_comment = SCE_HA_COMMENTBLOCK; break;
case SCLEX_HASKELL:
case SCLEX_LITERATEHASKELL:
style_comment = SCE_HA_COMMENTBLOCK; break;
case SCLEX_LUA: style_comment = SCE_LUA_COMMENT; break;
case SCLEX_CSS: style_comment = SCE_CSS_COMMENT; break;
case SCLEX_SQL: style_comment = SCE_SQL_COMMENT; break;

View File

@ -1511,6 +1511,7 @@ gboolean highlighting_is_string_style(gint lexer, gint style)
style == SCE_LUA_STRING);
case SCLEX_HASKELL:
case SCLEX_LITERATEHASKELL:
return (style == SCE_HA_CHARACTER ||
style == SCE_HA_STRINGEOL ||
style == SCE_HA_STRING);
@ -1671,11 +1672,13 @@ gboolean highlighting_is_comment_style(gint lexer, gint style)
style == SCE_LUA_COMMENTDOC);
case SCLEX_HASKELL:
case SCLEX_LITERATEHASKELL:
return (style == SCE_HA_COMMENTLINE ||
style == SCE_HA_COMMENTBLOCK ||
style == SCE_HA_COMMENTBLOCK2 ||
style == SCE_HA_COMMENTBLOCK3 ||
style == SCE_HA_LITERATE_COMMENT);
style == SCE_HA_LITERATE_COMMENT ||
style == SCE_HA_LITERATE_CODEDELIM);
case SCLEX_FREEBASIC:
return (style == SCE_B_COMMENT);
@ -1737,14 +1740,18 @@ gboolean highlighting_is_code_style(gint lexer, gint style)
switch (lexer)
{
case SCLEX_CPP:
{
if (style == SCE_C_PREPROCESSOR)
return FALSE;
break;
}
case SCLEX_HASKELL:
case SCLEX_LITERATEHASKELL:
{
if (style == SCE_HA_PREPROCESSOR)
return FALSE;
break;
}
}
return !(highlighting_is_comment_style(lexer, style) ||
highlighting_is_string_style(lexer, style));

View File

@ -642,7 +642,9 @@ static const HLStyle highlighting_styles_HASKELL[] =
};
static const HLKeyword highlighting_keywords_HASKELL[] =
{
{ 0, "keywords", FALSE }
{ 0, "keywords", FALSE },
{ 1, "ffi", FALSE },
{ 2, "reserved_operators", FALSE }
};
#define highlighting_properties_HASKELL EMPTY_PROPERTIES