SF.net SVN: geany:[3444] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Jan 4 16:00:51 UTC 2009


Revision: 3444
          http://geany.svn.sourceforge.net/geany/?rev=3444&view=rev
Author:   eht16
Date:     2009-01-04 16:00:50 +0000 (Sun, 04 Jan 2009)

Log Message:
-----------
Add filetype Ada (closes #1811306 and #1765830, patch by Philipp Gildein, thanks).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/THANKS
    trunk/data/filetype_extensions.conf
    trunk/scintilla/KeyWords.cxx
    trunk/scintilla/Makefile.am
    trunk/scintilla/makefile.win32
    trunk/src/about.c
    trunk/src/editor.c
    trunk/src/filetypes.c
    trunk/src/filetypes.h
    trunk/src/highlighting.c
    trunk/src/plugindata.h
    trunk/src/templates.c
    trunk/wscript

Added Paths:
-----------
    trunk/scintilla/LexAda.cxx

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/ChangeLog	2009-01-04 16:00:50 UTC (rev 3444)
@@ -1,3 +1,13 @@
+2009-01-04  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * wscript, THANKS, data/filetype_extensions.conf, src/templates.c,
+   scintilla/KeyWords.cxx, scintilla/LexAda.cxx, scintilla/Makefile.am,
+   scintilla/makefile.win32, src/about.c, src/editor.c, src/filetypes.c,
+   src/filetypes.h, src/highlighting.c, src/plugindata.h:
+   Add filetype Ada (closes #1811306 and #1765830,
+   patch by Philipp Gildein, thanks).
+
+
 2009-01-03  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/support.h:

Modified: trunk/THANKS
===================================================================
--- trunk/THANKS	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/THANKS	2009-01-04 16:00:50 UTC (rev 3444)
@@ -58,6 +58,7 @@
 Walery Studennikov <despairr(at)gmail(dot)com> - YAML filetype patch
 Guillaume de Rorthais <ioguix(at)free(dot)fr> - Auto-close brackets/braces/quotes patch
 Tyler Mulligan <tyler(at)doknowevil(dot)net> - Close All toolbar icon
+Philipp Gildein <philipp(at)gildein(dot)com> - Ada filetype patch
 
 Translators:
 ------------

Modified: trunk/data/filetype_extensions.conf
===================================================================
--- trunk/data/filetype_extensions.conf	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/data/filetype_extensions.conf	2009-01-04 16:00:50 UTC (rev 3444)
@@ -5,6 +5,7 @@
 #See Geany's main documentation for details.
 [Extensions]
 ASM=*.asm;
+ADA=*.adb;*.ads;
 C=*.c;*.h;
 C++=*.cpp;*.cxx;*.c++;*.cc;*.h;*.hpp;*.hxx;*.h++;*.hh;*.C;
 C#=*.cs;
@@ -41,9 +42,9 @@
 Conf=*.conf;*.ini;config;*rc;*.cfg;
 Diff=*.diff;*.patch;*.rej;
 NSIS=*.nsi;*.nsh;
+Po=*.po;*.pot;
 LaTeX=*.tex;*.sty;*.idx;*.ltx;
 reStructuredText=*.rest;*.reST;*.rst;
 SQL=*.sql;
-Po=*.po;*.pot;
 YAML=*.yaml;*.yml;
 None=*;

Modified: trunk/scintilla/KeyWords.cxx
===================================================================
--- trunk/scintilla/KeyWords.cxx	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/scintilla/KeyWords.cxx	2009-01-04 16:00:50 UTC (rev 3444)
@@ -141,6 +141,7 @@
 
 //++Autogenerated -- run src/LexGen.py to regenerate
 //**\(\tLINK_LEXER(\*);\n\)
+	LINK_LEXER(lmAda);
 	LINK_LEXER(lmAsm);
 	LINK_LEXER(lmBash);
 	LINK_LEXER(lmFreeBasic);

Added: trunk/scintilla/LexAda.cxx
===================================================================
--- trunk/scintilla/LexAda.cxx	                        (rev 0)
+++ trunk/scintilla/LexAda.cxx	2009-01-04 16:00:50 UTC (rev 3444)
@@ -0,0 +1,524 @@
+// Scintilla source code edit control
+/** @file LexAda.cxx
+ ** Lexer for Ada 95
+ **/
+// Copyright 2002 by Sergey Koshcheyev <sergey.k at seznam.cz>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "Platform.h"
+
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "PropSet.h"
+#include "KeyWords.h"
+#include "SciLexer.h"
+#include "SString.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+/*
+ * Interface
+ */
+
+static void ColouriseDocument(
+    unsigned int startPos,
+    int length,
+    int initStyle,
+    WordList *keywordlists[],
+    Accessor &styler);
+
+static const char * const adaWordListDesc[] = {
+	"Keywords",
+	0
+};
+
+LexerModule lmAda(SCLEX_ADA, ColouriseDocument, "ada", NULL, adaWordListDesc);
+
+/*
+ * Implementation
+ */
+
+// Functions that have apostropheStartsAttribute as a parameter set it according to whether
+// an apostrophe encountered after processing the current token will start an attribute or
+// a character literal.
+static void ColouriseCharacter(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseComment(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseContext(StyleContext& sc, char chEnd, int stateEOL);
+static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute);
+static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseString(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseWhiteSpace(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute);
+
+static inline bool IsDelimiterCharacter(int ch);
+static inline bool IsNumberStartCharacter(int ch);
+static inline bool IsNumberCharacter(int ch);
+static inline bool IsSeparatorOrDelimiterCharacter(int ch);
+static bool IsValidIdentifier(const SString& identifier);
+static bool IsValidNumber(const SString& number);
+static inline bool IsWordStartCharacter(int ch);
+static inline bool IsWordCharacter(int ch);
+
+static void ColouriseCharacter(StyleContext& sc, bool& apostropheStartsAttribute) {
+	apostropheStartsAttribute = true;
+
+	sc.SetState(SCE_ADA_CHARACTER);
+
+	// Skip the apostrophe and one more character (so that '' is shown as non-terminated and '''
+	// is handled correctly)
+	sc.Forward();
+	sc.Forward();
+
+	ColouriseContext(sc, '\'', SCE_ADA_CHARACTEREOL);
+}
+
+static void ColouriseContext(StyleContext& sc, char chEnd, int stateEOL) {
+	while (!sc.atLineEnd && !sc.Match(chEnd)) {
+		sc.Forward();
+	}
+
+	if (!sc.atLineEnd) {
+		sc.ForwardSetState(SCE_ADA_DEFAULT);
+	} else {
+		sc.ChangeState(stateEOL);
+	}
+}
+
+static void ColouriseComment(StyleContext& sc, bool& /*apostropheStartsAttribute*/) {
+	// Apostrophe meaning is not changed, but the parameter is present for uniformity
+
+	sc.SetState(SCE_ADA_COMMENTLINE);
+
+	while (!sc.atLineEnd) {
+		sc.Forward();
+	}
+}
+
+static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute) {
+	apostropheStartsAttribute = sc.Match (')');
+	sc.SetState(SCE_ADA_DELIMITER);
+	sc.ForwardSetState(SCE_ADA_DEFAULT);
+}
+
+static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute) {
+	apostropheStartsAttribute = false;
+
+	sc.SetState(SCE_ADA_LABEL);
+
+	// Skip "<<"
+	sc.Forward();
+	sc.Forward();
+
+	SString identifier;
+
+	while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
+		identifier += static_cast<char>(tolower(sc.ch));
+		sc.Forward();
+	}
+
+	// Skip ">>"
+	if (sc.Match('>', '>')) {
+		sc.Forward();
+		sc.Forward();
+	} else {
+		sc.ChangeState(SCE_ADA_ILLEGAL);
+	}
+
+	// If the name is an invalid identifier or a keyword, then make it invalid label
+	if (!IsValidIdentifier(identifier) || keywords.InList(identifier.c_str())) {
+		sc.ChangeState(SCE_ADA_ILLEGAL);
+	}
+
+	sc.SetState(SCE_ADA_DEFAULT);
+
+}
+
+static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) {
+	apostropheStartsAttribute = true;
+
+	SString number;
+	sc.SetState(SCE_ADA_NUMBER);
+
+	// Get all characters up to a delimiter or a separator, including points, but excluding
+	// double points (ranges).
+	while (!IsSeparatorOrDelimiterCharacter(sc.ch) || (sc.ch == '.' && sc.chNext != '.')) {
+		number += static_cast<char>(sc.ch);
+		sc.Forward();
+	}
+
+	// Special case: exponent with sign
+	if ((sc.chPrev == 'e' || sc.chPrev == 'E') &&
+	        (sc.ch == '+' || sc.ch == '-')) {
+		number += static_cast<char>(sc.ch);
+		sc.Forward ();
+
+		while (!IsSeparatorOrDelimiterCharacter(sc.ch)) {
+			number += static_cast<char>(sc.ch);
+			sc.Forward();
+		}
+	}
+
+	if (!IsValidNumber(number)) {
+		sc.ChangeState(SCE_ADA_ILLEGAL);
+	}
+
+	sc.SetState(SCE_ADA_DEFAULT);
+}
+
+static void ColouriseString(StyleContext& sc, bool& apostropheStartsAttribute) {
+	apostropheStartsAttribute = true;
+
+	sc.SetState(SCE_ADA_STRING);
+	sc.Forward();
+
+	ColouriseContext(sc, '"', SCE_ADA_STRINGEOL);
+}
+
+static void ColouriseWhiteSpace(StyleContext& sc, bool& /*apostropheStartsAttribute*/) {
+	// Apostrophe meaning is not changed, but the parameter is present for uniformity
+	sc.SetState(SCE_ADA_DEFAULT);
+	sc.ForwardSetState(SCE_ADA_DEFAULT);
+}
+
+static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute) {
+	apostropheStartsAttribute = true;
+	sc.SetState(SCE_ADA_IDENTIFIER);
+
+	SString word;
+
+	while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
+		word += static_cast<char>(tolower(sc.ch));
+		sc.Forward();
+	}
+
+	if (!IsValidIdentifier(word)) {
+		sc.ChangeState(SCE_ADA_ILLEGAL);
+
+	} else if (keywords.InList(word.c_str())) {
+		sc.ChangeState(SCE_ADA_WORD);
+
+		if (word != "all") {
+			apostropheStartsAttribute = false;
+		}
+	}
+
+	sc.SetState(SCE_ADA_DEFAULT);
+}
+
+//
+// ColouriseDocument
+//
+
+static void ColouriseDocument(
+    unsigned int startPos,
+    int length,
+    int initStyle,
+    WordList *keywordlists[],
+    Accessor &styler) {
+	WordList &keywords = *keywordlists[0];
+
+	StyleContext sc(startPos, length, initStyle, styler);
+
+	int lineCurrent = styler.GetLine(startPos);
+	bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0;
+
+	while (sc.More()) {
+		if (sc.atLineEnd) {
+			// Go to the next line
+			sc.Forward();
+			lineCurrent++;
+
+			// Remember the line state for future incremental lexing
+			styler.SetLineState(lineCurrent, apostropheStartsAttribute);
+
+			// Don't continue any styles on the next line
+			sc.SetState(SCE_ADA_DEFAULT);
+		}
+
+		// Comments
+		if (sc.Match('-', '-')) {
+			ColouriseComment(sc, apostropheStartsAttribute);
+
+		// Strings
+		} else if (sc.Match('"')) {
+			ColouriseString(sc, apostropheStartsAttribute);
+
+		// Characters
+		} else if (sc.Match('\'') && !apostropheStartsAttribute) {
+			ColouriseCharacter(sc, apostropheStartsAttribute);
+
+		// Labels
+		} else if (sc.Match('<', '<')) {
+			ColouriseLabel(sc, keywords, apostropheStartsAttribute);
+
+		// Whitespace
+		} else if (IsASpace(sc.ch)) {
+			ColouriseWhiteSpace(sc, apostropheStartsAttribute);
+
+		// Delimiters
+		} else if (IsDelimiterCharacter(sc.ch)) {
+			ColouriseDelimiter(sc, apostropheStartsAttribute);
+
+		// Numbers
+		} else if (IsADigit(sc.ch) || sc.ch == '#') {
+			ColouriseNumber(sc, apostropheStartsAttribute);
+
+		// Keywords or identifiers
+		} else {
+			ColouriseWord(sc, keywords, apostropheStartsAttribute);
+		}
+	}
+
+	sc.Complete();
+}
+
+static inline bool IsDelimiterCharacter(int ch) {
+	switch (ch) {
+	case '&':
+	case '\'':
+	case '(':
+	case ')':
+	case '*':
+	case '+':
+	case ',':
+	case '-':
+	case '.':
+	case '/':
+	case ':':
+	case ';':
+	case '<':
+	case '=':
+	case '>':
+	case '|':
+		return true;
+	default:
+		return false;
+	}
+}
+
+static inline bool IsNumberCharacter(int ch) {
+	return IsNumberStartCharacter(ch) ||
+	       ch == '_' ||
+	       ch == '.' ||
+	       ch == '#' ||
+	       (ch >= 'a' && ch <= 'f') ||
+	       (ch >= 'A' && ch <= 'F');
+}
+
+static inline bool IsNumberStartCharacter(int ch) {
+	return IsADigit(ch);
+}
+
+static inline bool IsSeparatorOrDelimiterCharacter(int ch) {
+	return IsASpace(ch) || IsDelimiterCharacter(ch);
+}
+
+static bool IsValidIdentifier(const SString& identifier) {
+	// First character can't be '_', so initialize the flag to true
+	bool lastWasUnderscore = true;
+
+	size_t length = identifier.length();
+
+	// Zero-length identifiers are not valid (these can occur inside labels)
+	if (length == 0) {
+		return false;
+	}
+
+	// Check for valid character at the start
+	if (!IsWordStartCharacter(identifier[0])) {
+		return false;
+	}
+
+	// Check for only valid characters and no double underscores
+	for (size_t i = 0; i < length; i++) {
+		if (!IsWordCharacter(identifier[i]) ||
+		        (identifier[i] == '_' && lastWasUnderscore)) {
+			return false;
+		}
+		lastWasUnderscore = identifier[i] == '_';
+	}
+
+	// Check for underscore at the end
+	if (lastWasUnderscore == true) {
+		return false;
+	}
+
+	// All checks passed
+	return true;
+}
+
+static bool IsValidNumber(const SString& number) {
+	int hashPos = number.search("#");
+	bool seenDot = false;
+
+	size_t i = 0;
+	size_t length = number.length();
+
+	if (length == 0)
+		return false; // Just in case
+
+	// Decimal number
+	if (hashPos == -1) {
+		bool canBeSpecial = false;
+
+		for (; i < length; i++) {
+			if (number[i] == '_') {
+				if (!canBeSpecial) {
+					return false;
+				}
+				canBeSpecial = false;
+			} else if (number[i] == '.') {
+				if (!canBeSpecial || seenDot) {
+					return false;
+				}
+				canBeSpecial = false;
+				seenDot = true;
+			} else if (IsADigit(number[i])) {
+				canBeSpecial = true;
+			} else {
+				break;
+			}
+		}
+
+		if (!canBeSpecial)
+			return false;
+	} else {
+		// Based number
+		bool canBeSpecial = false;
+		int base = 0;
+
+		// Parse base
+		for (; i < length; i++) {
+			int ch = number[i];
+			if (ch == '_') {
+				if (!canBeSpecial)
+					return false;
+				canBeSpecial = false;
+			} else if (IsADigit(ch)) {
+				base = base * 10 + (ch - '0');
+				if (base > 16)
+					return false;
+				canBeSpecial = true;
+			} else if (ch == '#' && canBeSpecial) {
+				break;
+			} else {
+				return false;
+			}
+		}
+
+		if (base < 2)
+			return false;
+		if (i == length)
+			return false;
+
+		i++; // Skip over '#'
+
+		// Parse number
+		canBeSpecial = false;
+
+		for (; i < length; i++) {
+			int ch = tolower(number[i]);
+
+			if (ch == '_') {
+				if (!canBeSpecial) {
+					return false;
+				}
+				canBeSpecial = false;
+
+			} else if (ch == '.') {
+				if (!canBeSpecial || seenDot) {
+					return false;
+				}
+				canBeSpecial = false;
+				seenDot = true;
+
+			} else if (IsADigit(ch)) {
+				if (ch - '0' >= base) {
+					return false;
+				}
+				canBeSpecial = true;
+
+			} else if (ch >= 'a' && ch <= 'f') {
+				if (ch - 'a' + 10 >= base) {
+					return false;
+				}
+				canBeSpecial = true;
+
+			} else if (ch == '#' && canBeSpecial) {
+				break;
+
+			} else {
+				return false;
+			}
+		}
+
+		if (i == length) {
+			return false;
+		}
+
+		i++;
+	}
+
+	// Exponent (optional)
+	if (i < length) {
+		if (number[i] != 'e' && number[i] != 'E')
+			return false;
+
+		i++; // Move past 'E'
+
+		if (i == length) {
+			return false;
+		}
+
+		if (number[i] == '+')
+			i++;
+		else if (number[i] == '-') {
+			if (seenDot) {
+				i++;
+			} else {
+				return false; // Integer literals should not have negative exponents
+			}
+		}
+
+		if (i == length) {
+			return false;
+		}
+
+		bool canBeSpecial = false;
+
+		for (; i < length; i++) {
+			if (number[i] == '_') {
+				if (!canBeSpecial) {
+					return false;
+				}
+				canBeSpecial = false;
+			} else if (IsADigit(number[i])) {
+				canBeSpecial = true;
+			} else {
+				return false;
+			}
+		}
+
+		if (!canBeSpecial)
+			return false;
+	}
+
+	// if i == length, number was parsed successfully.
+	return i == length;
+}
+
+static inline bool IsWordCharacter(int ch) {
+	return IsWordStartCharacter(ch) || IsADigit(ch);
+}
+
+static inline bool IsWordStartCharacter(int ch) {
+	return (isascii(ch) && isalpha(ch)) || ch == '_';
+}


Property changes on: trunk/scintilla/LexAda.cxx
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Modified: trunk/scintilla/Makefile.am
===================================================================
--- trunk/scintilla/Makefile.am	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/scintilla/Makefile.am	2009-01-04 16:00:50 UTC (rev 3444)
@@ -6,6 +6,7 @@
 AM_CXXFLAGS = -DNDEBUG -DGTK -DGTK2 -DSCI_LEXER -DG_THREADS_IMPL_NONE
 
 LEXER_SRCS= \
+LexAda.cxx \
 LexAsm.cxx \
 LexBasic.cxx \
 LexBash.cxx \

Modified: trunk/scintilla/makefile.win32
===================================================================
--- trunk/scintilla/makefile.win32	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/scintilla/makefile.win32	2009-01-04 16:00:50 UTC (rev 3444)
@@ -60,7 +60,7 @@
 #++Autogenerated -- run src/LexGen.py to regenerate
 #**LEXOBJS=\\\n\(\*.o \)
 LEXOBJS=\
-LexBash.o LexAsm.o LexCSS.o LexCPP.o LexCrontab.o LexHTML.o LexOthers.o LexPascal.o \
+LexAda.o LexBash.o LexAsm.o LexCSS.o LexCPP.o LexCrontab.o LexHTML.o LexOthers.o LexPascal.o \
 LexPerl.o LexPython.o LexSQL.o LexCaml.o LexOMS.o LexTCL.o LexRuby.o LexFortran.o LexVHDL.o LexMatlab.o \
 LexD.o LexLua.o LexHaskell.o LexBasic.o LexR.o LexYAML.o LexCmake.o LexNsis.o
 #--Autogenerated -- end of automatically generated section

Modified: trunk/src/about.c
===================================================================
--- trunk/src/about.c	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/src/about.c	2009-01-04 16:00:50 UTC (rev 3444)
@@ -82,7 +82,7 @@
 "Christoph Berg, Colomban Wendling, Conrad Steenberg, Daniel Richard G., Dave Moore, Dirk Weber, Felipe Pena, François Cami, "
 "Giuseppe Torelli, Guillaume de Rorthais, Guillaume Hoffmann, Herbert Voss, Jason Oster, Jean-François Wauthy, Jeff Pohlmeyer, "
 "John Gabriele, Josef Whiter, Kevin Ellwood, Kristoffer A. Tjernås, Marko Peric, Matti Mårds, Moritz Barsnick, "
-"Peter Strand, Pierre Joye, Rob van der Linde, Robert McGinley, Roland Baudin, S Jagannathan, Saleem Abdulrasool, "
+"Peter Strand, Philipp Gildein, Pierre Joye, Rob van der Linde, Robert McGinley, Roland Baudin, S Jagannathan, Saleem Abdulrasool, "
 "Sebastian Kraft, Shiv, Slava Semushin, Stefan Oltmanns, Tamim, Tomás Vírseda, Tyler Mulligan, Walery Studennikov, "
 "Yura Siamashka";
 

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/src/editor.c	2009-01-04 16:00:50 UTC (rev 3444)
@@ -2947,6 +2947,10 @@
 				style == SCE_NSIS_STRINGLQ ||
 				style == SCE_NSIS_STRINGRQ ||
 				style == SCE_NSIS_STRINGVAR);
+
+		case SCLEX_ADA:
+			return (style == SCE_ADA_CHARACTER ||
+				style == SCE_ADA_STRING);
 	}
 	return FALSE;
 }
@@ -3064,6 +3068,10 @@
 		case SCLEX_NSIS:
 			return (style == SCE_NSIS_COMMENT ||
 				style == SCE_NSIS_COMMENTBOX);
+
+		case SCLEX_ADA:
+			return (style == SCE_ADA_COMMENTLINE ||
+				style == SCE_NSIS_COMMENTBOX);
 	}
 	return FALSE;
 }

Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/src/filetypes.c	2009-01-04 16:00:50 UTC (rev 3444)
@@ -550,6 +550,17 @@
 	ft->comment_close = NULL;
 	ft->group = GEANY_FILETYPE_GROUP_MISC;
 
+#define ADA
+	ft = filetypes[GEANY_FILETYPES_ADA];
+	ft->lang = -2;
+	ft->name = g_strdup("Ada");
+	ft->title = g_strdup_printf(_("%s source file"), "Ada");
+	ft->extension = g_strdup("adb");
+	ft->pattern = utils_strv_new("*.adb", "*.ads", NULL);
+	ft->comment_open = g_strdup("--");
+	ft->comment_close = NULL;
+	ft->group = GEANY_FILETYPE_GROUP_COMPILED;
+
 #define ALL
 	ft = filetypes[GEANY_FILETYPES_NONE];
 	ft->lang = -2;

Modified: trunk/src/filetypes.h
===================================================================
--- trunk/src/filetypes.h	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/src/filetypes.h	2009-01-04 16:00:50 UTC (rev 3444)
@@ -37,6 +37,7 @@
 {
 	/* normally compiled languages */
 	GEANY_FILETYPES_ASM = 0,
+	GEANY_FILETYPES_ADA,
 	GEANY_FILETYPES_C,
 	GEANY_FILETYPES_CPP,
 	GEANY_FILETYPES_CS,

Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/src/highlighting.c	2009-01-04 16:00:50 UTC (rev 3444)
@@ -3331,6 +3331,56 @@
 }
 
 
+static void styleset_ada_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
+{
+	new_style_array(GEANY_FILETYPES_ADA, 12);
+
+	get_keyfile_hex(config, config_home, "styling", "default", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_ADA].styling[0]);
+	get_keyfile_hex(config, config_home, "styling", "word", "0x00007f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_ADA].styling[1]);
+	get_keyfile_hex(config, config_home, "styling", "identifier", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_ADA].styling[2]);
+	get_keyfile_hex(config, config_home, "styling", "number", "0x007f00", "0xffffff", "false", &style_sets[GEANY_FILETYPES_ADA].styling[3]);
+	get_keyfile_hex(config, config_home, "styling", "delimiter", "0x301010", "0xffffff", "false", &style_sets[GEANY_FILETYPES_ADA].styling[4]);
+	get_keyfile_hex(config, config_home, "styling", "character", "0xff901e", "0xffffff", "false", &style_sets[GEANY_FILETYPES_ADA].styling[5]);
+	get_keyfile_hex(config, config_home, "styling", "charactereol", "0x000000", "0xe0c0e0", "false", &style_sets[GEANY_FILETYPES_ADA].styling[6]);
+	get_keyfile_hex(config, config_home, "styling", "string", "0xff901e", "0xffffff", "false", &style_sets[GEANY_FILETYPES_ADA].styling[7]);
+	get_keyfile_hex(config, config_home, "styling", "stringeol", "0x000000", "0xe0c0e0", "false", &style_sets[GEANY_FILETYPES_ADA].styling[8]);
+	get_keyfile_hex(config, config_home, "styling", "label", "0xaaaaaa", "0xffffff", "false", &style_sets[GEANY_FILETYPES_ADA].styling[9]);
+	get_keyfile_hex(config, config_home, "styling", "commentline", "0xd00000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_ADA].styling[10]);
+	get_keyfile_hex(config, config_home, "styling", "illegal", "0xff0000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_ADA].styling[11]);
+
+	style_sets[GEANY_FILETYPES_ADA].keywords = g_new(gchar*, 2);
+	get_keyfile_keywords(config, config_home, "keywords", "primary", GEANY_FILETYPES_ADA, 0, "abort abs abstract accept access aliased all and array at begin body case constant declare delay delta digits do else elsif end entry exception exit for function generic goto if in interface is limited loop mod new not null of or others out overriding package pragma private procedure protected raise range record rem renames requeue return reverse select separate subtype synchronized tagged task terminate then type until use when while with xor");
+	style_sets[GEANY_FILETYPES_ADA].keywords[1] = NULL;
+
+	get_keyfile_wordchars(config, config_home,
+		&style_sets[GEANY_FILETYPES_ADA].wordchars);
+}
+
+
+static void styleset_ada(ScintillaObject *sci)
+{
+	const filetype_id ft_id = GEANY_FILETYPES_ADA;
+
+	apply_filetype_properties(sci, SCLEX_ADA, ft_id);
+
+	SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_ADA].keywords[0]);
+
+	set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_ADA, 0);
+	set_sci_style(sci, SCE_ADA_DEFAULT, GEANY_FILETYPES_ADA, 0);
+	set_sci_style(sci, SCE_ADA_WORD, GEANY_FILETYPES_ADA, 1);
+	set_sci_style(sci, SCE_ADA_IDENTIFIER, GEANY_FILETYPES_ADA, 2);
+	set_sci_style(sci, SCE_ADA_NUMBER, GEANY_FILETYPES_ADA, 3);
+	set_sci_style(sci, SCE_ADA_DELIMITER, GEANY_FILETYPES_ADA, 4);
+	set_sci_style(sci, SCE_ADA_CHARACTER, GEANY_FILETYPES_ADA, 5);
+	set_sci_style(sci, SCE_ADA_CHARACTEREOL, GEANY_FILETYPES_ADA, 6);
+	set_sci_style(sci, SCE_ADA_STRING, GEANY_FILETYPES_ADA, 7);
+	set_sci_style(sci, SCE_ADA_STRINGEOL, GEANY_FILETYPES_ADA, 8);
+	set_sci_style(sci, SCE_ADA_LABEL, GEANY_FILETYPES_ADA, 9);
+	set_sci_style(sci, SCE_ADA_COMMENTLINE, GEANY_FILETYPES_ADA, 10);
+	set_sci_style(sci, SCE_ADA_ILLEGAL, GEANY_FILETYPES_ADA, 11);
+}
+
+
 /* lang_name is the name used for the styleset_foo_init function, e.g. foo. */
 #define init_styleset_case(ft_id, lang_name) \
 	case (ft_id): \
@@ -3347,6 +3397,7 @@
 	switch (filetype_idx)
 	{
 		init_styleset_case(GEANY_FILETYPES_NONE,	common);
+		init_styleset_case(GEANY_FILETYPES_ADA,		ada);
 		init_styleset_case(GEANY_FILETYPES_ASM,		asm);
 		init_styleset_case(GEANY_FILETYPES_BASIC,	basic);
 		init_styleset_case(GEANY_FILETYPES_C,		c);
@@ -3408,6 +3459,7 @@
 
 	switch (filetype_idx)
 	{
+		styleset_case(GEANY_FILETYPES_ADA,		ada);
 		styleset_case(GEANY_FILETYPES_ASM,		asm);
 		styleset_case(GEANY_FILETYPES_BASIC,	basic);
 		styleset_case(GEANY_FILETYPES_C,		c);

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/src/plugindata.h	2009-01-04 16:00:50 UTC (rev 3444)
@@ -45,13 +45,13 @@
 enum {
 	/** The Application Programming Interface (API) version, incremented
 	 * whenever any plugin data types are modified or appended to. */
-	GEANY_API_VERSION = 122,
+	GEANY_API_VERSION = 123,
 
 	/** 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 = 55
+	GEANY_ABI_VERSION = 56
 };
 
 /** Check the plugin can be loaded by Geany.

Modified: trunk/src/templates.c
===================================================================
--- trunk/src/templates.c	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/src/templates.c	2009-01-04 16:00:50 UTC (rev 3444)
@@ -608,6 +608,7 @@
 			break;
 		}
 
+		case GEANY_FILETYPES_ADA:
 		case GEANY_FILETYPES_HASKELL:
 		case GEANY_FILETYPES_VHDL:
 		case GEANY_FILETYPES_LUA:

Modified: trunk/wscript
===================================================================
--- trunk/wscript	2009-01-03 16:37:47 UTC (rev 3443)
+++ trunk/wscript	2009-01-04 16:00:50 UTC (rev 3444)
@@ -71,7 +71,7 @@
 	'scintilla/CharClassify.cxx', 'scintilla/ContractionState.cxx', 'scintilla/Decoration.cxx',
 	'scintilla/DocumentAccessor.cxx', 'scintilla/Document.cxx', 'scintilla/Editor.cxx',
 	'scintilla/ExternalLexer.cxx',  'scintilla/Indicator.cxx',  'scintilla/KeyMap.cxx',
-	'scintilla/KeyWords.cxx', 'scintilla/LexAsm.cxx', 'scintilla/LexBash.cxx',
+	'scintilla/KeyWords.cxx', 'scintilla/LexAda.cxx', 'scintilla/LexAsm.cxx', 'scintilla/LexBash.cxx',
 	'scintilla/LexBasic.cxx', 'scintilla/LexCaml.cxx', 'scintilla/LexCmake.cxx', 'scintilla/LexCPP.cxx',
 	'scintilla/LexCrontab.cxx', 'scintilla/LexCSS.cxx', 'scintilla/LexD.cxx',
 	'scintilla/LexFortran.cxx', 'scintilla/LexHaskell.cxx', 'scintilla/LexHTML.cxx',


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list