Add OpenGL Shader Language (GLSL) filetype (patch from Colomban
Wendling, thanks; closes #2060961). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2908 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
2ad140a1fd
commit
6ce421f141
@ -1,3 +1,12 @@
|
||||
2008-08-27 Nick Treleaven <nick.treleaven<at>btinternet.com>
|
||||
|
||||
* src/highlighting.c, src/plugindata.h, src/filetypes.c,
|
||||
src/filetypes.h, src/symbols.c, THANKS, tagmanager/parsers.h,
|
||||
tagmanager/c.c, data/filetypes.glsl, data/filetype_extensions.conf:
|
||||
Add OpenGL Shader Language (GLSL) filetype (patch from Colomban
|
||||
Wendling, thanks; closes #2060961).
|
||||
|
||||
|
||||
2008-08-26 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
* src/highlighting.c:
|
||||
|
1
THANKS
1
THANKS
@ -45,6 +45,7 @@ Pierre Joye <pierre(dot)php(at)gmail(dot)com> - Win32 process spawning patch
|
||||
Matti Mårds <mamaar(at)gmail(dot)com> - create PHP tags script
|
||||
Robert McGinley <mcginleyr1(at)gmail(dot)com> - Documentation improvements
|
||||
Felipe Pena <felipensp(at)gmail(dot)com> - Missing PHP keywords
|
||||
Colomban Wendling <colombanw(at)users(dot)sourceforge(dot)net> - GLSL filetype patch
|
||||
|
||||
Translators:
|
||||
------------
|
||||
|
@ -13,6 +13,7 @@ D=*.d;*.di;
|
||||
F77=*.f;*.for;*.ftn;*.f77;
|
||||
Fortran=*.f90;*.f95;*.f03;
|
||||
FreeBasic=*.bas;*.bi;
|
||||
GLSL=*.glsl;*.frag;*.vert
|
||||
Haskell=*.hs;*.lhs;
|
||||
Haxe=*.hx;
|
||||
Java=*.java;*.jsp;
|
||||
|
68
data/filetypes.glsl
Normal file
68
data/filetypes.glsl
Normal file
@ -0,0 +1,68 @@
|
||||
# For complete documentation of this file, please see Geany's main documentation
|
||||
[styling]
|
||||
# foreground;background;bold;italic
|
||||
default=0x000000;0xffffff;false;false
|
||||
comment=0xd00000;0xffffff;false;false
|
||||
commentline=0xd00000;0xffffff;false;false
|
||||
commentdoc=0x3f5fbf;0xffffff;false;false
|
||||
number=0x007f00;0xffffff;false;false
|
||||
word=0x00007f;0xffffff;true;false
|
||||
word2=0x991111;0xffffff;true;false
|
||||
string=0xff901e;0xffffff;false;false
|
||||
character=0xff901e;0xffffff;false;false
|
||||
uuid=0x404080;0xffffff;false;false
|
||||
preprocessor=0x007F7F;0xffffff;false;false
|
||||
operator=0x301010;0xffffff;false;false
|
||||
identifier=0x000000;0xffffff;false;false
|
||||
stringeol=0x000000;0xe0c0e0;false;false
|
||||
verbatim=0x101030;0xffffff;false;false
|
||||
regex=0x105090;0xffffff;false;false
|
||||
commentlinedoc=0x3f5fbf;0xffffff;true;false
|
||||
commentdockeyword=0x3f5fbf;0xffffff;true;true
|
||||
commentdockeyworderror=0x3f5fbf;0xffffff;false;false
|
||||
globalclass=0x0000d0;0xffffff;true;false
|
||||
# whether arguments of preprocessor commands should be styled (only first argument is used)
|
||||
# 1 to enable, 0 to disable
|
||||
styling_within_preprocessor=1;0;false;false
|
||||
|
||||
[keywords]
|
||||
# all items must be in one line
|
||||
primary=if else switch case default for while do discard return break continue true false struct void bool int uint float vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 uvec2 uvec3 uvec4 mat2 mat3 mat4 mat2x2 mat2x3 mat2x4 mat3x2 mat3x3 mat3x4 mat4x2 mat4x3 mat4x4 sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow sampler1DArray sampler2DArray sampler1DArrayShadow sampler2DArrayShadow isampler1D isampler2D isampler3D isamplerCube isampler1DArray isampler2DArray usampler1D usampler2D usampler3D usamplerCube usampler1DArray usampler2DArray const invariant centroid in out inout attribute uniform varying smooth flat noperspective highp mediump lowp
|
||||
secondary=
|
||||
# these are some doxygen keywords (incomplete)
|
||||
docComment=attention author brief bug class code date def enum example exception file fn namespace note param remarks return returns see since struct throw todo typedef var version warning union
|
||||
|
||||
[settings]
|
||||
# default extension used when saving files
|
||||
#extension=glsl
|
||||
|
||||
# the following characters are these which a "word" can contains, see documentation
|
||||
#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
|
||||
|
||||
# if only single comment char is supported like # in this file, leave comment_close blank
|
||||
comment_open=//
|
||||
comment_close=
|
||||
# this is an alternative way, so multiline comments are used
|
||||
#comment_open=/*
|
||||
#comment_close=*/
|
||||
|
||||
# set to false if a comment character/string should start at column 0 of a line, true uses any
|
||||
# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
|
||||
#command_example();
|
||||
# setting to false would generate this
|
||||
# command_example();
|
||||
# This setting works only for single line comments
|
||||
comment_use_indent=true
|
||||
|
||||
# context action command (please see Geany's main documentation for details)
|
||||
context_action_cmd=
|
||||
|
||||
[build_settings]
|
||||
# %f will be replaced by the complete filename
|
||||
# %e will be replaced by the filename without extension
|
||||
# (use only one of it at one time)
|
||||
#compiler=
|
||||
#linker=
|
||||
#run_cmd=
|
||||
|
||||
|
@ -167,6 +167,16 @@ static void init_builtin_filetypes(void)
|
||||
ft->comment_open = g_strdup("c");
|
||||
ft->comment_close = NULL;
|
||||
|
||||
#define GLSL
|
||||
ft = filetypes[GEANY_FILETYPES_GLSL];
|
||||
ft->lang = 31;
|
||||
ft->name = g_strdup("GLSL");
|
||||
ft->title = g_strdup_printf(_("%s source file"), "GLSL");
|
||||
ft->extension = g_strdup("glsl");
|
||||
ft->pattern = utils_strv_new("*.glsl", "*.frag", "*.vert", NULL);
|
||||
ft->comment_open = g_strdup("/*");
|
||||
ft->comment_close = g_strdup("*/");
|
||||
|
||||
#define CAML
|
||||
ft = filetypes[GEANY_FILETYPES_CAML];
|
||||
ft->lang = -2;
|
||||
|
@ -45,6 +45,7 @@ typedef enum
|
||||
GEANY_FILETYPES_F77,
|
||||
GEANY_FILETYPES_FORTRAN,
|
||||
GEANY_FILETYPES_BASIC, /* FreeBasic */
|
||||
GEANY_FILETYPES_GLSL,
|
||||
GEANY_FILETYPES_HASKELL,
|
||||
GEANY_FILETYPES_HAXE,
|
||||
GEANY_FILETYPES_JAVA,
|
||||
|
@ -793,6 +793,61 @@ static void styleset_cpp(ScintillaObject *sci)
|
||||
}
|
||||
|
||||
|
||||
static void styleset_glsl_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
||||
{
|
||||
new_style_array(GEANY_FILETYPES_GLSL, 21);
|
||||
styleset_c_like_init(config, config_home, GEANY_FILETYPES_GLSL);
|
||||
get_keyfile_int(config, config_home, "styling", "styling_within_preprocessor",
|
||||
1, 0, &style_sets[GEANY_FILETYPES_GLSL].styling[20]);
|
||||
|
||||
style_sets[GEANY_FILETYPES_GLSL].keywords = g_new(gchar*, 4);
|
||||
get_keyfile_keywords(config, config_home, "keywords", "primary", GEANY_FILETYPES_GLSL, 0,
|
||||
"if else switch case default for while do discard return break"
|
||||
"continue true false struct void bool int uint float vec2 vec3"
|
||||
"vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 uvec2 uvec3 uvec4 mat2"
|
||||
"mat3 mat4 mat2x2 mat2x3 mat2x4 mat3x2 mat3x3 mat3x4 mat4x2 mat4x3"
|
||||
"mat4x4 sampler1D sampler2D sampler3D samplerCube sampler1DShadow"
|
||||
"sampler2DShadow sampler1DArray sampler2DArray sampler1DArrayShadow"
|
||||
"sampler2DArrayShadow isampler1D isampler2D isampler3D isamplerCube"
|
||||
"isampler1DArray isampler2DArray usampler1D usampler2D usampler3D"
|
||||
"usamplerCube usampler1DArray usampler2DArray const invariant"
|
||||
"centroid in out inout attribute uniform varying smooth flat"
|
||||
"noperspective highp mediump lowp");
|
||||
get_keyfile_keywords(config, config_home, "keywords", "secondary", GEANY_FILETYPES_GLSL, 1, "");
|
||||
get_keyfile_keywords(config, config_home, "keywords", "docComment", GEANY_FILETYPES_GLSL, 2, "TODO FIXME");
|
||||
style_sets[GEANY_FILETYPES_GLSL].keywords[3] = NULL;
|
||||
|
||||
get_keyfile_wordchars(config, config_home,
|
||||
&style_sets[GEANY_FILETYPES_GLSL].wordchars);
|
||||
}
|
||||
|
||||
|
||||
static void styleset_glsl(ScintillaObject *sci)
|
||||
{
|
||||
const filetype_id ft_id = GEANY_FILETYPES_GLSL;
|
||||
|
||||
styleset_common(sci, 5, ft_id);
|
||||
|
||||
apply_filetype_properties(sci, SCLEX_CPP, ft_id);
|
||||
|
||||
SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_GLSL].keywords[0]);
|
||||
/* for SCI_SETKEYWORDS = 1, see below*/
|
||||
SSM(sci, SCI_SETKEYWORDS, 2, (sptr_t) style_sets[GEANY_FILETYPES_GLSL].keywords[2]);
|
||||
|
||||
/* assign global types, merge them with user defined keywords and set them */
|
||||
assign_global_and_user_keywords(sci, style_sets[GEANY_FILETYPES_GLSL].keywords[1],
|
||||
filetypes[ft_id]->lang);
|
||||
|
||||
styleset_c_like(sci, GEANY_FILETYPES_GLSL);
|
||||
|
||||
if (style_sets[GEANY_FILETYPES_GLSL].styling[20].foreground == 1)
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "styling.within.preprocessor", (sptr_t) "1");
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.symbol.$(file.patterns.cpp)", (sptr_t) "#");
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.start.$(file.patterns.cpp)", (sptr_t) "if ifdef ifndef");
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.middle.$(file.patterns.cpp)", (sptr_t) "else elif");
|
||||
SSM(sci, SCI_SETPROPERTY, (sptr_t) "preprocessor.end.$(file.patterns.cpp)", (sptr_t) "endif");
|
||||
}
|
||||
|
||||
static void styleset_cs_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
|
||||
{
|
||||
new_style_array(GEANY_FILETYPES_CS, 21);
|
||||
@ -2979,6 +3034,7 @@ void highlighting_init_styles(gint filetype_idx, GKeyFile *config, GKeyFile *con
|
||||
init_styleset_case(GEANY_FILETYPES_FERITE, ferite);
|
||||
init_styleset_case(GEANY_FILETYPES_F77, f77);
|
||||
init_styleset_case(GEANY_FILETYPES_FORTRAN, fortran);
|
||||
init_styleset_case(GEANY_FILETYPES_GLSL, glsl);
|
||||
init_styleset_case(GEANY_FILETYPES_HASKELL, haskell);
|
||||
init_styleset_case(GEANY_FILETYPES_HAXE, haxe);
|
||||
init_styleset_case(GEANY_FILETYPES_HTML, html);
|
||||
@ -3032,6 +3088,7 @@ void highlighting_set_styles(ScintillaObject *sci, gint filetype_idx)
|
||||
styleset_case(GEANY_FILETYPES_FERITE, ferite);
|
||||
styleset_case(GEANY_FILETYPES_F77, f77);
|
||||
styleset_case(GEANY_FILETYPES_FORTRAN, fortran);
|
||||
styleset_case(GEANY_FILETYPES_GLSL, glsl);
|
||||
styleset_case(GEANY_FILETYPES_HASKELL, haskell);
|
||||
styleset_case(GEANY_FILETYPES_HAXE, haxe);
|
||||
styleset_case(GEANY_FILETYPES_HTML, html);
|
||||
|
@ -41,13 +41,13 @@
|
||||
enum {
|
||||
/** The Application Programming Interface (API) version, incremented
|
||||
* whenever any plugin data types are modified or appended to. */
|
||||
GEANY_API_VERSION = 89,
|
||||
GEANY_API_VERSION = 90,
|
||||
|
||||
/** The Application Binary Interface (ABI) version, incremented whenever
|
||||
* existing fields in the plugin data types have to be changed or reordered. */
|
||||
/* This should usually stay the same if fields are only appended, assuming only pointers to
|
||||
* structs and not structs themselves are declared by plugins. */
|
||||
GEANY_ABI_VERSION = 44
|
||||
GEANY_ABI_VERSION = 45
|
||||
};
|
||||
|
||||
/** Check the plugin can be loaded by Geany.
|
||||
|
@ -232,6 +232,7 @@ const gchar *symbols_get_context_separator(gint ft_id)
|
||||
{
|
||||
case GEANY_FILETYPES_C: /* for C++ .h headers or C structs */
|
||||
case GEANY_FILETYPES_CPP:
|
||||
case GEANY_FILETYPES_GLSL: /* for structs */
|
||||
/*case GEANY_FILETYPES_RUBY:*/ /* not sure what to use atm*/
|
||||
{
|
||||
static gchar cc[] = "::";
|
||||
|
@ -247,6 +247,7 @@ static langType Lang_cpp;
|
||||
static langType Lang_csharp;
|
||||
static langType Lang_java;
|
||||
static langType Lang_d;
|
||||
static langType Lang_glsl;
|
||||
static langType Lang_ferite;
|
||||
|
||||
/* Used to index into the CKinds table. */
|
||||
@ -2772,6 +2773,13 @@ static void initializeDParser (const langType language)
|
||||
buildKeywordHash (language, 1); /* C++ keywords */
|
||||
}
|
||||
|
||||
static void initializeGLSLParser (const langType language)
|
||||
{
|
||||
contextual_fake_count = 0;
|
||||
Lang_glsl = language;
|
||||
buildKeywordHash (language, 0);
|
||||
}
|
||||
|
||||
static void initializeFeriteParser (const langType language)
|
||||
{
|
||||
contextual_fake_count = 0;
|
||||
@ -2841,6 +2849,18 @@ extern parserDefinition* DParser (void)
|
||||
return def;
|
||||
}
|
||||
|
||||
extern parserDefinition* GLSLParser (void)
|
||||
{
|
||||
static const char *const extensions [] = { "glsl", "frag", "vert", NULL };
|
||||
parserDefinition* def = parserNew ("GLSL");
|
||||
def->kinds = CKinds;
|
||||
def->kindCount = KIND_COUNT (CKinds);
|
||||
def->extensions = extensions;
|
||||
def->parser2 = findCTags;
|
||||
def->initialize = initializeGLSLParser;
|
||||
return def;
|
||||
}
|
||||
|
||||
extern parserDefinition* FeriteParser (void)
|
||||
{
|
||||
static const char *const extensions [] = { "fe", NULL };
|
||||
|
@ -45,7 +45,8 @@
|
||||
HaxeParser,\
|
||||
RestParser, \
|
||||
HtmlParser, \
|
||||
F77Parser
|
||||
F77Parser, \
|
||||
GLSLParser
|
||||
|
||||
/*
|
||||
langType of each parser
|
||||
@ -80,6 +81,7 @@ langType of each parser
|
||||
28 RestParser
|
||||
29 HtmlParser
|
||||
30 F77Parser
|
||||
31 GLSLParser
|
||||
*/
|
||||
#endif /* _PARSERS_H */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user