SF.net SVN: geany: [1635] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Fri Jun 22 17:34:32 UTC 2007


Revision: 1635
          http://svn.sourceforge.net/geany/?rev=1635&view=rev
Author:   eht16
Date:     2007-06-22 10:34:31 -0700 (Fri, 22 Jun 2007)

Log Message:
-----------
Add new filetypes CSharp and FreeBasic.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/data/filetype_extensions.conf
    trunk/scintilla/KeyWords.cxx
    trunk/scintilla/Makefile.am
    trunk/scintilla/makefile.win32
    trunk/src/editor.c
    trunk/src/filetypes.c
    trunk/src/filetypes.h
    trunk/src/highlighting.c
    trunk/src/highlighting.h
    trunk/src/msgwindow.c
    trunk/src/templates.c
    trunk/tagmanager/Makefile.am
    trunk/tagmanager/makefile.win32
    trunk/tagmanager/parsers.h

Added Paths:
-----------
    trunk/data/filetypes.cs
    trunk/data/filetypes.freebasic
    trunk/scintilla/LexBasic.cxx
    trunk/tagmanager/basic.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/ChangeLog	2007-06-22 17:34:31 UTC (rev 1635)
@@ -1,3 +1,18 @@
+2007-06-22  Enrico Tröger  <enrico.troeger at uvena.de>
+
+ * tagmanager/c.c, tagmanager/get.c, tagmanager/get.h:
+   Use get.c and get.h from CTags SVN.
+   Merged CSharp parser support into from CTags SVN.
+ * data/filetype_extensions.conf, data/filetypes.cs,
+   data/filetypes.freebasic, scintilla/KeyWords.cxx,
+   scintilla/LexBasic.cxx, scintilla/Makefile.am, src/editor.c,
+   scintilla/makefile.win32, src/filetypes.c, src/filetypes.h,
+   src/highlighting.c, src/highlighting.h, src/msgwindow.c,
+   src/templates.c, tagmanager/basic.c, tagmanager/Makefile.am,
+   tagmanager/makefile.win32, tagmanager/parsers.h:
+   Add new filetypes CSharp and FreeBasic.
+
+
 2007-06-20  Nick Treleaven  <nick.treleaven at btinternet.com>
 
  * src/callbacks.c:

Modified: trunk/data/filetype_extensions.conf
===================================================================
--- trunk/data/filetype_extensions.conf	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/data/filetype_extensions.conf	2007-06-22 17:34:31 UTC (rev 1635)
@@ -4,9 +4,11 @@
 [Extensions]
 C=*.c;*.h;
 C++=*.cpp;*.cxx;*.c++;*.cc;*.h;*.hpp;*.hxx;*.h++;*.hh;*.C;
+C#=*.cs;*.lala;
 D=*.d;*.di;
 Java=*.java;*.jsp;
 Pascal=*.pas;*.pp;*.inc;*.dpr;*.dpk;
+FreeBasic=*.bas;*.bi;
 ASM=*.asm;
 Fortran=*.f;*.for;*.ftn;*.f77;*.f90;*.f95;
 CAML=*.ml;*.mli;

Added: trunk/data/filetypes.cs
===================================================================
--- trunk/data/filetypes.cs	                        (rev 0)
+++ trunk/data/filetypes.cs	2007-06-22 17:34:31 UTC (rev 1635)
@@ -0,0 +1,63 @@
+# 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=abstract as base bool break byte case catch char checked class const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long namespace new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual void volatile while
+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 see since struct throw todo typedef var version warning union
+
+[settings]
+# 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)
+# be careful following settings are untested
+compiler=mcs /t:winexe "%f" /r:System,System.Drawing
+run_cmd=mono "%e.exe"

Added: trunk/data/filetypes.freebasic
===================================================================
--- trunk/data/filetypes.freebasic	                        (rev 0)
+++ trunk/data/filetypes.freebasic	2007-06-22 17:34:31 UTC (rev 1635)
@@ -0,0 +1,61 @@
+# For complete documentation of this file, please see Geany's main documentation
+[styling]
+# foreground;background;bold;italic
+default=0x000000;0xffffff;false;false;
+comment=0x808080;0xffffff;false;false;
+number=0x007f00;0xffffff;false;false;
+word=0x00007f;0xffffff;true;false;
+string=0xff901e;0xffffff;false;false;
+preprocessor=0x007f7f;0xffffff;false;false;
+operator=0x301010;0xffffff;false;false;
+identifier=0x000000;0xffffff;false;false;
+date=0x1a6500;0xffffff;false;false;
+stringeol=0x000000;0xe0c0e0;false;false;
+word2=0x007f7f;0xffffff;true;false;
+word3=0x991111;0xffffff;false;false;
+word4=0x0000d0;0xffffff;false;false;
+constant=0x007f7f;0xffffff;false;false;
+# asm is still unused
+asm=0x105090;0xffffff;false;false;
+label=0x007f7f;0xffffff;false;false;
+error=0xd00000;0xffffff;false;false;
+hexnumber=0x007f00;0xffffff;false;false;
+binnumber=0x007f00;0xffffff;false;false;
+
+[keywords]
+# all items must be in one line
+keywords=append as asc asin asm atan2 atn beep bin binary bit bitreset bitset bload bsave byref byte byval call callocate case cbyte cdbl cdecl chain chdir chr cint circle clear clng clngint close cls color command common cons const continue cos cshort csign csng csrlin cubyte cuint culngint cunsg curdir cushort custom cvd cvi cvl cvlongint cvs cvshort data date deallocate declare defbyte defdbl defined defint deflng deflngint defshort defsng defstr defubyte defuint defulngint defushort dim dir do double draw dylibload dylibsymbol else elseif end enum environ environ$ eof eqv erase err error exec exepath exit exp export extern field fix flip for fre freefile function get getjoystick getkey getmouse gosub goto hex hibyte hiword if iif imagecreate imagedestroy imp inkey inp input instr int integer is kill lbound lcase left len let lib line lobyte loc local locate lock lof log long longint loop loword lset ltrim mid mkd mkdir mki mkl mklongint mks mkshort mod multikey mutexcreate mutexdestroy mutexlock mutexunlock name next not oct on once open option or out output overload paint palette pascal pcopy peek peeki peeks pipe pmap point pointer poke pokei pokes pos preserve preset print private procptr pset ptr public put random randomize read reallocate redim rem reset restore resume return rgb rgba right rmdir rnd rset rtrim run sadd screen screencopy screeninfo screenlock screenptr screenres screenset screensync screenunlock seek selectcase setdate setenviron setmouse settime sgn shared shell shl short shr sin single sizeof sleep space spc sqr statement static stdcall step stop str string strptr sub swap system tab tan then threadcreate threadwait time timer to trans trim type ubound ubyte ucase uinteger ulongint union unlock unsigned until ushort using va_arg va_first val val64 valint va_next varptr view viewprint wait wend while width window windowtitle with write xor zstring
+preprocessor=#define defined #dynamic #else #endif #endmacro #error #if #ifdef #ifndef #inclib #include #libpath #line #macro #print #undef
+# user definable keywords
+user1=
+user2=
+
+[settings]
+# 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=fbc -w all "%f"
+run_cmd="./%e"
+

Modified: trunk/scintilla/KeyWords.cxx
===================================================================
--- trunk/scintilla/KeyWords.cxx	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/scintilla/KeyWords.cxx	2007-06-22 17:34:31 UTC (rev 1635)
@@ -144,6 +144,7 @@
 	LINK_LEXER(lmAsm);
 	LINK_LEXER(lmASP);
 	LINK_LEXER(lmBash);
+	LINK_LEXER(lmFreeBasic);
 	LINK_LEXER(lmBatch);
 	LINK_LEXER(lmCaml);
 	LINK_LEXER(lmConf);

Added: trunk/scintilla/LexBasic.cxx
===================================================================
--- trunk/scintilla/LexBasic.cxx	                        (rev 0)
+++ trunk/scintilla/LexBasic.cxx	2007-06-22 17:34:31 UTC (rev 1635)
@@ -0,0 +1,373 @@
+// Scintilla source code edit control
+/** @file LexBasic.cxx
+ ** Lexer for BlitzBasic and PureBasic.
+ **/
+// Copyright 1998-2003 by Neil Hodgson <neilh at scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+// This tries to be a unified Lexer/Folder for all the BlitzBasic/BlitzMax/PurBasic basics
+// and derivatives. Once they diverge enough, might want to split it into multiple
+// lexers for more code clearity.
+//
+// Mail me (elias <at> users <dot> sf <dot> net) for any bugs.
+
+// Folding only works for simple things like functions or types.
+
+// You may want to have a look at my ctags lexer as well, if you additionally to coloring
+// and folding need to extract things like label tags in your editor.
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdarg.h>
+
+#include "Platform.h"
+
+#include "PropSet.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+/* Bits:
+ * 1  - whitespace
+ * 2  - operator
+ * 4  - identifier
+ * 8  - decimal digit
+ * 16 - hex digit
+ * 32 - bin digit
+ */
+static int character_classification[128] =
+{
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  0,  0,  1,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    1,  2,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  10, 2,
+    60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2,  2,  2,  2,  2,  2,
+    2,  20, 20, 20, 20, 20, 20, 4,  4,  4,  4,  4,  4,  4,  4,  4,
+    4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  2,  2,  2,  2,  4,
+    2,  20, 20, 20, 20, 20, 20, 4,  4,  4,  4,  4,  4,  4,  4,  4,
+    4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  2,  2,  2,  2,  0
+};
+
+static bool IsSpace(int c) {
+	return c < 128 && (character_classification[c] & 1);
+}
+
+static bool IsOperator(int c) {
+	return c < 128 && (character_classification[c] & 2);
+}
+
+static bool IsIdentifier(int c) {
+	return c < 128 && (character_classification[c] & 4);
+}
+
+static bool IsDigit(int c) {
+	return c < 128 && (character_classification[c] & 8);
+}
+
+static bool IsHexDigit(int c) {
+	return c < 128 && (character_classification[c] & 16);
+}
+
+static bool IsBinDigit(int c) {
+	return c < 128 && (character_classification[c] & 32);
+}
+
+static int LowerCase(int c)
+{
+	if (c >= 'A' && c <= 'Z')
+		return 'a' + c - 'A';
+	return c;
+}
+
+static void ColouriseBasicDoc(unsigned int startPos, int length, int initStyle,
+                           WordList *keywordlists[], Accessor &styler, char comment_char) {
+	bool wasfirst = true, isfirst = true; // true if first token in a line
+	styler.StartAt(startPos);
+
+	StyleContext sc(startPos, length, initStyle, styler);
+
+	// Can't use sc.More() here else we miss the last character
+	for (; ; sc.Forward()) {
+		if (sc.state == SCE_B_IDENTIFIER) {
+			if (!IsIdentifier(sc.ch)) {
+				// Labels
+				if (wasfirst && sc.Match(':')) {
+					sc.ChangeState(SCE_B_LABEL);
+					sc.ForwardSetState(SCE_B_DEFAULT);
+				} else {
+					char s[100];
+					int kstates[4] = {
+						SCE_B_KEYWORD,
+						SCE_B_KEYWORD2,
+						SCE_B_KEYWORD3,
+						SCE_B_KEYWORD4,
+					};
+					sc.GetCurrentLowered(s, sizeof(s));
+					for (int i = 0; i < 4; i++) {
+						if (keywordlists[i]->InList(s)) {
+							sc.ChangeState(kstates[i]);
+						}
+					}
+					// Types, must set them as operator else they will be
+					// matched as number/constant
+					if (sc.Match('.') || sc.Match('$') || sc.Match('%') ||
+						sc.Match('#')) {
+						sc.SetState(SCE_B_OPERATOR);
+					} else {
+						sc.SetState(SCE_B_DEFAULT);
+					}
+				}
+			}
+		} else if (sc.state == SCE_B_OPERATOR) {
+			if (!IsOperator(sc.ch) || sc.Match('#'))
+				sc.SetState(SCE_B_DEFAULT);
+		} else if (sc.state == SCE_B_LABEL) {
+			if (!IsIdentifier(sc.ch))
+				sc.SetState(SCE_B_DEFAULT);
+		} else if (sc.state == SCE_B_CONSTANT) {
+			if (!IsIdentifier(sc.ch))
+				sc.SetState(SCE_B_DEFAULT);
+		} else if (sc.state == SCE_B_NUMBER) {
+			if (!IsDigit(sc.ch))
+				sc.SetState(SCE_B_DEFAULT);
+		} else if (sc.state == SCE_B_HEXNUMBER) {
+			if (!IsHexDigit(sc.ch))
+				sc.SetState(SCE_B_DEFAULT);
+		} else if (sc.state == SCE_B_BINNUMBER) {
+			if (!IsBinDigit(sc.ch))
+				sc.SetState(SCE_B_DEFAULT);
+		} else if (sc.state == SCE_B_STRING) {
+			if (sc.ch == '"') {
+				sc.ForwardSetState(SCE_B_DEFAULT);
+			}
+			if (sc.atLineEnd) {
+				sc.ChangeState(SCE_B_ERROR);
+				sc.SetState(SCE_B_DEFAULT);
+			}
+		} else if (sc.state == SCE_B_COMMENT || sc.state == SCE_B_PREPROCESSOR) {
+			if (sc.atLineEnd) {
+				sc.SetState(SCE_B_DEFAULT);
+			}
+		}
+
+		if (sc.atLineStart)
+			isfirst = true;
+
+		if (sc.state == SCE_B_DEFAULT || sc.state == SCE_B_ERROR) {
+			if (isfirst && sc.Match('.')) {
+				sc.SetState(SCE_B_LABEL);
+			} else if (isfirst && sc.Match('#')) {
+				wasfirst = isfirst;
+				sc.SetState(SCE_B_IDENTIFIER);
+			} else if (sc.Match(comment_char)) {
+				// Hack to make deprecated QBASIC '$Include show
+				// up in freebasic with SCE_B_PREPROCESSOR.
+				if (comment_char == '\'' && sc.Match(comment_char, '$'))
+					sc.SetState(SCE_B_PREPROCESSOR);
+				else
+					sc.SetState(SCE_B_COMMENT);
+			} else if (sc.Match('"')) {
+				sc.SetState(SCE_B_STRING);
+			} else if (IsDigit(sc.ch)) {
+				sc.SetState(SCE_B_NUMBER);
+			} else if (sc.Match('$')) {
+				sc.SetState(SCE_B_HEXNUMBER);
+			} else if (sc.Match('%')) {
+				sc.SetState(SCE_B_BINNUMBER);
+			} else if (sc.Match('#')) {
+				sc.SetState(SCE_B_CONSTANT);
+			} else if (IsOperator(sc.ch)) {
+				sc.SetState(SCE_B_OPERATOR);
+			} else if (IsIdentifier(sc.ch)) {
+				wasfirst = isfirst;
+				sc.SetState(SCE_B_IDENTIFIER);
+			} else if (!IsSpace(sc.ch)) {
+				sc.SetState(SCE_B_ERROR);
+			}
+		}
+
+		if (!IsSpace(sc.ch))
+			isfirst = false;
+
+		if (!sc.More())
+			break;
+	}
+	sc.Complete();
+}
+
+static int CheckBlitzFoldPoint(char const *token, int &level) {
+	if (!strcmp(token, "function") ||
+		!strcmp(token, "type")) {
+		level |= SC_FOLDLEVELHEADERFLAG;
+		return 1;
+	}
+	if (!strcmp(token, "end function") ||
+		!strcmp(token, "end type")) {
+		return -1;
+	}
+	return 0;
+}
+
+static int CheckPureFoldPoint(char const *token, int &level) {
+	if (!strcmp(token, "procedure") ||
+		!strcmp(token, "enumeration") ||
+		!strcmp(token, "interface") ||
+		!strcmp(token, "structure")) {
+		level |= SC_FOLDLEVELHEADERFLAG;
+		return 1;
+	}
+	if (!strcmp(token, "endprocedure") ||
+		!strcmp(token, "endenumeration") ||
+		!strcmp(token, "endinterface") ||
+		!strcmp(token, "endstructure")) {
+		return -1;
+	}
+	return 0;
+}
+
+static int CheckFreeFoldPoint(char const *token, int &level) {
+	if (!strcmp(token, "function") ||
+		!strcmp(token, "sub") ||
+		!strcmp(token, "type")) {
+		level |= SC_FOLDLEVELHEADERFLAG;
+		return 1;
+	}
+	if (!strcmp(token, "end function") ||
+		!strcmp(token, "end sub") ||
+		!strcmp(token, "end type")) {
+		return -1;
+	}
+	return 0;
+}
+
+static void FoldBasicDoc(unsigned int startPos, int length,
+	Accessor &styler, int (*CheckFoldPoint)(char const *, int &)) {
+	int line = styler.GetLine(startPos);
+	int level = styler.LevelAt(line);
+	int go = 0, done = 0;
+	int endPos = startPos + length;
+	char word[256];
+	int wordlen = 0;
+	int i;
+        bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+	// Scan for tokens at the start of the line (they may include
+	// whitespace, for tokens like "End Function"
+	for (i = startPos; i < endPos; i++) {
+		int c = styler.SafeGetCharAt(i);
+		if (!done && !go) {
+			if (wordlen) { // are we scanning a token already?
+				word[wordlen] = static_cast<char>(LowerCase(c));
+				if (!IsIdentifier(c)) { // done with token
+					word[wordlen] = '\0';
+					go = CheckFoldPoint(word, level);
+					if (!go) {
+						// Treat any whitespace as single blank, for
+						// things like "End   Function".
+						if (IsSpace(c) && IsIdentifier(word[wordlen - 1])) {
+							word[wordlen] = ' ';
+							if (wordlen < 255)
+								wordlen++;
+						}
+						else // done with this line
+							done = 1;
+					}
+				} else if (wordlen < 255) {
+					wordlen++;
+				}
+			} else { // start scanning at first non-whitespace character
+				if (!IsSpace(c)) {
+					if (IsIdentifier(c)) {
+						word[0] = static_cast<char>(LowerCase(c));
+						wordlen = 1;
+					} else // done with this line
+						done = 1;
+				}
+			}
+		}
+		if (c == '\n') { // line end
+			if (!done && wordlen == 0 && foldCompact) // line was only space
+				level |= SC_FOLDLEVELWHITEFLAG;
+			if (level != styler.LevelAt(line))
+				styler.SetLevel(line, level);
+			level += go;
+			line++;
+			// reset state
+			wordlen = 0;
+			level &= ~SC_FOLDLEVELHEADERFLAG;
+			level &= ~SC_FOLDLEVELWHITEFLAG;
+			go = 0;
+			done = 0;
+		}
+	}
+}
+
+static void ColouriseBlitzBasicDoc(unsigned int startPos, int length, int initStyle,
+                           WordList *keywordlists[], Accessor &styler) {
+	ColouriseBasicDoc(startPos, length, initStyle, keywordlists, styler, ';');
+}
+
+static void ColourisePureBasicDoc(unsigned int startPos, int length, int initStyle,
+                           WordList *keywordlists[], Accessor &styler) {
+	ColouriseBasicDoc(startPos, length, initStyle, keywordlists, styler, ';');
+}
+
+static void ColouriseFreeBasicDoc(unsigned int startPos, int length, int initStyle,
+                           WordList *keywordlists[], Accessor &styler) {
+	ColouriseBasicDoc(startPos, length, initStyle, keywordlists, styler, '\'');
+}
+
+static void FoldBlitzBasicDoc(unsigned int startPos, int length, int,
+	WordList *[], Accessor &styler) {
+	FoldBasicDoc(startPos, length, styler, CheckBlitzFoldPoint);
+}
+
+static void FoldPureBasicDoc(unsigned int startPos, int length, int,
+	WordList *[], Accessor &styler) {
+	FoldBasicDoc(startPos, length, styler, CheckPureFoldPoint);
+}
+
+static void FoldFreeBasicDoc(unsigned int startPos, int length, int,
+	WordList *[], Accessor &styler) {
+	FoldBasicDoc(startPos, length, styler, CheckFreeFoldPoint);
+}
+
+static const char * const blitzbasicWordListDesc[] = {
+	"BlitzBasic Keywords",
+	"user1",
+	"user2",
+	"user3",
+	0
+};
+
+static const char * const purebasicWordListDesc[] = {
+	"PureBasic Keywords",
+	"PureBasic PreProcessor Keywords",
+	"user defined 1",
+	"user defined 2",
+	0
+};
+
+static const char * const freebasicWordListDesc[] = {
+	"FreeBasic Keywords",
+	"FreeBasic PreProcessor Keywords",
+	"user defined 1",
+	"user defined 2",
+	0
+};
+
+LexerModule lmBlitzBasic(SCLEX_BLITZBASIC, ColouriseBlitzBasicDoc, "blitzbasic",
+	FoldBlitzBasicDoc, blitzbasicWordListDesc);
+
+LexerModule lmPureBasic(SCLEX_PUREBASIC, ColourisePureBasicDoc, "purebasic",
+	FoldPureBasicDoc, purebasicWordListDesc);
+
+LexerModule lmFreeBasic(SCLEX_FREEBASIC, ColouriseFreeBasicDoc, "freebasic",
+	FoldFreeBasicDoc, freebasicWordListDesc);
+

Modified: trunk/scintilla/Makefile.am
===================================================================
--- trunk/scintilla/Makefile.am	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/scintilla/Makefile.am	2007-06-22 17:34:31 UTC (rev 1635)
@@ -9,6 +9,7 @@
 
 LEXER_SRCS= \
 LexAsm.cxx \
+LexBasic.cxx \
 LexBash.cxx \
 LexOMS.cxx \
 LexCPP.cxx \

Modified: trunk/scintilla/makefile.win32
===================================================================
--- trunk/scintilla/makefile.win32	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/scintilla/makefile.win32	2007-06-22 17:34:31 UTC (rev 1635)
@@ -62,7 +62,7 @@
 LEXOBJS=\
 LexBash.o LexAsm.o LexCSS.o LexConf.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 \
-LexD.o LexLua.o LexHaskell.o
+LexD.o LexLua.o LexHaskell.o LexBasic.o
 #--Autogenerated -- end of automatically generated section
 
 all: $(COMPLIB)

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/src/editor.c	2007-06-22 17:34:31 UTC (rev 1635)
@@ -2130,6 +2130,13 @@
 				result = TRUE;
 			break;
 		}
+		case SCLEX_FREEBASIC:
+		{
+			if (style == SCE_B_COMMENT ||
+				style == SCE_B_STRING)
+				result = TRUE;
+			break;
+		}
 		case SCLEX_HTML:
 		{
 			if (style == SCE_HPHP_SIMPLESTRING ||

Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/src/filetypes.c	2007-06-22 17:34:31 UTC (rev 1635)
@@ -71,7 +71,9 @@
 	FILETYPE_UID_VHDL,		// 26
 	FILETYPE_UID_JS,		// 27
 	FILETYPE_UID_LUA,		// 28
-	FILETYPE_UID_HASKELL	// 29
+	FILETYPE_UID_HASKELL,	// 29
+	FILETYPE_UID_CS,		// 30
+	FILETYPE_UID_BASIC		// 31
 };
 
 
@@ -115,6 +117,8 @@
 		case FILETYPE_UID_JS:		return filetypes[GEANY_FILETYPES_JS];
 		case FILETYPE_UID_LUA:		return filetypes[GEANY_FILETYPES_LUA];
 		case FILETYPE_UID_HASKELL:	return filetypes[GEANY_FILETYPES_HASKELL];
+		case FILETYPE_UID_CS:		return filetypes[GEANY_FILETYPES_CS];
+		case FILETYPE_UID_BASIC:	return filetypes[GEANY_FILETYPES_BASIC];
 		default: 					return NULL;
 	}
 }
@@ -157,6 +161,18 @@
 	filetypes[GEANY_FILETYPES_CPP]->comment_open = g_strdup("//");
 	filetypes[GEANY_FILETYPES_CPP]->comment_close = NULL;
 
+#define CS
+	filetypes[GEANY_FILETYPES_CS]->id = GEANY_FILETYPES_CS;
+	filetypes[GEANY_FILETYPES_CS]->uid = FILETYPE_UID_CS;
+	filetypes[GEANY_FILETYPES_CS]->lang = 25;
+	filetypes[GEANY_FILETYPES_CS]->name = g_strdup("C#");
+	filetypes[GEANY_FILETYPES_CS]->title = g_strdup(_("C# source file"));
+	filetypes[GEANY_FILETYPES_CS]->extension = g_strdup("cs");
+	filetypes[GEANY_FILETYPES_CS]->pattern = utils_strv_new("*.cs", NULL);
+	filetypes[GEANY_FILETYPES_CS]->style_func_ptr = styleset_cs;
+	filetypes[GEANY_FILETYPES_CS]->comment_open = g_strdup("//");
+	filetypes[GEANY_FILETYPES_CS]->comment_close = NULL;
+
 #define D
 	filetypes[GEANY_FILETYPES_D]->id = GEANY_FILETYPES_D;
 	filetypes[GEANY_FILETYPES_D]->uid = FILETYPE_UID_D;
@@ -206,6 +222,18 @@
 	filetypes[GEANY_FILETYPES_ASM]->comment_open = g_strdup(";");
 	filetypes[GEANY_FILETYPES_ASM]->comment_close = NULL;
 
+#define BASIC
+	filetypes[GEANY_FILETYPES_BASIC]->id = GEANY_FILETYPES_BASIC;
+	filetypes[GEANY_FILETYPES_BASIC]->uid = FILETYPE_UID_BASIC;
+	filetypes[GEANY_FILETYPES_BASIC]->lang = 26;
+	filetypes[GEANY_FILETYPES_BASIC]->name = g_strdup("FreeBasic");
+	filetypes[GEANY_FILETYPES_BASIC]->title = g_strdup(_("FreeBasic source file"));
+	filetypes[GEANY_FILETYPES_BASIC]->extension = g_strdup("bas");
+	filetypes[GEANY_FILETYPES_BASIC]->pattern = utils_strv_new("*.bas", "*.bi", NULL);
+	filetypes[GEANY_FILETYPES_BASIC]->style_func_ptr = styleset_basic;
+	filetypes[GEANY_FILETYPES_BASIC]->comment_open = g_strdup("'");
+	filetypes[GEANY_FILETYPES_BASIC]->comment_close = NULL;
+
 #define FORTRAN
 	filetypes[GEANY_FILETYPES_FORTRAN]->id = GEANY_FILETYPES_FORTRAN;
 	filetypes[GEANY_FILETYPES_FORTRAN]->uid = FILETYPE_UID_FORTRAN;
@@ -800,17 +828,17 @@
 
 gchar *filetypes_get_conf_extension(gint filetype_idx)
 {
-	gchar *result, *tmp = g_strdup(filetypes[filetype_idx]->name);
+	gchar *result;
 
 	// Handle any special extensions different from lowercase filetype->name
 	switch (filetype_idx)
 	{
 		case GEANY_FILETYPES_CPP: result = g_strdup("cpp"); break;
+		case GEANY_FILETYPES_CS: result = g_strdup("cs"); break;
 		case GEANY_FILETYPES_MAKE: result = g_strdup("makefile"); break;
 		case GEANY_FILETYPES_OMS: result = g_strdup("oms"); break;
-		default: result = g_ascii_strdown(tmp, -1); break;
+		default: result = g_ascii_strdown(filetypes[filetype_idx]->name, -1); break;
 	}
-	g_free(tmp);
 	return result;
 }
 

Modified: trunk/src/filetypes.h
===================================================================
--- trunk/src/filetypes.h	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/src/filetypes.h	2007-06-22 17:34:31 UTC (rev 1635)
@@ -38,9 +38,11 @@
 	// normally compiled languages
 	GEANY_FILETYPES_C = 0,
 	GEANY_FILETYPES_CPP,
+	GEANY_FILETYPES_CS,
 	GEANY_FILETYPES_D,
 	GEANY_FILETYPES_JAVA,
 	GEANY_FILETYPES_PASCAL,
+	GEANY_FILETYPES_BASIC,
 	GEANY_FILETYPES_ASM,
 	GEANY_FILETYPES_FORTRAN,
 	GEANY_FILETYPES_CAML,

Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/src/highlighting.c	2007-06-22 17:34:31 UTC (rev 1635)
@@ -781,6 +781,68 @@
 }
 
 
+static void styleset_cs_init(void)
+{
+	GKeyFile *config = g_key_file_new();
+	GKeyFile *config_home = g_key_file_new();
+
+	load_keyfiles(config, config_home, GEANY_FILETYPES_CS);
+
+	new_style_array(GEANY_FILETYPES_CS, 21);
+	styleset_c_like_init(config, config_home, GEANY_FILETYPES_CS);
+	get_keyfile_int(config, config_home, "styling", "styling_within_preprocessor",
+		1, 0, &style_sets[GEANY_FILETYPES_CS].styling[20]);
+
+	style_sets[GEANY_FILETYPES_CS].keywords = g_new(gchar*, 4);
+	get_keyfile_keywords(config, config_home, "keywords", "primary", GEANY_FILETYPES_CS, 0, "\
+			abstract as base bool break byte case catch char checked class \
+			const continue decimal default delegate do double else enum \
+			event explicit extern false finally fixed float for foreach goto if \
+			implicit in int interface internal is lock long namespace new null \
+			object operator out override params private protected public \
+			readonly ref return sbyte sealed short sizeof stackalloc static \
+			string struct switch this throw true try typeof uint ulong \
+			unchecked unsafe ushort using virtual void volatile while");
+	get_keyfile_keywords(config, config_home, "keywords", "secondary", GEANY_FILETYPES_CS, 1, "");
+	get_keyfile_keywords(config, config_home, "keywords", "docComment", GEANY_FILETYPES_CS, 2, "");
+	style_sets[GEANY_FILETYPES_CS].keywords[3] = NULL;
+
+	get_keyfile_wordchars(config, config_home,
+		&style_sets[GEANY_FILETYPES_CS].wordchars);
+	filetypes_get_config(config, config_home, GEANY_FILETYPES_CS);
+
+	g_key_file_free(config);
+	g_key_file_free(config_home);
+}
+
+
+void styleset_cs(ScintillaObject *sci)
+{
+	const filetype_id ft_id = GEANY_FILETYPES_CS;
+
+	styleset_common(sci, 5, ft_id);
+	if (style_sets[ft_id].styling == NULL) styleset_cs_init();
+
+	SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) style_sets[ft_id].wordchars);
+	SSM(sci, SCI_AUTOCSETMAXHEIGHT, app->autocompletion_max_height, 0);
+
+	SSM(sci, SCI_SETLEXER, SCLEX_CPP, 0);
+
+	//SSM(sci, SCI_SETCONTROLCHARSYMBOL, 32, 0);
+
+	SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[ft_id].keywords[0]);
+	SSM(sci, SCI_SETKEYWORDS, 2, (sptr_t) style_sets[ft_id].keywords[2]);
+
+	// assign global types, merge them with user defined keywords and set them
+	assign_global_and_user_keywords(sci, style_sets[ft_id].keywords[1]);
+
+	styleset_c_like(sci, ft_id);
+
+	if (style_sets[ft_id].styling[20].foreground == 1)
+		SSM(sci, ft_id, (sptr_t) "styling.within.preprocessor", (sptr_t) "1");
+}
+
+
 static void styleset_pascal_init(void)
 {
 	GKeyFile *config = g_key_file_new();
@@ -3103,3 +3165,100 @@
 	set_sci_style(sci, SCE_LUA_WORD7, GEANY_FILETYPES_LUA, 18);
 	set_sci_style(sci, SCE_LUA_WORD8, GEANY_FILETYPES_LUA, 19);
 }
+
+
+static void styleset_basic_init(void)
+{
+	GKeyFile *config = g_key_file_new();
+	GKeyFile *config_home = g_key_file_new();
+
+	load_keyfiles(config, config_home, GEANY_FILETYPES_BASIC);
+
+	new_style_array(GEANY_FILETYPES_BASIC, 19);
+
+	get_keyfile_hex(config, config_home, "styling", "default", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[0]);
+	get_keyfile_hex(config, config_home, "styling", "comment", "0x808080", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[1]);
+	get_keyfile_hex(config, config_home, "styling", "number", "0x007f00", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[2]);
+	get_keyfile_hex(config, config_home, "styling", "word", "0x00007f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_BASIC].styling[3]);
+	get_keyfile_hex(config, config_home, "styling", "string", "0xff901e", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[4]);
+	get_keyfile_hex(config, config_home, "styling", "preprocessor", "0x007f7f", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[5]);
+	get_keyfile_hex(config, config_home, "styling", "operator", "0x301010", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[6]);
+	get_keyfile_hex(config, config_home, "styling", "identifier", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[7]);
+	get_keyfile_hex(config, config_home, "styling", "date", "0x1a6500", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[8]);
+	get_keyfile_hex(config, config_home, "styling", "stringeol", "0x000000", "0xe0c0e0", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[9]);
+	get_keyfile_hex(config, config_home, "styling", "word2", "0x007f7f", "0xffffff", "true", &style_sets[GEANY_FILETYPES_BASIC].styling[10]);
+	get_keyfile_hex(config, config_home, "styling", "word3", "0x991111", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[11]);
+	get_keyfile_hex(config, config_home, "styling", "word4", "0x0000d0", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[12]);
+	get_keyfile_hex(config, config_home, "styling", "constant", "0x007f7f", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[13]);
+	get_keyfile_hex(config, config_home, "styling", "asm", "0x105090", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[14]);
+	get_keyfile_hex(config, config_home, "styling", "label", "0x007f7f", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[15]);
+	get_keyfile_hex(config, config_home, "styling", "error", "0xd00000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[16]);
+	get_keyfile_hex(config, config_home, "styling", "hexnumber", "0x007f00", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[17]);
+	get_keyfile_hex(config, config_home, "styling", "binnumber", "0x007f00", "0xffffff", "false", &style_sets[GEANY_FILETYPES_BASIC].styling[18]);
+
+	style_sets[GEANY_FILETYPES_BASIC].keywords = g_new(gchar*, 5);
+	get_keyfile_keywords(config, config_home, "keywords", "keywords", GEANY_FILETYPES_BASIC, 0,
+			"as asm bit bitreset bitset byte case cint close cls color const \
+			 continue cshort csign csng cubyte cuint culngint custom data \
+			 dim do double  else elseif end enum environ eof err error exec exit exp \
+			 export extern field fix for function get gosub goto hex hibyte hiword if iif imp \
+			 input instr int integer is kill left len let lobyte loc local locate lof log long \
+			 longint loop loword lset mklongint mks mkshort mod next not on once open or out \
+			 pointer pos preserve preset private public put read redim rem reset restore return \
+			 sizeof sleep space static step stop str string sub then time timer to type ubound \
+			 ubyte ucase uinteger ulongint union unsigned until ushort using val val64 valint \
+			 wait while with xor");
+	get_keyfile_keywords(config, config_home, "keywords", "preprocessor", GEANY_FILETYPES_BASIC, 1,
+			"#define defined #dynamic #else #endif #endmacro #error #if #ifdef #ifndef #inclib #include \
+			 #libpath #line #macro #print #undef");
+	get_keyfile_keywords(config, config_home, "keywords", "user1", GEANY_FILETYPES_BASIC, 2, "");
+	get_keyfile_keywords(config, config_home, "keywords", "user2", GEANY_FILETYPES_BASIC, 3, "");
+	style_sets[GEANY_FILETYPES_BASIC].keywords[4] = NULL;
+
+	get_keyfile_wordchars(config, config_home,
+		&style_sets[GEANY_FILETYPES_BASIC].wordchars);
+	filetypes_get_config(config, config_home, GEANY_FILETYPES_BASIC);
+
+	g_key_file_free(config);
+	g_key_file_free(config_home);
+}
+
+
+void styleset_basic(ScintillaObject *sci)
+{
+	const filetype_id ft_id = GEANY_FILETYPES_BASIC;
+
+	styleset_common(sci, 5, ft_id);
+	if (style_sets[GEANY_FILETYPES_BASIC].styling == NULL) styleset_basic_init();
+
+	SSM(sci, SCI_SETWORDCHARS, 0, (sptr_t) style_sets[GEANY_FILETYPES_BASIC].wordchars);
+	SSM(sci, SCI_AUTOCSETMAXHEIGHT, app->autocompletion_max_height, 0);
+
+	SSM(sci, SCI_SETLEXER, SCLEX_FREEBASIC, 0);
+
+	SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_BASIC].keywords[0]);
+	SSM(sci, SCI_SETKEYWORDS, 1, (sptr_t) style_sets[GEANY_FILETYPES_BASIC].keywords[1]);
+	SSM(sci, SCI_SETKEYWORDS, 2, (sptr_t) style_sets[GEANY_FILETYPES_BASIC].keywords[2]);
+	SSM(sci, SCI_SETKEYWORDS, 3, (sptr_t) style_sets[GEANY_FILETYPES_BASIC].keywords[3]);
+
+	set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_BASIC, 0);
+	set_sci_style(sci, SCE_B_DEFAULT, GEANY_FILETYPES_BASIC, 0);
+	set_sci_style(sci, SCE_B_COMMENT, GEANY_FILETYPES_BASIC, 1);
+	set_sci_style(sci, SCE_B_NUMBER, GEANY_FILETYPES_BASIC, 2);
+	set_sci_style(sci, SCE_B_KEYWORD, GEANY_FILETYPES_BASIC, 3);
+	set_sci_style(sci, SCE_B_STRING, GEANY_FILETYPES_BASIC, 4);
+	set_sci_style(sci, SCE_B_PREPROCESSOR, GEANY_FILETYPES_BASIC, 5);
+	set_sci_style(sci, SCE_B_OPERATOR, GEANY_FILETYPES_BASIC, 6);
+	set_sci_style(sci, SCE_B_IDENTIFIER, GEANY_FILETYPES_BASIC, 7);
+	set_sci_style(sci, SCE_B_DATE, GEANY_FILETYPES_BASIC, 8);
+	set_sci_style(sci, SCE_B_STRINGEOL, GEANY_FILETYPES_BASIC, 9);
+	set_sci_style(sci, SCE_B_KEYWORD2, GEANY_FILETYPES_BASIC, 10);
+	set_sci_style(sci, SCE_B_KEYWORD3, GEANY_FILETYPES_BASIC, 11);
+	set_sci_style(sci, SCE_B_KEYWORD4, GEANY_FILETYPES_BASIC, 12);
+	set_sci_style(sci, SCE_B_CONSTANT, GEANY_FILETYPES_BASIC, 13);
+	set_sci_style(sci, SCE_B_ASM, GEANY_FILETYPES_BASIC, 14); // (still?) unused by the lexer
+	set_sci_style(sci, SCE_B_LABEL, GEANY_FILETYPES_BASIC, 15);
+	set_sci_style(sci, SCE_B_ERROR, GEANY_FILETYPES_BASIC, 16);
+	set_sci_style(sci, SCE_B_HEXNUMBER, GEANY_FILETYPES_BASIC, 17);
+	set_sci_style(sci, SCE_B_BINNUMBER, GEANY_FILETYPES_BASIC, 18);
+}

Modified: trunk/src/highlighting.h
===================================================================
--- trunk/src/highlighting.h	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/src/highlighting.h	2007-06-22 17:34:31 UTC (rev 1635)
@@ -95,4 +95,8 @@
 
 void styleset_lua(ScintillaObject *sci);
 
+void styleset_cs(ScintillaObject *sci);
+
+void styleset_basic(ScintillaObject *sci);
+
 #endif

Modified: trunk/src/msgwindow.c
===================================================================
--- trunk/src/msgwindow.c	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/src/msgwindow.c	2007-06-22 17:34:31 UTC (rev 1635)
@@ -651,8 +651,10 @@
 			data.file_idx = 2;
 			break;
 		}
+		case GEANY_FILETYPES_BASIC:
 		case GEANY_FILETYPES_PASCAL:
 		{
+			// getdrive.bas(52) error 18: Syntax error in '? GetAllDrives'
 			// bandit.pas(149,3) Fatal: Syntax error, ";" expected but "ELSE" found
 			data.pattern = "(";
 			data.min_fields = 2;

Modified: trunk/src/templates.c
===================================================================
--- trunk/src/templates.c	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/src/templates.c	2007-06-22 17:34:31 UTC (rev 1635)
@@ -553,6 +553,12 @@
 			break;
 		}
 
+		case GEANY_FILETYPES_BASIC:
+		{
+			line_prefix = "'";
+			break;
+		}
+
 		case GEANY_FILETYPES_PASCAL:
 		{
 			frame_start = "{\n";

Modified: trunk/tagmanager/Makefile.am
===================================================================
--- trunk/tagmanager/Makefile.am	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/tagmanager/Makefile.am	2007-06-22 17:34:31 UTC (rev 1635)
@@ -26,6 +26,7 @@
 	strlist.h\
 	args.c\
 	args.h\
+	basic.c\
 	c.c\
 	conf.c\
 	css.c\

Added: trunk/tagmanager/basic.c
===================================================================
--- trunk/tagmanager/basic.c	                        (rev 0)
+++ trunk/tagmanager/basic.c	2007-06-22 17:34:31 UTC (rev 1635)
@@ -0,0 +1,225 @@
+/*
+ *   $Id:$
+ *
+ *   Copyright (c) 2000-2006, Darren Hiebert, Elias Pschernig
+ *
+ *   This source code is released for free distribution under the terms of the
+ *   GNU General Public License.
+ *
+ *   This module contains functions for generating tags for BlitzBasic
+ *   (BlitzMax), PureBasic and FreeBasic language files. For now, this is kept
+ *   quite simple - but feel free to ask for more things added any time -
+ *   patches are of course most welcome.
+ */
+
+/*
+ *   INCLUDE FILES
+ */
+#include "general.h" /* must always come first */
+
+#include <string.h>
+
+#include "parse.h"
+#include "read.h"
+#include "vstring.h"
+
+/*
+ *   DATA DEFINITIONS
+ */
+typedef enum {
+	K_CONST,
+	K_FUNCTION,
+	K_LABEL,
+	K_TYPE,
+    K_VARIABLE,
+    K_ENUM
+} BasicKind;
+
+typedef struct {
+	char const *token;
+	BasicKind kind;
+} KeyWord;
+
+static kindOption BasicKinds[] = {
+	{TRUE, 'c', "constant", "constants"},
+	{TRUE, 'f', "function", "functions"},
+	{TRUE, 'l', "label", "labels"},
+	{TRUE, 't', "type", "types"},
+	{TRUE, 'v', "variable", "variables"},
+	{TRUE, 'g', "enum", "enumerations"}
+};
+
+static KeyWord blitzbasic_keywords[] = {
+	{"const", K_CONST},
+	{"global", K_VARIABLE},
+	{"dim", K_VARIABLE},
+	{"function", K_FUNCTION},
+	{"type", K_TYPE},
+	{NULL, 0}
+};
+
+static KeyWord purebasic_keywords[] = {
+	{"newlist", K_VARIABLE},
+	{"global", K_VARIABLE},
+	{"dim", K_VARIABLE},
+	{"procedure", K_FUNCTION},
+	{"interface", K_TYPE},
+	{"structure", K_TYPE},
+	{NULL, 0}
+};
+
+static KeyWord freebasic_keywords[] = {
+	{"const", K_CONST},
+	{"dim", K_VARIABLE},
+	{"common", K_VARIABLE},
+	{"function", K_FUNCTION},
+	{"sub", K_FUNCTION},
+	{"private sub", K_FUNCTION},
+	{"public sub", K_FUNCTION},
+	{"private function", K_FUNCTION},
+	{"public function", K_FUNCTION},
+	{"type", K_TYPE},
+	{"enum", K_ENUM},
+	{NULL, 0}
+};
+
+/*
+ *   FUNCTION DEFINITIONS
+ */
+
+/* Match the name of a tag (function, variable, type, ...) starting at pos. */
+static void extract_name (char const *pos, vString * name)
+{
+	while (isspace (*pos))
+		pos++;
+	vStringClear (name);
+	for (; *pos && !isspace (*pos) && *pos != '(' && *pos != ','; pos++)
+		vStringPut (name, *pos);
+	vStringTerminate (name);
+}
+
+/* Match a keyword starting at p (case insensitive). */
+static void match_keyword (const char *p, const char *keyword, BasicKind kind)
+{
+	vString *name;
+	size_t i;
+	for (i = 0; i < strlen (keyword); i++)
+	{
+		if (tolower (p[i]) != keyword[i])
+			return;
+	}
+	name = vStringNew ();
+	extract_name (p + i, name);
+	// if we have "DIM AS STRING str" we should skip "AS STRING" - eht16
+	if (strcmp(keyword, "dim") == 0 && strncasecmp (name->buffer, "as", 2) == 0)
+	{
+		char *new_start = strchr (p + i + 4, ' '); // + 4 skips " AS "
+		if (new_start != NULL)
+			extract_name (new_start + 1, name);
+	}
+	makeSimpleTag (name, BasicKinds, kind);
+	vStringDelete (name);
+}
+
+/* Match a "label:" style label. */
+static void match_colon_label (char const *p)
+{
+	char const *end = p + strlen (p) - 1;
+	while (isspace (*end))
+		end--;
+	if (*end == ':')
+	{
+		vString *name = vStringNew ();
+		vStringNCatS (name, p, end - p);
+		makeSimpleTag (name, BasicKinds, K_LABEL);
+		vStringDelete (name);
+	}
+}
+
+/* Match a ".label" style label. */
+static void match_dot_label (char const *p)
+{
+	if (*p == '.')
+	{
+		vString *name = vStringNew ();
+		extract_name (p + 1, name);
+		makeSimpleTag (name, BasicKinds, K_LABEL);
+		vStringDelete (name);
+	}
+}
+
+static void findBasicTags (KeyWord const keywords[],
+	void (*label) (const char *))
+{
+	const char *line;
+
+	while ((line = (const char *) fileReadLine ()) != NULL)
+	{
+		const char *p = line;
+		KeyWord const *kw;
+
+		while (isspace (*p))
+			p++;
+
+		/* Empty line? */
+		if (!*p)
+			continue;
+
+		/* In Basic, keywords always are at the start of the line. */
+		for (kw = keywords; kw->token; kw++)
+			match_keyword (p, kw->token, kw->kind);
+
+		/* Is it a label? */
+		label (p);
+	}
+}
+
+static void findBlitzBasicTags (void)
+{
+	findBasicTags (blitzbasic_keywords, match_dot_label);
+}
+
+static void findPureBasicTags (void)
+{
+	findBasicTags (purebasic_keywords, match_colon_label);
+}
+
+static void findFreeBasicTags (void)
+{
+	findBasicTags (freebasic_keywords, match_colon_label);
+}
+
+parserDefinition *BlitzBasicParser (void)
+{
+	static char const *extensions[] = { "bb", NULL };
+	parserDefinition *def = parserNew ("BlitzBasic");
+	def->kinds = BasicKinds;
+	def->kindCount = KIND_COUNT (BasicKinds);
+	def->extensions = extensions;
+	def->parser = findBlitzBasicTags;
+	return def;
+}
+
+parserDefinition *PureBasicParser (void)
+{
+	static char const *extensions[] = { "pb", NULL };
+	parserDefinition *def = parserNew ("PureBasic");
+	def->kinds = BasicKinds;
+	def->kindCount = KIND_COUNT (BasicKinds);
+	def->extensions = extensions;
+	def->parser = findPureBasicTags;
+	return def;
+}
+
+parserDefinition *FreeBasicParser (void)
+{
+	static char const *extensions[] = { "bas", "bi", NULL };
+	parserDefinition *def = parserNew ("FreeBasic");
+	def->kinds = BasicKinds;
+	def->kindCount = KIND_COUNT (BasicKinds);
+	def->extensions = extensions;
+	def->parser = findFreeBasicTags;
+	return def;
+}
+
+/* vi:set tabstop=4 shiftwidth=4: */

Modified: trunk/tagmanager/makefile.win32
===================================================================
--- trunk/tagmanager/makefile.win32	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/tagmanager/makefile.win32	2007-06-22 17:34:31 UTC (rev 1635)
@@ -33,7 +33,7 @@
 	-$(RM) deps.mak *.o $(COMPLIB)
 
 $(COMPLIB): args.o c.o fortran.o make.o conf.o pascal.o perl.o php.o diff.o vhdl.o lua.o js.o \
-haskell.o python.o regex.o sh.o ctags.o entry.o get.o keyword.o options.o parse.o \
+haskell.o python.o regex.o sh.o ctags.o entry.o get.o keyword.o options.o parse.o basic.c \
 read.o sort.o strlist.o latex.o docbook.o tcl.o ruby.o asm.o sql.o css.o vstring.o tm_workspace.o tm_work_object.o \
 tm_source_file.o tm_project.o tm_tag.o tm_symbol.o tm_file_entry.o \
 tm_tagmanager.o

Modified: trunk/tagmanager/parsers.h
===================================================================
--- trunk/tagmanager/parsers.h	2007-06-22 17:22:07 UTC (rev 1634)
+++ trunk/tagmanager/parsers.h	2007-06-22 17:34:31 UTC (rev 1635)
@@ -39,7 +39,9 @@
     VhdlParser, \
     LuaParser, \
     JavaScriptParser, \
-    HaskellParser
+    HaskellParser, \
+    CsharpParser, \
+    FreeBasicParser
 
 /*
 langType of each parser
@@ -68,6 +70,8 @@
 22	LuaParser
 23	JavaScriptParser
 24	HaskellParser
+25	CsharpParser
+26	FreeBasicParser
 */
 #endif	/* _PARSERS_H */
 


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