[Geany-devel] Improved syntax highlighting for Forth

oco at newmail.ru oco at xxxxx
Tue Aug 14 23:59:28 UTC 2012


Hello to all!
I really enjoy using Geany as an IDE for embedded programming. I often use Forth language but syntax highlighting for Forth in Geany recognizes only one "primary" keyword set.
So, this is a patch for adding "keyword","defword","preword1","preword2","string" keyword sets (as in Scintilla source)

diff --git a/data/filetypes.forth b/data/filetypes.forth
index 4654576..240992a 100644
--- a/data/filetypes.forth
+++ b/data/filetypes.forth
@@ -16,8 +16,12 @@ locale=other
 
 [keywords]
 # all items must be in one line
-primary=ABORT EXIT DO LOOP UNLOOP BEGIN UNTIL WHILE REPEAT EXIT IF ELSE THEN CASE ENDCASE OF ENDOF
-
+primary=abort exit do loop unloop begin until while repeat exit if else then case endcase of endof again leave
+keyword=require included decimal hex also only previous
+defword=create does> variable value 2variable constant , 2, c,
+string=." " s" c" abort"
+preword1=dup drop swap over pick roll 2dup 2drop 2swas 2over
+preword2=! c! @ c@ 2! 2@ and or xor invert negate / /mod mod rshift lshift
 
 [settings]
 # default extension used when saving files
diff --git a/src/highlightingmappings.h b/src/highlightingmappings.h
index 7092900..f848029 100644
--- a/src/highlightingmappings.h
+++ b/src/highlightingmappings.h
@@ -544,10 +544,17 @@ static const HLStyle highlighting_styles_FORTH[] =
 	{ SCE_FORTH_STRING,		"string",		FALSE },
 	{ SCE_FORTH_LOCALE,		"locale",		FALSE }
 };
+
 static const HLKeyword highlighting_keywords_FORTH[] =
 {
-	{ 0, "primary",	FALSE }
+        { 0, "primary", FALSE },
+        { 1, "keyword", FALSE },
+        { 2, "defword", FALSE },
+        { 3, "preword1",        FALSE },
+        { 4, "preword2",        FALSE },
+        { 5, "string",  FALSE }
 };
+
 #define highlighting_properties_FORTH	EMPTY_PROPERTIES
 
 









More information about the Devel mailing list