- Subject: Re: C# mode
- From: MDK <michaldominik@xxxxxxxxx>
- Date: Fri, 2 Sep 2005 15:05:23 +0200
> The script "keywords.sl" can help a lot when writing define_keywords_n.
>
> http://jedmodes.sourceforge.net/mode/keywords/
>
> Look at example 2 in
> http://jedmodes.sourceforge.net/mode/keywords/doc/keywords_sl.html
>
> Marko
Well, I might be missing something completely, but I've got problems
with keywords.sl. It seems that some words work, while others don't.
Below is my first shot at the glib mode. Everything works fine except
for "void" , "struct" , "case" , "switch"... no idea why ("if", "do",
"for" work fine).
--
Michał Dominik K.
michaldominik@xxxxxxxxx
www.mdk.org.pl
% glib_mode.sl
require ("cmode");
require ("keywords");
$1 = "glib";
create_syntax_table ($1);
define_syntax ("/*", "*/", '%', $1);
define_syntax ("//", "", '%', $1);
define_syntax ("([{", ")]}", '(', $1);
define_syntax ('"', '"', $1);
define_syntax ('\'', '\'', $1);
define_syntax ('\\', '\\', $1);
define_syntax ("0-9a-zA-Z_", 'w', $1); % words
define_syntax ("-+0-9a-fA-F.xXL", '0', $1); % Numbers
define_syntax (",;.?:", ',', $1);
define_syntax ('#', '#', $1);
define_syntax ("%-+/&*=<>|!~^", '+', $1);
set_syntax_flags ($1, 4+0x40+0x80+0x20);
define glib_keywords ()
{
% Keywords
variable wordss = keywords->new_keyword_list();
keywords->add_keywords(wordss, "void switch case goto for if
return while until do");
keywords->sort_keywords(wordss);
keywords->strlow_keywords(wordss);
keywords->define_keywords(wordss, "glib", 0);
% Basic types
variable types = keywords->new_keyword_list();
keywords->add_keywords(types, "gboolean gpointer gconstpointer
gchar guchar");
keywords->add_keywords(types, "gint guint gshort gushort glong
gulong gint8 guint8 gint16 guint16 gint32 guint32");
keywords->add_keywords(types, "gint64 guint64 gfloat gdouble
gsize gssize");
keywords->sort_keywords(types);
keywords->strlow_keywords(types);
keywords->define_keywords(types, "glib", 0);
% Asserts
variable asserts = keywords->new_keyword_list();
keywords->add_keywords(asserts, "g_assert g_assert_not_reached");
keywords->strlow_keywords(asserts);
keywords->define_keywords(asserts, "glib", 1);
% Return val
variable returns = keywords->new_keyword_list();
keywords->add_keywords(returns, "g_return_val_if_fail
g_return_val_if_reached g_return_if_fail g_return_if_reached");
keywords->strlow_keywords(returns);
keywords->define_keywords(returns, "glib", 1);
% Return val
variable constants = keywords->new_keyword_list();
keywords->add_keywords(constants, "NULL TRUE FALSE");
keywords->strlow_keywords(constants);
keywords->define_keywords(constants, "glib", 1);
}
define glib_mode ()
{
c_mode ();
glib_keywords ();
set_mode ("glib", 2);
use_syntax_table ("glib");
run_mode_hooks("glib_mode_hook");
}
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2005 date index]
[2005 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]