SF.net SVN: geany:[5286] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Wed Oct 6 17:10:15 UTC 2010
Revision: 5286
http://geany.svn.sourceforge.net/geany/?rev=5286&view=rev
Author: ntrel
Date: 2010-10-06 17:10:15 +0000 (Wed, 06 Oct 2010)
Log Message:
-----------
Add Lisp filetype (patch by M?\195?\161rio Silva, thanks).
Note: Lisp lexer was taken from Scintilla instead.
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/filetypes.c
trunk/src/filetypes.h
trunk/src/highlighting.c
trunk/wscript
Added Paths:
-----------
trunk/data/filetypes.lisp
trunk/scintilla/LexLisp.cxx
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-10-06 16:06:13 UTC (rev 5285)
+++ trunk/ChangeLog 2010-10-06 17:10:15 UTC (rev 5286)
@@ -5,6 +5,12 @@
* src/dialogs.c, src/about.c, THANKS:
Group Open dialog encoding options by submenus (patch by Adam Ples,
thanks; #3047717).
+ * scintilla/LexLisp.cxx, scintilla/makefile.win32,
+ scintilla/KeyWords.cxx, scintilla/Makefile.am, src/highlighting.c,
+ src/about.c, src/filetypes.c, src/filetypes.h, THANKS,
+ data/filetype_extensions.conf, data/filetypes.lisp, wscript:
+ Add Lisp filetype (patch by Mário Silva, thanks).
+ Note: Lisp lexer was taken from Scintilla instead.
2010-10-06 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
Modified: trunk/THANKS
===================================================================
--- trunk/THANKS 2010-10-06 16:06:13 UTC (rev 5285)
+++ trunk/THANKS 2010-10-06 17:10:15 UTC (rev 5286)
@@ -84,6 +84,7 @@
Erik de Castro Lopo <mle+tools(at)mega-nerd(dot)com> - Various patches
Thomas Huth <th(dot)huth(at)googlemail(dot)com> - Forth filetype
Adam Ples <adamples(at)users(dot)sourceforge(dot)net> - Group encodings in open dialog
+Mário Silva <sharelider(at)gmail(dot)com> - Lisp filetype
Translators:
------------
Modified: trunk/data/filetype_extensions.conf
===================================================================
--- trunk/data/filetype_extensions.conf 2010-10-06 16:06:13 UTC (rev 5285)
+++ trunk/data/filetype_extensions.conf 2010-10-06 17:10:15 UTC (rev 5286)
@@ -43,6 +43,7 @@
CMake=CMakeLists.txt;*.cmake;*.ctest;
Conf=*.conf;*.ini;config;*rc;*.cfg;*.desktop;
Diff=*.diff;*.patch;*.rej;
+Lisp=*.lisp;
NSIS=*.nsi;*.nsh;
Po=*.po;*.pot;
LaTeX=*.tex;*.sty;*.idx;*.ltx;
Added: trunk/data/filetypes.lisp
===================================================================
--- trunk/data/filetypes.lisp (rev 0)
+++ trunk/data/filetypes.lisp 2010-10-06 17:10:15 UTC (rev 5286)
@@ -0,0 +1,55 @@
+# For complete documentation of this file, please see Geany's main documentation
+[styling]
+# foreground;background;bold;italic
+default=default
+comment=comment
+multicomment=comment
+number=number
+keyword=0x0071FD;;true;false
+special_keyword=0x0071FD;;true;false
+symbol=word2
+string=string
+stringeol=stringeol
+identifier=default
+operator=default
+special=word
+character=default
+macro=word2
+macrodispatch=word2
+
+[keywords]
+# all items must be in one line
+keywords=abort abs acons acos acosh add-method adjoin adjust-array adjustable-array-p alpha-char-p alphanumericp alter append apply applyhook apropos apropos-list aref arithmetic-error-operands arithmetic-error-operation array-dimension array-dimensions array-element-type array-has-fill-pointer-p array-in-bounds-p array-rank array-row-major-index array-total-size arrayp ash asin asinh assoc assoc-if assoc-if-not atan atanh atom augment-environment bit bit-and bit-andc1 bit-andc2 bit-eqv bit-ior bit-nand bit-nor bit-not bit-orc1 bit-orc2 bit-vector-p bit-xor boole both-case-p boundp break broadcast-stream-streams butlast byte byte-position byte-size caaaar caaadr caaar caadar caaddr caadr caar cadaar cadadr cadar caddar cadddr caddr cadr call-next-method car catenate cdaaar cdaadr cdaar cdadar cdaddr cdadr cdar cddaar cddadr cddar cdddar cddddr cdddr cddr cdr ceiling cell-error-name cerror change-class char char-bit char-bits char-code char-downcase char-equal char-font char-greaterp char-int char-lessp char-name char-not-equal char-not-greaterp char-not-lessp char-upcase char/= char< char<= char= char> char>= character characterp choose choose-if chunk cis class-name class-of clear-input close clrhash code-char coerce collect collect-alist collect-and collect-append collect-file collect-first collect-fn collect-hash collect-last collect-length collect-max collect-min collect-nconc collect-nth collect-or collect-plist collect-sum collecting-fn commonp compile compile-file compile-file-pathname compiled-function-p compiler-let compiler-macro-function compiler-macroexpand compiler-macroexpand-1 complement complex complexp compute-applicable-methods compute-restarts concatenate concatenated-stream-streams condition conjugate cons consp continue control-error copy-alist copy-list copy-pprint-dispatch copy-readtable copy-seq copy-symbol copy-tree cos cosh cotruncate count count-if count-if-not declaration-information declare decode-float decode-universal-time delete-duplicates delete-file delete-if delete-if-not delete-package denominator deposit-field describe describe-object digit-char digit-char-p directory directory-namestring disassemble dpb dribble echo-stream-input-stream echo-stream-output-stream ed eighth elt enclose encode-universal-time end-of-file type endp enough-namestring ensure--function eq eql equal equalp error documentation eval eval-when evalhook evenp every exp expand export expt f fboundp fdefinition ffloor fifth file-author file-error type file-error-pathname file-length file-namestring file-position file-string-length file-write-date fill fill-pointer find find-all-symbols find-class find-if find-if-not find-method find-package find-restart find-symbol finish-output first flet float float-digits float-precision float-radix float-sign floatp floor fourth funcall function function-information function-keywords function-lambda-expression functionp format gatherer generic-labels gcd generator generic-flet gensym gentemp get get-decoded-time get-internal-real-time get-internal-run-time get-output-stream-string get-properties get-setf-method get-setf-method-multiple-value get-universal-time getf gethash graphic-char-p hash-table-count hash-table-p hash-table-rehash-size hash-table-rehash-threshold hash-table-size hash-table-test host-namestring identity imagpart import in-package initialize-instance input-stream-p inspect int-char integer-decode-float integer-length integerp interactive-stream-p intern intersection invalid-method-error invoke-debugger invoke-restart isqrt keywordp last latch lcm ldb ldb-test ldiff length lisp-implementation-type lisp-implementation-version list list* list-all-packages list-length listen listp load load-logical-pathname-translations log logand logandc1 logandc2 logbitp logcount logeqv logical-pathname class logical-pathname logical-pathname-translations logior lognand lognor lognot logorc1 logorc2 logtest logxor lower-case-p machine-instance machine-type machine-version macro-function macroexpand macroexpand-1 make-array make-broadcast-stream make-char make-concatenated-stream make-condition make-dispatch-macro-character make-echo-stream make-hash-table make-instance make-instances-obsolete make-list make-load-form make-load-form-saving-slots make-package make-pathname make-random-state make-sequence make-string make-string-input-stream make-string-output-stream make-symbol make-synonym-stream make-two-way-stream makunbound map map-fn map-into mapc mapcan mapcar mapcon maphash mapl maplist mask mask-field max member member-if member-if-not merge merge-pathnames method-combination-error method-qualifiers min mingle minusp mismatch mod muffle-warning name-char namestring nbutlast nconc next-method-p next-out nintersection ninth no-applicable-method no-next-method not notany notevery nreconc nreverse nset-difference nset-exclusive-or nstring-capitalize nstring-downcase nstring-upcase nsublis nsubst nsubst-if nsubst-if-not nsubstitute nsubstitute-if nsubstitute-if-not nth nthcdr null numberp numerator nunion random random-state-p rassoc rassoc-if rassoc-if-not rational rationalize rationalp read read-byte read-char read-char-no-hang read-delimited-list read-from-string read-line read-preserving-whitespace readtable-case readtablep realp realpart reduce reinitialize-instance rem output-stream-p package-error type package-error-package package-name package-nicknames package-shadowing-symbols package-use-list package-used-by-list packagep pairlis parse-integer oddp open open-stream-p parse-macro parse-namestring pathname pathname-device pathname-directory pathname-host pathname-match-p pathname-name pathname-type pathname-version pathnamep peek-char phase plusp position position-if position-if-not positions pprint-dispatch pprint-fill pprint-indent pprint-linear probe-file proclaim pprint-newline pprint-tab pprint-tabular previous print print-object remhash remove remove-duplicates remove-method remprop rename-file rename-package provide replace require rest revappend reverse room round row-major-aref rplaca rplacd restart-name result-of sbit scale-float scan scan-alist scan-file scan-fn scan-fn-inclusive scan-hash scan-lists-of-lists scan-lists-of-lists-fringe scan-multiple scan-plist scan-range scan-sublists scan-symbols schar search second series set set-char-bit set-difference set-dispatch-macro-character set-exclusive-or set-macro-character set-pprint-dispatch set-syntax-from-char shadow shadowing-import shared-initialize short-site-name signal signum simple-bit-vector-p simple-condition-format-arguments simple-condition-format-string simple-string-p simple-vector-p sin sinh sixth sleep slot-boundp slot-exists-p slot-makunbound slot-missing slot-unbound slot-value software-type software-version some sort special-form-p split split-if sqrt stable-sort standard-char-p store-value stream-element-type stream-error-stream stream-external-format streamp string string-capitalize string-char-p string-downcase string-equal string-greaterp string-left-trim string-lessp string-not-equal string-not-greaterp string-not-lessp string-right-trim string-trim string-upcase string/= string< string<= string= string> string>= stringp sublis subseq subseries subsetp subst subst-if subst-if-not substitute substitute-if substitute-if-not subtypep svref sxhash symbol-function symbol-name symbol-package symbol-plist symbol-value symbolp synonym-stream-symbol tailp tan tanh tenth terpri third to-alter translate-logical-pathname translate-pathname tree-equal truename truncate two-way-stream-input-stream two-way-stream-output-stream type-error-datum type-error-expected-type type-of typep unexport unintern union unread-char until-if unuse-package update-instance-for-different-class update-instance-for-redefined-class upgraded-array-element-type upgraded-complex-part-type upper-case-p use-package use-value user-homedir-pathname values values-list variable-information vector vector-pop vector-push vector-push-extend vectorp warn warn wild-pathname-p write write-byte write-char write-string write-to-string y-or-n-p yes-or-no-p zerop
+special_keywords=always and appending array-dimension-limit array-rank-limit array-total-size-limit as assert call-arguments-limit call-method case catch ccase char-bits-limit char-code-limit char-control-bit char-font-limit char-hyper-bit char-meta-bit char-super-bit check-type check-type collect collecting compiler-let cond count counting ctypecase ctypecase decf declaim defclass def define-compiler-macro define-condition define-declaration define-method-combination define-modify-macro define-setf-method defmacro defmethod defpackage defstruct deftype defun defvar delete destructuring-bind do do* do-all-symbols do-external-symbols do-symbols doing dolist dotimes double-float-epsilon double-float-negative-epsilon ecase encapsulated etypecase finally for formatter gathering generic-function go handler-bind handler-case if ignore-errors in-package incf initially internal-time-units-per-second iterate lambda-list-keywords lambda-parameters-limit least-negative-double-float least-negative-long-float least-negative-normalized-double-float least-negative-normalized-long-float least-negative-normalized-short-float least-negative-normalized-single-float least-negative-short-float least-negative-single-float least-positive-double-float least-positive-long-float least-positive-normalized-double-float least-positive-normalized-long-float least-positive-normalized-short-float least-positive-normalized-single-float least-positive-short-float least-positive-single-float let let* load-time-value locally locally long-float-epsilon long-float-negative-epsilon long-site-name loop loop-finish mapping maximize maximizing minimize minimizing most-negative-double-float most-negative-fixnum most-negative-long-float most-negative-short-float most-negative-single-float most-positive-double-float most-positive-fixnum most-positive-long-float most-positive-short-float most-positive-single-float multiple-value-bind multiple-value-call multiple-value-list multiple-value-prog1 multiple-value-setq multiple-values-limit named nconc nconcing never next-in nil nth-value off-line-port optimizable-series-function or pi pop pprint-exit-if-list-exhausted pprint-logical-block pprint-pop print-unreadable-object producing prog prog* prog1 prog2 progn progv propagate-alterability psetf psetq push pushnew quote remf repeat restart-bind restart-case return return-from rotatef setf setq seventh shiftf short-float-epsilon short-float-negative-epsilon single-float-epsilon single-float-negative-epsilon step sum summing symbol-macrolet t tagbody terminate-producing the thereis time throw trace typecase unless until untrace unwind-protect when when while with with-accessors with-added-methods with-compilation-unit with-condition-restarts with-hash-table-iterator with-input-from-string with-open-file with-open-stream with-output-to-string with-package-iterator with-simple-restart with-slots with-standard-io-syntax
+
+[settings]
+# default extension used when saving files
+#extension=lisp
+
+# 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=
+run_cmd=clisp "%f"
Property changes on: trunk/data/filetypes.lisp
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/scintilla/KeyWords.cxx
===================================================================
--- trunk/scintilla/KeyWords.cxx 2010-10-06 16:06:13 UTC (rev 5285)
+++ trunk/scintilla/KeyWords.cxx 2010-10-06 17:10:15 UTC (rev 5286)
@@ -344,6 +344,7 @@
LINK_LEXER(lmHaskell);
LINK_LEXER(lmHTML);
LINK_LEXER(lmLatex);
+ LINK_LEXER(lmLISP);
LINK_LEXER(lmLua);
LINK_LEXER(lmMake);
LINK_LEXER(lmMarkdown);
Added: trunk/scintilla/LexLisp.cxx
===================================================================
--- trunk/scintilla/LexLisp.cxx (rev 0)
+++ trunk/scintilla/LexLisp.cxx 2010-10-06 17:10:15 UTC (rev 5286)
@@ -0,0 +1,282 @@
+// Scintilla source code edit control
+/** @file LexLisp.cxx
+ ** Lexer for Lisp.
+ ** Written by Alexey Yutkin.
+ **/
+// Copyright 1998-2001 by Neil Hodgson <neilh at scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#include "Platform.h"
+
+#include "PropSet.h"
+#include "Accessor.h"
+#include "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+#include "StyleContext.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+#define SCE_LISP_CHARACTER 29
+#define SCE_LISP_MACRO 30
+#define SCE_LISP_MACRO_DISPATCH 31
+
+static inline bool isLispoperator(char ch) {
+ if (isascii(ch) && isalnum(ch))
+ return false;
+ if (ch == '\'' || ch == '`' || ch == '(' || ch == ')' || ch == '[' || ch == ']' || ch == '{' || ch == '}')
+ return true;
+ return false;
+}
+
+static inline bool isLispwordstart(char ch) {
+ return isascii(ch) && ch != ';' && !isspacechar(ch) && !isLispoperator(ch) &&
+ ch != '\n' && ch != '\r' && ch != '\"';
+}
+
+
+static void classifyWordLisp(unsigned int start, unsigned int end, WordList &keywords, WordList &keywords_kw, Accessor &styler) {
+ PLATFORM_ASSERT(end >= start);
+ char s[100];
+ unsigned int i;
+ bool digit_flag = true;
+ for (i = 0; (i < end - start + 1) && (i < 99); i++) {
+ s[i] = styler[start + i];
+ s[i + 1] = '\0';
+ if (!isdigit(s[i]) && (s[i] != '.')) digit_flag = false;
+ }
+ char chAttr = SCE_LISP_IDENTIFIER;
+
+ if(digit_flag) chAttr = SCE_LISP_NUMBER;
+ else {
+ if (keywords.InList(s)) {
+ chAttr = SCE_LISP_KEYWORD;
+ } else if (keywords_kw.InList(s)) {
+ chAttr = SCE_LISP_KEYWORD_KW;
+ } else if ((s[0] == '*' && s[i-1] == '*') ||
+ (s[0] == '+' && s[i-1] == '+')) {
+ chAttr = SCE_LISP_SPECIAL;
+ }
+ }
+ styler.ColourTo(end, chAttr);
+ return;
+}
+
+
+static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
+ Accessor &styler) {
+
+ WordList &keywords = *keywordlists[0];
+ WordList &keywords_kw = *keywordlists[1];
+
+ styler.StartAt(startPos);
+
+ int state = initStyle, radix = -1;
+ char chNext = styler[startPos];
+ unsigned int lengthDoc = startPos + length;
+ styler.StartSegment(startPos);
+ for (unsigned int i = startPos; i < lengthDoc; i++) {
+ char ch = chNext;
+ chNext = styler.SafeGetCharAt(i + 1);
+
+ bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+
+ if (styler.IsLeadByte(ch)) {
+ chNext = styler.SafeGetCharAt(i + 2);
+ i += 1;
+ continue;
+ }
+
+ if (state == SCE_LISP_DEFAULT) {
+ if (ch == '#') {
+ styler.ColourTo(i - 1, state);
+ radix = -1;
+ state = SCE_LISP_MACRO_DISPATCH;
+ } else if (ch == ':' && isLispwordstart(chNext)) {
+ styler.ColourTo(i - 1, state);
+ state = SCE_LISP_SYMBOL;
+ } else if (isLispwordstart(ch)) {
+ styler.ColourTo(i - 1, state);
+ state = SCE_LISP_IDENTIFIER;
+ }
+ else if (ch == ';') {
+ styler.ColourTo(i - 1, state);
+ state = SCE_LISP_COMMENT;
+ }
+ else if (isLispoperator(ch) || ch=='\'') {
+ styler.ColourTo(i - 1, state);
+ styler.ColourTo(i, SCE_LISP_OPERATOR);
+ if (ch=='\'' && isLispwordstart(chNext)) {
+ state = SCE_LISP_SYMBOL;
+ }
+ }
+ else if (ch == '\"') {
+ styler.ColourTo(i - 1, state);
+ state = SCE_LISP_STRING;
+ }
+ } else if (state == SCE_LISP_IDENTIFIER || state == SCE_LISP_SYMBOL) {
+ if (!isLispwordstart(ch)) {
+ if (state == SCE_LISP_IDENTIFIER) {
+ classifyWordLisp(styler.GetStartSegment(), i - 1, keywords, keywords_kw, styler);
+ } else {
+ styler.ColourTo(i - 1, state);
+ }
+ state = SCE_LISP_DEFAULT;
+ } /*else*/
+ if (isLispoperator(ch) || ch=='\'') {
+ styler.ColourTo(i - 1, state);
+ styler.ColourTo(i, SCE_LISP_OPERATOR);
+ if (ch=='\'' && isLispwordstart(chNext)) {
+ state = SCE_LISP_SYMBOL;
+ }
+ }
+ } else if (state == SCE_LISP_MACRO_DISPATCH) {
+ if (!(isascii(ch) && isdigit(ch))) {
+ if (ch != 'r' && ch != 'R' && (i - styler.GetStartSegment()) > 1) {
+ state = SCE_LISP_DEFAULT;
+ } else {
+ switch (ch) {
+ case '|': state = SCE_LISP_MULTI_COMMENT; break;
+ case 'o':
+ case 'O': radix = 8; state = SCE_LISP_MACRO; break;
+ case 'x':
+ case 'X': radix = 16; state = SCE_LISP_MACRO; break;
+ case 'b':
+ case 'B': radix = 2; state = SCE_LISP_MACRO; break;
+ case '\\': state = SCE_LISP_CHARACTER; break;
+ case ':':
+ case '-':
+ case '+': state = SCE_LISP_MACRO; break;
+ case '\'': if (isLispwordstart(chNext)) {
+ state = SCE_LISP_SPECIAL;
+ } else {
+ styler.ColourTo(i - 1, SCE_LISP_DEFAULT);
+ styler.ColourTo(i, SCE_LISP_OPERATOR);
+ state = SCE_LISP_DEFAULT;
+ }
+ break;
+ default: if (isLispoperator(ch)) {
+ styler.ColourTo(i - 1, SCE_LISP_DEFAULT);
+ styler.ColourTo(i, SCE_LISP_OPERATOR);
+ }
+ state = SCE_LISP_DEFAULT;
+ break;
+ }
+ }
+ }
+ } else if (state == SCE_LISP_MACRO) {
+ if (isLispwordstart(ch) && (radix == -1 || IsADigit(ch, radix))) {
+ state = SCE_LISP_SPECIAL;
+ } else {
+ state = SCE_LISP_DEFAULT;
+ }
+ } else if (state == SCE_LISP_CHARACTER) {
+ if (isLispoperator(ch)) {
+ styler.ColourTo(i, SCE_LISP_SPECIAL);
+ state = SCE_LISP_DEFAULT;
+ } else if (isLispwordstart(ch)) {
+ styler.ColourTo(i, SCE_LISP_SPECIAL);
+ state = SCE_LISP_SPECIAL;
+ } else {
+ state = SCE_LISP_DEFAULT;
+ }
+ } else if (state == SCE_LISP_SPECIAL) {
+ if (!isLispwordstart(ch) || (radix != -1 && !IsADigit(ch, radix))) {
+ styler.ColourTo(i - 1, state);
+ state = SCE_LISP_DEFAULT;
+ }
+ if (isLispoperator(ch) || ch=='\'') {
+ styler.ColourTo(i - 1, state);
+ styler.ColourTo(i, SCE_LISP_OPERATOR);
+ if (ch=='\'' && isLispwordstart(chNext)) {
+ state = SCE_LISP_SYMBOL;
+ }
+ }
+ } else {
+ if (state == SCE_LISP_COMMENT) {
+ if (atEOL) {
+ styler.ColourTo(i - 1, state);
+ state = SCE_LISP_DEFAULT;
+ }
+ } else if (state == SCE_LISP_MULTI_COMMENT) {
+ if (ch == '|' && chNext == '#') {
+ i++;
+ chNext = styler.SafeGetCharAt(i + 1);
+ styler.ColourTo(i, state);
+ state = SCE_LISP_DEFAULT;
+ }
+ } else if (state == SCE_LISP_STRING) {
+ if (ch == '\\') {
+ if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
+ i++;
+ chNext = styler.SafeGetCharAt(i + 1);
+ }
+ } else if (ch == '\"') {
+ styler.ColourTo(i, state);
+ state = SCE_LISP_DEFAULT;
+ }
+ }
+ }
+
+ }
+ styler.ColourTo(lengthDoc - 1, state);
+}
+
+static void FoldLispDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
+ Accessor &styler) {
+ unsigned int lengthDoc = startPos + length;
+ int visibleChars = 0;
+ int lineCurrent = styler.GetLine(startPos);
+ int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
+ int levelCurrent = levelPrev;
+ char chNext = styler[startPos];
+ int styleNext = styler.StyleAt(startPos);
+ for (unsigned int i = startPos; i < lengthDoc; i++) {
+ char ch = chNext;
+ chNext = styler.SafeGetCharAt(i + 1);
+ int style = styleNext;
+ styleNext = styler.StyleAt(i + 1);
+ bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+ if (style == SCE_LISP_OPERATOR) {
+ if (ch == '(' || ch == '[' || ch == '{') {
+ levelCurrent++;
+ } else if (ch == ')' || ch == ']' || ch == '}') {
+ levelCurrent--;
+ }
+ }
+ if (atEOL) {
+ int lev = levelPrev;
+ if (visibleChars == 0)
+ lev |= SC_FOLDLEVELWHITEFLAG;
+ if ((levelCurrent > levelPrev) && (visibleChars > 0))
+ lev |= SC_FOLDLEVELHEADERFLAG;
+ if (lev != styler.LevelAt(lineCurrent)) {
+ styler.SetLevel(lineCurrent, lev);
+ }
+ lineCurrent++;
+ levelPrev = levelCurrent;
+ visibleChars = 0;
+ }
+ if (!isspacechar(ch))
+ visibleChars++;
+ }
+ // Fill in the real level of the next line, keeping the current flags as they will be filled in later
+ int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
+ styler.SetLevel(lineCurrent, levelPrev | flagsNext);
+}
+
+static const char * const lispWordListDesc[] = {
+ "Functions and special operators",
+ "Keywords",
+ 0
+};
+
+LexerModule lmLISP(SCLEX_LISP, ColouriseLispDoc, "lisp", FoldLispDoc, lispWordListDesc);
Property changes on: trunk/scintilla/LexLisp.cxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/scintilla/Makefile.am
===================================================================
--- trunk/scintilla/Makefile.am 2010-10-06 16:06:13 UTC (rev 5285)
+++ trunk/scintilla/Makefile.am 2010-10-06 17:10:15 UTC (rev 5286)
@@ -19,6 +19,7 @@
LexFortran.cxx \
LexHaskell.cxx \
LexHTML.cxx \
+LexLisp.cxx \
LexLua.cxx \
LexMarkdown.cxx \
LexMatlab.cxx \
Modified: trunk/scintilla/makefile.win32
===================================================================
--- trunk/scintilla/makefile.win32 2010-10-06 16:06:13 UTC (rev 5285)
+++ trunk/scintilla/makefile.win32 2010-10-06 17:10:15 UTC (rev 5286)
@@ -64,7 +64,7 @@
LexPerl.o LexPython.o LexSQL.o LexCaml.o LexTCL.o LexTxt2tags.o LexRuby.o \
LexForth.o LexFortran.o LexVHDL.o LexVerilog.o \
LexMarkdown.o LexMatlab.o \
-LexD.o LexLua.o LexHaskell.o LexBasic.o LexR.o LexYAML.o LexCmake.o LexNsis.o
+LexD.o LexLisp.o LexLua.o LexHaskell.o LexBasic.o LexR.o LexYAML.o LexCmake.o LexNsis.o
#--Autogenerated -- end of automatically generated section
all: $(COMPLIB)
Modified: trunk/src/about.c
===================================================================
--- trunk/src/about.c 2010-10-06 16:06:13 UTC (rev 5285)
+++ trunk/src/about.c 2010-10-06 17:10:15 UTC (rev 5286)
@@ -94,7 +94,8 @@
"Giuseppe Torelli, Guillaume de Rorthais, Guillaume Hoffmann, Herbert Voss, Jason Oster, "
"Jean-François Wauthy, Jeff Pohlmeyer, Jesse Mayes, Jiří Techet, "
"John Gabriele, Jon Senior, Jon Strait, Josef Whiter, "
-"Jörn Reder, Kelvin Gardiner, Kevin Ellwood, Kristoffer A. Tjernås, Lex Trotman, Marko Peric, Matti Mårds, "
+"Jörn Reder, Kelvin Gardiner, Kevin Ellwood, Kristoffer A. Tjernås, Lex Trotman, "
+"Mário Silva, Marko Peric, Matti Mårds, "
"Moritz Barsnick, Ondrej Donek, Peter Strand, Philipp Gildein, Pierre Joye, Rob van der Linde, "
"Robert McGinley, Roland Baudin, Ross McKay, S Jagannathan, Saleem Abdulrasool, "
"Sebastian Kraft, Shiv, Slava Semushin, Stefan Oltmanns, Tamim, Thomas Huth, Thomas Martitz, Tomás Vírseda, "
Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c 2010-10-06 16:06:13 UTC (rev 5285)
+++ trunk/src/filetypes.c 2010-10-06 17:10:15 UTC (rev 5286)
@@ -506,6 +506,17 @@
ft->comment_close = NULL;
ft->group = GEANY_FILETYPE_GROUP_MISC;
+#define LISP
+ ft = filetypes[GEANY_FILETYPES_LISP];
+ ft->lang = -2;
+ ft->name = g_strdup("Lisp");
+ filetype_make_title(ft, TITLE_SOURCE_FILE);
+ ft->extension = g_strdup("lisp");
+ ft->pattern = utils_strv_new("*.lisp", NULL);
+ ft->comment_open = g_strdup(";");
+ ft->comment_close = NULL;
+ ft->group = GEANY_FILETYPE_GROUP_SCRIPT;
+
#define CONF
ft = filetypes[GEANY_FILETYPES_CONF];
ft->lang = 10;
Modified: trunk/src/filetypes.h
===================================================================
--- trunk/src/filetypes.h 2010-10-06 16:06:13 UTC (rev 5285)
+++ trunk/src/filetypes.h 2010-10-06 17:10:15 UTC (rev 5286)
@@ -33,6 +33,7 @@
#endif
+/* Do not change the order, only append. */
typedef enum
{
GEANY_FILETYPES_NONE = 0, /* first filetype is always None & must be 0 */
@@ -85,6 +86,7 @@
GEANY_FILETYPES_ABC,
GEANY_FILETYPES_VERILOG,
GEANY_FILETYPES_FORTH,
+ GEANY_FILETYPES_LISP,
/* ^ append items here */
GEANY_MAX_BUILT_IN_FILETYPES /* Don't use this, use filetypes_array->len instead */
}
Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c 2010-10-06 16:06:13 UTC (rev 5285)
+++ trunk/src/highlighting.c 2010-10-06 17:10:15 UTC (rev 5286)
@@ -1076,6 +1076,62 @@
}
+static void styleset_lisp_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
+{
+ new_styleset(ft_id, 15);
+ get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
+ get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[1]);
+ get_keyfile_style(config, config_home, "multicomment", &style_sets[ft_id].styling[2]);
+ get_keyfile_style(config, config_home, "number", &style_sets[ft_id].styling[3]);
+ get_keyfile_style(config, config_home, "keyword", &style_sets[ft_id].styling[4]);
+ get_keyfile_style(config, config_home, "special_keyword", &style_sets[ft_id].styling[5]);
+ get_keyfile_style(config, config_home, "symbol", &style_sets[ft_id].styling[6]);
+ get_keyfile_style(config, config_home, "string", &style_sets[ft_id].styling[7]);
+ get_keyfile_style(config, config_home, "stringeol", &style_sets[ft_id].styling[8]);
+ get_keyfile_style(config, config_home, "identifier", &style_sets[ft_id].styling[9]);
+ get_keyfile_style(config, config_home, "operator", &style_sets[ft_id].styling[10]);
+ get_keyfile_style(config, config_home, "special", &style_sets[ft_id].styling[11]);
+ get_keyfile_style(config, config_home, "character", &style_sets[ft_id].styling[12]);
+ get_keyfile_style(config, config_home, "macro", &style_sets[ft_id].styling[13]);
+ get_keyfile_style(config, config_home, "macrodispatch", &style_sets[ft_id].styling[14]);
+
+ style_sets[ft_id].keywords = g_new(gchar*, 3);
+ get_keyfile_keywords(config, config_home, "keywords", ft_id, 0);
+ get_keyfile_keywords(config, config_home, "special_keywords", ft_id, 1);
+ style_sets[ft_id].keywords[2] = NULL;
+}
+
+
+static void styleset_lisp(ScintillaObject *sci, gint ft_id)
+{
+ apply_filetype_properties(sci, SCLEX_LISP, ft_id);
+
+ sci_set_keywords(sci, 0, style_sets[ft_id].keywords[0]);
+ sci_set_keywords(sci, 1, style_sets[ft_id].keywords[1]);
+
+ set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
+ set_sci_style(sci, SCE_LISP_DEFAULT, ft_id, 0);
+ set_sci_style(sci, SCE_LISP_COMMENT, ft_id, 1);
+ set_sci_style(sci, SCE_LISP_MULTI_COMMENT, ft_id, 2);
+ set_sci_style(sci, SCE_LISP_NUMBER, ft_id, 3);
+ set_sci_style(sci, SCE_LISP_KEYWORD, ft_id, 4);
+/*
+ set_sci_style(sci, SCE_LISP_SPECIAL_KEYWORD, ft_id, 5);
+*/
+ set_sci_style(sci, SCE_LISP_SYMBOL, ft_id, 6);
+ set_sci_style(sci, SCE_LISP_STRING, ft_id, 7);
+ set_sci_style(sci, SCE_LISP_STRINGEOL, ft_id, 8);
+ set_sci_style(sci, SCE_LISP_IDENTIFIER, ft_id, 9);
+ set_sci_style(sci, SCE_LISP_OPERATOR, ft_id, 10);
+ set_sci_style(sci, SCE_LISP_SPECIAL, ft_id, 11);
+/*
+ set_sci_style(sci, SCE_LISP_CHARACTER, ft_id, 12);
+ set_sci_style(sci, SCE_LISP_MACRO, ft_id, 13);
+ set_sci_style(sci, SCE_LISP_MACRO_DISPATCH, ft_id, 14);
+*/
+}
+
+
static void styleset_latex_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
{
new_styleset(ft_id, 5);
@@ -3264,6 +3320,7 @@
init_styleset_case(GEANY_FILETYPES_CSS, styleset_css_init);
init_styleset_case(GEANY_FILETYPES_D, styleset_d_init);
init_styleset_case(GEANY_FILETYPES_DIFF, styleset_diff_init);
+ init_styleset_case(GEANY_FILETYPES_LISP, styleset_lisp_init);
init_styleset_case(GEANY_FILETYPES_DOCBOOK, styleset_docbook_init);
init_styleset_case(GEANY_FILETYPES_FERITE, styleset_ferite_init);
init_styleset_case(GEANY_FILETYPES_F77, styleset_f77_init);
@@ -3334,6 +3391,7 @@
styleset_case(GEANY_FILETYPES_CSS, styleset_css);
styleset_case(GEANY_FILETYPES_D, styleset_d);
styleset_case(GEANY_FILETYPES_DIFF, styleset_diff);
+ styleset_case(GEANY_FILETYPES_LISP, styleset_lisp);
styleset_case(GEANY_FILETYPES_DOCBOOK, styleset_docbook);
styleset_case(GEANY_FILETYPES_FERITE, styleset_ferite);
styleset_case(GEANY_FILETYPES_F77, styleset_f77);
Modified: trunk/wscript
===================================================================
--- trunk/wscript 2010-10-06 16:06:13 UTC (rev 5285)
+++ trunk/wscript 2010-10-06 17:10:15 UTC (rev 5286)
@@ -88,7 +88,7 @@
'scintilla/LexAda.cxx', 'scintilla/LexAsm.cxx', 'scintilla/LexBash.cxx',
'scintilla/LexBasic.cxx', 'scintilla/LexCaml.cxx', 'scintilla/LexCmake.cxx', 'scintilla/LexCPP.cxx',
'scintilla/LexCSS.cxx', 'scintilla/LexD.cxx', 'scintilla/LexForth.cxx',
- 'scintilla/LexFortran.cxx', 'scintilla/LexHaskell.cxx', 'scintilla/LexHTML.cxx',
+ 'scintilla/LexFortran.cxx', 'scintilla/LexHaskell.cxx', 'scintilla/LexHTML.cxx', 'scintilla/LexLisp.cxx'
'scintilla/LexLua.cxx', 'scintilla/LexMarkdown.cxx', 'scintilla/LexMatlab.cxx',
'scintilla/LexNsis.cxx', 'scintilla/LexOthers.cxx',
'scintilla/LexPascal.cxx', 'scintilla/LexPerl.cxx', 'scintilla/LexPython.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