SF.net SVN: geany:[5188] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Mon Aug 23 12:14:58 UTC 2010


Revision: 5188
          http://geany.svn.sourceforge.net/geany/?rev=5188&view=rev
Author:   ntrel
Date:     2010-08-23 12:14:58 +0000 (Mon, 23 Aug 2010)

Log Message:
-----------
Add lexer for Txt2Tags (patch by Forgeot Eric, #3020632).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/data/filetypes.txt2tags
    trunk/scintilla/KeyWords.cxx
    trunk/scintilla/Makefile.am
    trunk/scintilla/include/SciLexer.h
    trunk/scintilla/include/Scintilla.iface
    trunk/scintilla/makefile.win32
    trunk/src/highlighting.c
    trunk/wscript

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-08-21 09:07:46 UTC (rev 5187)
+++ trunk/ChangeLog	2010-08-23 12:14:58 UTC (rev 5188)
@@ -1,3 +1,12 @@
+2010-08-23  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * scintilla/LexTxt2tags.cxx, scintilla/makefile.win32,
+   scintilla/include/SciLexer.h, scintilla/include/Scintilla.iface,
+   scintilla/KeyWords.cxx, scintilla/Makefile.am, src/highlighting.c,
+   data/filetypes.txt2tags, wscript:
+   Add lexer for Txt2Tags (patch by Forgeot Eric, #3020632).
+
+
 2010-08-21  Frank Lanitz  <frank at frank.uvena.de>
 
  * src/plugindata.h:
@@ -2,3 +11,3 @@
    Apply a patch by Jiří Techet which is preventing warnings when using
-   -Wmissing-prototypes on compiling. Thanks. 
+   -Wmissing-prototypes on compiling. Thanks.
 

Modified: trunk/data/filetypes.txt2tags
===================================================================
--- trunk/data/filetypes.txt2tags	2010-08-21 09:07:46 UTC (rev 5187)
+++ trunk/data/filetypes.txt2tags	2010-08-23 12:14:58 UTC (rev 5188)
@@ -1,9 +1,34 @@
 # For complete documentation of this file, please see Geany's main documentation
 [styling]
-# no syntax highlighting yet
+# foreground;background;bold;italic
+default=0x000000;0xffffff;false;false
+strong=0x445675;0xffffff;true;false
+emphasis=0x653A39;0xffffff;false;true
+underlined=0x386742;0xffffff;false;false
+header1=0xE20700;0xffffff;true;false
+header2=0xE20700;0xffffff;true;false
+header3=0xA81D05;0xffffff;true;false
+header4=0x871704;0xffffff;true;false
+header5=0x871704;0xffffff;true;false
+header6=0x871704;0xffffff;true;false
+ulist_item=0xE300EE;0xffffff;false;false
+olist_item=0xE300EE;0xffffff;false;false
+blockquote=0x015F52;0xffffff;false;false
+strikeout=0x644A9B;0xffffff;false;false
+hrule=0xff901e;0xffffff;false;false
+link=0x0930DE;0xffffff;false;true
+code=0x009f00;0xffffff;false;false
+codebk=0x005f00;0xffffff;false;false
+comment=0x777777;0xffffff;false;false
+option=0xC0036E;0xffffff;false;true
+preproc=0x848B00;0xffffff;false;true
+postproc=0xC05600;0xffffff;false;true
 
 [settings]
 # default extension used when saving files
 extension=txt2tags
 
+[keywords]
+primary=includeconf options toc
 
+

Modified: trunk/scintilla/KeyWords.cxx
===================================================================
--- trunk/scintilla/KeyWords.cxx	2010-08-21 09:07:46 UTC (rev 5187)
+++ trunk/scintilla/KeyWords.cxx	2010-08-23 12:14:58 UTC (rev 5188)
@@ -359,6 +359,7 @@
 	LINK_LEXER(lmRuby);
 	LINK_LEXER(lmSQL);
 	LINK_LEXER(lmTCL);
+	LINK_LEXER(lmTxt2tags);
 	LINK_LEXER(lmVerilog);
 	LINK_LEXER(lmVHDL);
 	LINK_LEXER(lmXML);

Added: trunk/scintilla/LexTxt2tags.cxx
===================================================================
--- trunk/scintilla/LexTxt2tags.cxx	                        (rev 0)
+++ trunk/scintilla/LexTxt2tags.cxx	2010-08-23 12:14:58 UTC (rev 5188)
@@ -0,0 +1,498 @@
+/******************************************************************
+ *  LexTxt2tags.cxx
+ *
+ *  A simple Txt2tags lexer for scintilla.
+ *
+ *
+ *  Adapted by Eric Forgeot
+ *  Based on the LexMarkdown.cxx by Jon Strait - jstrait at moonloop.net
+ *
+ *  What could be improved:
+ *   - Verbatim lines could be like for raw lines : when there is no space between the ``` and the following text, the first letter should be colored so the user would understand there must be a space for a valid tag.
+ *   - marks such as bold, italic, strikeout, underline should begin to be highlighted only when they are closed and valid.
+ *   - verbatim and raw area should be highlighted too.
+ *
+ *  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 "StyleContext.h"
+#include "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+#ifdef SCI_NAMESPACE
+using namespace Scintilla;
+#endif
+
+
+
+static inline bool IsNewline(const int ch) {
+    return (ch == '\n' || ch == '\r');
+}
+
+// True if can follow ch down to the end with possibly trailing whitespace
+static bool FollowToLineEnd(const int ch, const int state, const unsigned int endPos, StyleContext &sc) {
+    unsigned int i = 0;
+    while (sc.GetRelative(++i) == ch)
+        ;
+    // Skip over whitespace
+    while (IsASpaceOrTab(sc.GetRelative(i)) && sc.currentPos + i < endPos)
+        ++i;
+    if (IsNewline(sc.GetRelative(i)) || sc.currentPos + i == endPos) {
+        sc.Forward(i);
+        sc.ChangeState(state);
+        sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+        return true;
+    }
+    else return false;
+}
+
+// Set the state on text section from current to length characters,
+// then set the rest until the newline to default, except for any characters matching token
+static void SetStateAndZoom(const int state, const int length, const int token, StyleContext &sc) {
+    sc.SetState(state);
+    sc.Forward(length);
+    sc.SetState(SCE_TXT2TAGS_DEFAULT);
+    sc.Forward();
+    bool started = false;
+    while (sc.More() && !IsNewline(sc.ch)) {
+        if (sc.ch == token && !started) {
+            sc.SetState(state);
+            started = true;
+        }
+        else if (sc.ch != token) {
+            sc.SetState(SCE_TXT2TAGS_DEFAULT);
+            started = false;
+        }
+        sc.Forward();
+    }
+    sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+}
+
+// Does the previous line have more than spaces and tabs?
+static bool HasPrevLineContent(StyleContext &sc) {
+    int i = 0;
+    // Go back to the previous newline
+    while ((--i + sc.currentPos) && !IsNewline(sc.GetRelative(i)))
+        ;
+    while (--i + sc.currentPos) {
+        if (IsNewline(sc.GetRelative(i)))
+            break;
+        if (!IsASpaceOrTab(sc.GetRelative(i)))
+            return true;
+    }
+    return false;
+}
+
+// Separator line
+static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
+    int c, count = 1;
+    unsigned int i = 0;
+    while (++i) {
+        c = sc.GetRelative(i);
+        if (c == sc.ch)
+            ++count;
+        // hit a terminating character
+        else if (!IsASpaceOrTab(c) || sc.currentPos + i == endPos) {
+            // Are we a valid HRULE
+            if ((IsNewline(c) || sc.currentPos + i == endPos) &&
+                    count >= 20 && !HasPrevLineContent(sc)) {
+                sc.SetState(SCE_TXT2TAGS_HRULE);
+                sc.Forward(i);
+                sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+                return true;
+            }
+            else {
+                sc.SetState(SCE_TXT2TAGS_DEFAULT);
+		return false;
+            }
+        }
+    }
+    return false;
+}
+
+static void ColorizeTxt2tagsDoc(unsigned int startPos, int length, int initStyle,
+                               WordList **, Accessor &styler) {
+    unsigned int endPos = startPos + length;
+    int precharCount = 0;
+    // Don't advance on a new loop iteration and retry at the same position.
+    // Useful in the corner case of having to start at the beginning file position
+    // in the default state.
+    bool freezeCursor = false;
+
+    StyleContext sc(startPos, length, initStyle, styler);
+
+    while (sc.More()) {
+        // Skip past escaped characters
+        if (sc.ch == '\\') {
+            sc.Forward();
+            continue;
+        }
+
+        // A blockquotes resets the line semantics
+        if (sc.state == SCE_TXT2TAGS_BLOCKQUOTE){
+            sc.Forward(2);
+            sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+        }
+        // An option colors the whole line
+        if (sc.state == SCE_TXT2TAGS_OPTION){
+            FollowToLineEnd('%', SCE_TXT2TAGS_OPTION, endPos, sc);
+        }
+        if (sc.state == SCE_TXT2TAGS_POSTPROC){
+            FollowToLineEnd('%', SCE_TXT2TAGS_POSTPROC, endPos, sc);
+        }
+        if (sc.state == SCE_TXT2TAGS_PREPROC){
+            FollowToLineEnd('%', SCE_TXT2TAGS_PREPROC, endPos, sc);
+        }
+        // A comment colors the whole line
+        if (sc.state == SCE_TXT2TAGS_COMMENT){
+            FollowToLineEnd('%', SCE_TXT2TAGS_COMMENT, endPos, sc);
+        }
+        // Conditional state-based actions
+        if (sc.state == SCE_TXT2TAGS_CODE2) {
+        if (IsNewline(sc.ch))
+                sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+            if (sc.Match("``") && sc.GetRelative(-2) != ' ') {
+                sc.Forward(2);
+                sc.SetState(SCE_TXT2TAGS_DEFAULT);
+            }
+        }
+        // Table
+        else if (sc.state == SCE_TXT2TAGS_CODE) {
+        if (IsNewline(sc.ch))
+                sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+            if (sc.ch == '|' && sc.chPrev != ' ')
+                sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT);
+        }
+        // Strong
+        else if (sc.state == SCE_TXT2TAGS_STRONG1) {
+        if (IsNewline(sc.ch))
+                sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+            if (sc.Match("**") && sc.chPrev != ' ') {
+                sc.Forward(2);
+                sc.SetState(SCE_TXT2TAGS_DEFAULT);
+            }
+        }
+        // Emphasis
+        else if (sc.state == SCE_TXT2TAGS_EM1) {
+        if (IsNewline(sc.ch))
+                sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+            if (sc.Match("//") && sc.chPrev != ' ') {
+                sc.Forward(2);
+                sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT);
+           }
+        }
+        // Underline
+        else if (sc.state == SCE_TXT2TAGS_EM2) {
+        if (IsNewline(sc.ch))
+                sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+            if (sc.Match("__") && sc.chPrev != ' ') {
+                sc.Forward(2);
+                sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT);
+           }
+        }
+        // codeblock
+        else if (sc.state == SCE_TXT2TAGS_CODEBK) {
+                if (IsNewline(sc.ch))
+                sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+            if (sc.atLineStart && sc.Match("```")) {
+                int i = 1;
+                while (!IsNewline(sc.GetRelative(i)) && sc.currentPos + i < endPos)
+                    i++;
+                sc.Forward(i);
+                sc.SetState(SCE_TXT2TAGS_DEFAULT);
+            }
+        }
+        // strikeout
+        else if (sc.state == SCE_TXT2TAGS_STRIKEOUT) {
+        if (IsNewline(sc.ch))
+                sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+            if (sc.Match("--") && sc.chPrev != ' ') {
+                sc.Forward(2);
+                sc.SetState(SCE_TXT2TAGS_DEFAULT);
+            }
+        }
+        // Headers
+        else if (sc.state == SCE_TXT2TAGS_LINE_BEGIN) {
+            if (sc.Match("======"))
+                {
+                sc.SetState(SCE_TXT2TAGS_HEADER6);
+                sc.Forward();
+                }
+            else if (sc.Match("====="))
+                {
+                sc.SetState(SCE_TXT2TAGS_HEADER5);
+                sc.Forward();
+                }
+            else if (sc.Match("===="))
+                {
+                sc.SetState(SCE_TXT2TAGS_HEADER4);
+                sc.Forward();
+                }
+            else if (sc.Match("==="))
+                {
+                sc.SetState(SCE_TXT2TAGS_HEADER3);
+                sc.Forward();
+                }
+                //SetStateAndZoom(SCE_TXT2TAGS_HEADER3, 3, '=', sc);
+            else if (sc.Match("==")) {
+                sc.SetState(SCE_TXT2TAGS_HEADER2);
+                sc.Forward();
+                }
+                //SetStateAndZoom(SCE_TXT2TAGS_HEADER2, 2, '=', sc);
+            else if (sc.Match("=")) {
+                // Catch the special case of an unordered list
+                if (sc.chNext == '.' && IsASpaceOrTab(sc.GetRelative(2))) {
+                    precharCount = 0;
+                    sc.SetState(SCE_TXT2TAGS_PRECHAR);
+                }
+                else
+                    {
+                    sc.SetState(SCE_TXT2TAGS_HEADER1);
+                    sc.Forward();
+                    }
+                    //SetStateAndZoom(SCE_TXT2TAGS_HEADER1, 1, '=', sc);
+            }
+
+            // Numbered title
+            else if (sc.Match("++++++"))
+                {
+                sc.SetState(SCE_TXT2TAGS_HEADER6);
+                sc.Forward();
+                }
+            else if (sc.Match("+++++"))
+                {
+                sc.SetState(SCE_TXT2TAGS_HEADER5);
+                sc.Forward();
+                }
+            else if (sc.Match("++++"))
+                {
+                sc.SetState(SCE_TXT2TAGS_HEADER4);
+                sc.Forward();
+                }
+            else if (sc.Match("+++"))
+                {
+                sc.SetState(SCE_TXT2TAGS_HEADER3);
+                sc.Forward();
+                }
+                //SetStateAndZoom(SCE_TXT2TAGS_HEADER3, 3, '+', sc);
+            else if (sc.Match("++")) {
+                sc.SetState(SCE_TXT2TAGS_HEADER2);
+                sc.Forward();
+                }
+                //SetStateAndZoom(SCE_TXT2TAGS_HEADER2, 2, '+', sc);
+            else if (sc.Match("+")) {
+                // Catch the special case of an unordered list
+                if (sc.chNext == ' ' && IsASpaceOrTab(sc.GetRelative(1))) {
+                 //    if (IsNewline(sc.ch)) {
+                     	//precharCount = 0;
+                //		sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+                		//sc.SetState(SCE_TXT2TAGS_PRECHAR);
+				//	}
+                //    else {
+                //    precharCount = 0;
+                    sc.SetState(SCE_TXT2TAGS_OLIST_ITEM);
+                    sc.Forward(2);
+                    sc.SetState(SCE_TXT2TAGS_DEFAULT);
+               //     sc.SetState(SCE_TXT2TAGS_PRECHAR);
+				//	}
+                }
+                else
+                    {
+                    sc.SetState(SCE_TXT2TAGS_HEADER1);
+                    sc.Forward();
+                    }
+            }
+
+
+            // Codeblock
+            else if (sc.Match("```")) {
+                if (!HasPrevLineContent(sc))
+              //  if (!FollowToLineEnd(sc))
+                    sc.SetState(SCE_TXT2TAGS_CODEBK);
+                else
+                    sc.SetState(SCE_TXT2TAGS_DEFAULT);
+            }
+
+            // Preproc
+            else if (sc.Match("%!preproc")) {
+                sc.SetState(SCE_TXT2TAGS_PREPROC);
+            }
+            // Postproc
+            else if (sc.Match("%!postproc")) {
+                sc.SetState(SCE_TXT2TAGS_POSTPROC);
+            }
+            // Option
+            else if (sc.Match("%!")) {
+                sc.SetState(SCE_TXT2TAGS_OPTION);
+            }
+
+             // Comment
+            else if (sc.ch == '%') {
+                sc.SetState(SCE_TXT2TAGS_COMMENT);
+            }
+            // list
+            else if (sc.ch == '-') {
+                    precharCount = 0;
+                    sc.SetState(SCE_TXT2TAGS_PRECHAR);
+            }
+            // def list
+            else if (sc.ch == ':') {
+                    precharCount = 0;
+                   sc.SetState(SCE_TXT2TAGS_OLIST_ITEM);
+                   sc.Forward(1);
+                   sc.SetState(SCE_TXT2TAGS_PRECHAR);
+            }
+            else if (IsNewline(sc.ch))
+                sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+            else {
+                precharCount = 0;
+                sc.SetState(SCE_TXT2TAGS_PRECHAR);
+            }
+        }
+
+        // The header lasts until the newline
+        else if (sc.state == SCE_TXT2TAGS_HEADER1 || sc.state == SCE_TXT2TAGS_HEADER2 ||
+                sc.state == SCE_TXT2TAGS_HEADER3 || sc.state == SCE_TXT2TAGS_HEADER4 ||
+                sc.state == SCE_TXT2TAGS_HEADER5 || sc.state == SCE_TXT2TAGS_HEADER6) {
+            if (IsNewline(sc.ch))
+                sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+        }
+
+        // New state only within the initial whitespace
+        if (sc.state == SCE_TXT2TAGS_PRECHAR) {
+            // Blockquote
+            if (sc.Match("\"\"\"") && precharCount < 5){
+
+                sc.SetState(SCE_TXT2TAGS_BLOCKQUOTE);
+                sc.Forward(1);
+                }
+            /*
+            // Begin of code block
+            else if (!HasPrevLineContent(sc) && (sc.chPrev == '\t' || precharCount >= 4))
+                sc.SetState(SCE_TXT2TAGS_CODEBK);
+            */
+            // HRule - Total of 20 or more hyphens, asterisks, or underscores
+            // on a line by themselves
+            else if ((sc.ch == '-' ) && IsValidHrule(endPos, sc))
+                ;
+            // Unordered list
+            else if ((sc.ch == '-') && IsASpaceOrTab(sc.chNext)) {
+                sc.SetState(SCE_TXT2TAGS_ULIST_ITEM);
+                sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT);
+            }
+            // Ordered list
+            else if (IsADigit(sc.ch)) {
+                int digitCount = 0;
+                while (IsADigit(sc.GetRelative(++digitCount)))
+                    ;
+                if (sc.GetRelative(digitCount) == '.' &&
+                        IsASpaceOrTab(sc.GetRelative(digitCount + 1))) {
+                    sc.SetState(SCE_TXT2TAGS_OLIST_ITEM);
+                    sc.Forward(digitCount + 1);
+                    sc.SetState(SCE_TXT2TAGS_DEFAULT);
+                }
+            }
+            // Alternate Ordered list
+            else if (sc.ch == '+' && sc.chNext == ' ' && IsASpaceOrTab(sc.GetRelative(2))) {
+            //    sc.SetState(SCE_TXT2TAGS_OLIST_ITEM);
+            //    sc.Forward(2);
+             //   sc.SetState(SCE_TXT2TAGS_DEFAULT);
+            }
+            else if (sc.ch != ' ' || precharCount > 2)
+                sc.SetState(SCE_TXT2TAGS_DEFAULT);
+            else
+                ++precharCount;
+        }
+
+        // New state anywhere in doc
+        if (sc.state == SCE_TXT2TAGS_DEFAULT) {
+         //   if (sc.atLineStart && sc.ch == '#') {
+         //       sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+         //       freezeCursor = true;
+         //   }
+            // Links and Images
+            if (sc.Match("![") || sc.ch == '[') {
+                int i = 0, j = 0, k = 0;
+                int len = endPos - sc.currentPos;
+                while (i < len && (sc.GetRelative(++i) != ']' || sc.GetRelative(i - 1) == '\\'))
+                    ;
+                if (sc.GetRelative(i) == ']') {
+                    j = i;
+                    if (sc.GetRelative(++i) == '(') {
+                        while (i < len && (sc.GetRelative(++i) != '(' || sc.GetRelative(i - 1) == '\\'))
+                            ;
+                        if (sc.GetRelative(i) == '(')
+                            k = i;
+                    }
+
+                    else if (sc.GetRelative(i) == '[' || sc.GetRelative(++i) == '[') {
+                        while (i < len && (sc.GetRelative(++i) != ']' || sc.GetRelative(i - 1) == '\\'))
+                            ;
+                        if (sc.GetRelative(i) == ']')
+                            k = i;
+                    }
+                }
+                // At least a link text
+                if (j) {
+                    sc.SetState(SCE_TXT2TAGS_LINK);
+                    sc.Forward(j);
+                    // Also has a URL or reference portion
+                    if (k)
+                        sc.Forward(k - j);
+                    sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT);
+                }
+            }
+            // Code - also a special case for alternate inside spacing
+            if (sc.Match("``") && sc.GetRelative(3) != ' ') {
+                sc.SetState(SCE_TXT2TAGS_CODE2);
+                sc.Forward();
+            }
+            else if (sc.ch == '|' && sc.GetRelative(3) != ' ') {
+                sc.SetState(SCE_TXT2TAGS_CODE);
+            }
+            // Strong
+            else if (sc.Match("**") && sc.GetRelative(2) != ' ') {
+                sc.SetState(SCE_TXT2TAGS_STRONG1);
+                sc.Forward();
+           }
+            // Emphasis
+            else if (sc.Match("//") && sc.GetRelative(2) != ' ') {
+                sc.SetState(SCE_TXT2TAGS_EM1);
+                sc.Forward();
+            }
+            else if (sc.Match("__") && sc.GetRelative(2) != ' ') {
+                sc.SetState(SCE_TXT2TAGS_EM2);
+                sc.Forward();
+            }
+            // Strikeout
+            else if (sc.Match("--") && sc.GetRelative(2) != ' ') {
+                sc.SetState(SCE_TXT2TAGS_STRIKEOUT);
+                sc.Forward();
+            }
+
+            // Beginning of line
+            else if (IsNewline(sc.ch))
+                sc.SetState(SCE_TXT2TAGS_LINE_BEGIN);
+        }
+        // Advance if not holding back the cursor for this iteration.
+        if (!freezeCursor)
+            sc.Forward();
+        freezeCursor = false;
+    }
+    sc.Complete();
+}
+
+LexerModule lmTxt2tags(SCLEX_TXT2TAGS, ColorizeTxt2tagsDoc, "txt2tags");


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

Modified: trunk/scintilla/Makefile.am
===================================================================
--- trunk/scintilla/Makefile.am	2010-08-21 09:07:46 UTC (rev 5187)
+++ trunk/scintilla/Makefile.am	2010-08-23 12:14:58 UTC (rev 5188)
@@ -29,6 +29,7 @@
 LexR.cxx \
 LexRuby.cxx \
 LexSQL.cxx \
+LexTxt2tags.cxx \
 LexTCL.cxx \
 LexVHDL.cxx \
 LexVerilog.cxx \

Modified: trunk/scintilla/include/SciLexer.h
===================================================================
--- trunk/scintilla/include/SciLexer.h	2010-08-21 09:07:46 UTC (rev 5187)
+++ trunk/scintilla/include/SciLexer.h	2010-08-23 12:14:58 UTC (rev 5188)
@@ -111,6 +111,7 @@
 #define SCLEX_NIMROD 96
 #define SCLEX_SML 97
 #define SCLEX_MARKDOWN 98
+#define SCLEX_TXT2TAGS 99
 #define SCLEX_AUTOMATIC 1000
 #define SCE_P_DEFAULT 0
 #define SCE_P_COMMENTLINE 1
@@ -1385,6 +1386,32 @@
 #define SCE_MARKDOWN_CODE 19
 #define SCE_MARKDOWN_CODE2 20
 #define SCE_MARKDOWN_CODEBK 21
+#define SCE_TXT2TAGS_DEFAULT 0
+#define SCE_TXT2TAGS_LINE_BEGIN 1
+#define SCE_TXT2TAGS_STRONG1 2
+#define SCE_TXT2TAGS_STRONG2 3
+#define SCE_TXT2TAGS_EM1 4
+#define SCE_TXT2TAGS_EM2 5
+#define SCE_TXT2TAGS_HEADER1 6
+#define SCE_TXT2TAGS_HEADER2 7
+#define SCE_TXT2TAGS_HEADER3 8
+#define SCE_TXT2TAGS_HEADER4 9
+#define SCE_TXT2TAGS_HEADER5 10
+#define SCE_TXT2TAGS_HEADER6 11
+#define SCE_TXT2TAGS_PRECHAR 12
+#define SCE_TXT2TAGS_ULIST_ITEM 13
+#define SCE_TXT2TAGS_OLIST_ITEM 14
+#define SCE_TXT2TAGS_BLOCKQUOTE 15
+#define SCE_TXT2TAGS_STRIKEOUT 16
+#define SCE_TXT2TAGS_HRULE 17
+#define SCE_TXT2TAGS_LINK 18
+#define SCE_TXT2TAGS_CODE 19
+#define SCE_TXT2TAGS_CODE2 20
+#define SCE_TXT2TAGS_CODEBK 21
+#define SCE_TXT2TAGS_COMMENT 22
+#define SCE_TXT2TAGS_OPTION 23
+#define SCE_TXT2TAGS_PREPROC 24
+#define SCE_TXT2TAGS_POSTPROC 25
 /* --Autogenerated -- end of section automatically generated from Scintilla.iface */
 
 #endif

Modified: trunk/scintilla/include/Scintilla.iface
===================================================================
--- trunk/scintilla/include/Scintilla.iface	2010-08-21 09:07:46 UTC (rev 5187)
+++ trunk/scintilla/include/Scintilla.iface	2010-08-23 12:14:58 UTC (rev 5188)
@@ -2299,6 +2299,7 @@
 val SCLEX_NIMROD=96
 val SCLEX_SML=97
 val SCLEX_MARKDOWN=98
+val SCLEX_TXT2TAGS=99
 
 # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
 # value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -3752,6 +3753,34 @@
 val SCE_MARKDOWN_CODE=19
 val SCE_MARKDOWN_CODE2=20
 val SCE_MARKDOWN_CODEBK=21
+# Lexical state for SCLEX_TXT2TAGS
+lex Txt2tags=SCLEX_TXT2TAGS SCE_TXT2TAGS_
+val SCE_TXT2TAGS_DEFAULT=0
+val SCE_TXT2TAGS_LINE_BEGIN=1
+val SCE_TXT2TAGS_STRONG1=2
+val SCE_TXT2TAGS_STRONG2=3
+val SCE_TXT2TAGS_EM1=4
+val SCE_TXT2TAGS_EM2=5
+val SCE_TXT2TAGS_HEADER1=6
+val SCE_TXT2TAGS_HEADER2=7
+val SCE_TXT2TAGS_HEADER3=8
+val SCE_TXT2TAGS_HEADER4=9
+val SCE_TXT2TAGS_HEADER5=10
+val SCE_TXT2TAGS_HEADER6=11
+val SCE_TXT2TAGS_PRECHAR=12
+val SCE_TXT2TAGS_ULIST_ITEM=13
+val SCE_TXT2TAGS_OLIST_ITEM=14
+val SCE_TXT2TAGS_BLOCKQUOTE=15
+val SCE_TXT2TAGS_STRIKEOUT=16
+val SCE_TXT2TAGS_HRULE=17
+val SCE_TXT2TAGS_LINK=18
+val SCE_TXT2TAGS_CODE=19
+val SCE_TXT2TAGS_CODE2=20
+val SCE_TXT2TAGS_CODEBK=21
+val SCE_TXT2TAGS_COMMENT=22
+val SCE_TXT2TAGS_OPTION=23
+val SCE_TXT2TAGS_PREPROC=24
+val SCE_TXT2TAGS_POSTPROC=25
 
 # Events
 

Modified: trunk/scintilla/makefile.win32
===================================================================
--- trunk/scintilla/makefile.win32	2010-08-21 09:07:46 UTC (rev 5187)
+++ trunk/scintilla/makefile.win32	2010-08-23 12:14:58 UTC (rev 5188)
@@ -61,7 +61,7 @@
 #**LEXOBJS=\\\n\(\*.o \)
 LEXOBJS=\
 LexAda.o LexBash.o LexAsm.o LexCSS.o LexCPP.o LexHTML.o LexOthers.o LexPascal.o \
-LexPerl.o LexPython.o LexSQL.o LexCaml.o LexTCL.o LexRuby.o LexFortran.o LexVHDL.o LexVerilog.o\
+LexPerl.o LexPython.o LexSQL.o LexCaml.o LexTCL.o LexTxt2tags.o LexRuby.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
 #--Autogenerated -- end of automatically generated section

Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c	2010-08-21 09:07:46 UTC (rev 5187)
+++ trunk/src/highlighting.c	2010-08-23 12:14:58 UTC (rev 5188)
@@ -2528,7 +2528,71 @@
 	set_sci_style(sci, SCE_TCL_WORD5, ft_id, 15);
 }
 
+static void styleset_txt2tags_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
+{
+	new_styleset(ft_id, 22);
 
+	get_keyfile_style(config, config_home, "default", &style_sets[ft_id].styling[0]);
+	get_keyfile_style(config, config_home, "strong", &style_sets[ft_id].styling[1]);
+	get_keyfile_style(config, config_home, "emphasis", &style_sets[ft_id].styling[2]);
+	get_keyfile_style(config, config_home, "header1", &style_sets[ft_id].styling[3]);
+	get_keyfile_style(config, config_home, "header2", &style_sets[ft_id].styling[4]);
+	get_keyfile_style(config, config_home, "header3", &style_sets[ft_id].styling[5]);
+	get_keyfile_style(config, config_home, "header4", &style_sets[ft_id].styling[6]);
+	get_keyfile_style(config, config_home, "header5", &style_sets[ft_id].styling[7]);
+	get_keyfile_style(config, config_home, "header6", &style_sets[ft_id].styling[8]);
+	get_keyfile_style(config, config_home, "ulist_item", &style_sets[ft_id].styling[9]);
+	get_keyfile_style(config, config_home, "olist_item", &style_sets[ft_id].styling[10]);
+	get_keyfile_style(config, config_home, "blockquote", &style_sets[ft_id].styling[11]);
+	get_keyfile_style(config, config_home, "strikeout", &style_sets[ft_id].styling[12]);
+	get_keyfile_style(config, config_home, "hrule", &style_sets[ft_id].styling[13]);
+	get_keyfile_style(config, config_home, "link", &style_sets[ft_id].styling[14]);
+	get_keyfile_style(config, config_home, "code", &style_sets[ft_id].styling[15]);
+	get_keyfile_style(config, config_home, "codebk", &style_sets[ft_id].styling[16]);
+	get_keyfile_style(config, config_home, "underlined", &style_sets[ft_id].styling[17]);
+	get_keyfile_style(config, config_home, "comment", &style_sets[ft_id].styling[18]);
+	get_keyfile_style(config, config_home, "option", &style_sets[ft_id].styling[19]);
+	get_keyfile_style(config, config_home, "preproc", &style_sets[ft_id].styling[20]);
+	get_keyfile_style(config, config_home, "postproc", &style_sets[ft_id].styling[21]);
+
+	style_sets[ft_id].keywords = NULL;
+}
+
+
+static void styleset_txt2tags(ScintillaObject *sci, gint ft_id)
+{
+	apply_filetype_properties(sci, SCLEX_TXT2TAGS, ft_id);
+
+	set_sci_style(sci, STYLE_DEFAULT, ft_id, 0);
+	set_sci_style(sci, SCE_TXT2TAGS_DEFAULT, ft_id, 0);
+	set_sci_style(sci, SCE_TXT2TAGS_LINE_BEGIN, ft_id, 0);
+	set_sci_style(sci, SCE_TXT2TAGS_PRECHAR, ft_id, 0);
+	set_sci_style(sci, SCE_TXT2TAGS_STRONG1, ft_id, 1);
+	set_sci_style(sci, SCE_TXT2TAGS_STRONG2, ft_id, 1);
+	set_sci_style(sci, SCE_TXT2TAGS_EM1, ft_id, 2);
+	set_sci_style(sci, SCE_TXT2TAGS_EM2, ft_id, 17);
+	set_sci_style(sci, SCE_TXT2TAGS_HEADER1, ft_id, 3);
+	set_sci_style(sci, SCE_TXT2TAGS_HEADER2, ft_id, 4);
+	set_sci_style(sci, SCE_TXT2TAGS_HEADER3, ft_id, 5);
+	set_sci_style(sci, SCE_TXT2TAGS_HEADER4, ft_id, 6);
+	set_sci_style(sci, SCE_TXT2TAGS_HEADER5, ft_id, 7);
+	set_sci_style(sci, SCE_TXT2TAGS_HEADER6, ft_id, 8);
+	set_sci_style(sci, SCE_TXT2TAGS_ULIST_ITEM, ft_id, 9);
+	set_sci_style(sci, SCE_TXT2TAGS_OLIST_ITEM, ft_id, 10);
+	set_sci_style(sci, SCE_TXT2TAGS_BLOCKQUOTE, ft_id, 11);
+	set_sci_style(sci, SCE_TXT2TAGS_STRIKEOUT, ft_id, 12);
+	set_sci_style(sci, SCE_TXT2TAGS_HRULE, ft_id, 13);
+	set_sci_style(sci, SCE_TXT2TAGS_LINK, ft_id, 14);
+	set_sci_style(sci, SCE_TXT2TAGS_CODE, ft_id, 15);
+	set_sci_style(sci, SCE_TXT2TAGS_CODE2, ft_id, 15);
+	set_sci_style(sci, SCE_TXT2TAGS_CODEBK, ft_id, 16);
+	set_sci_style(sci, SCE_TXT2TAGS_COMMENT, ft_id, 18);
+	set_sci_style(sci, SCE_TXT2TAGS_OPTION, ft_id, 19);
+	set_sci_style(sci, SCE_TXT2TAGS_PREPROC, ft_id, 20);
+	set_sci_style(sci, SCE_TXT2TAGS_POSTPROC, ft_id, 21);
+}
+
+
 static void styleset_matlab_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
 {
 	new_styleset(ft_id, 9);
@@ -3193,6 +3257,7 @@
 		init_styleset_case(GEANY_FILETYPES_SH,		styleset_sh_init);
 		init_styleset_case(GEANY_FILETYPES_SQL,		styleset_sql_init);
 		init_styleset_case(GEANY_FILETYPES_TCL,		styleset_tcl_init);
+		init_styleset_case(GEANY_FILETYPES_TXT2TAGS, styleset_txt2tags_init);
 		init_styleset_case(GEANY_FILETYPES_VHDL,	styleset_vhdl_init);
 		init_styleset_case(GEANY_FILETYPES_VERILOG,	styleset_verilog_init);
 		init_styleset_case(GEANY_FILETYPES_XML,		styleset_markup_init);
@@ -3261,6 +3326,7 @@
 		styleset_case(GEANY_FILETYPES_SH,		styleset_sh);
 		styleset_case(GEANY_FILETYPES_SQL,		styleset_sql);
 		styleset_case(GEANY_FILETYPES_TCL,		styleset_tcl);
+		styleset_case(GEANY_FILETYPES_TXT2TAGS,	styleset_txt2tags);
 		styleset_case(GEANY_FILETYPES_VHDL,		styleset_vhdl);
 		styleset_case(GEANY_FILETYPES_VERILOG,	styleset_verilog);
 		styleset_case(GEANY_FILETYPES_XML,		styleset_xml);

Modified: trunk/wscript
===================================================================
--- trunk/wscript	2010-08-21 09:07:46 UTC (rev 5187)
+++ trunk/wscript	2010-08-23 12:14:58 UTC (rev 5188)
@@ -92,8 +92,8 @@
 	'scintilla/LexLua.cxx', 'scintilla/LexMarkdown.cxx', 'scintilla/LexMatlab.cxx',
 	'scintilla/LexNsis.cxx', 'scintilla/LexOthers.cxx',
 	'scintilla/LexPascal.cxx', 'scintilla/LexPerl.cxx', 'scintilla/LexPython.cxx',
-	'scintilla/LexR.cxx',
-	'scintilla/LexRuby.cxx', 'scintilla/LexSQL.cxx', 'scintilla/LexTCL.cxx',
+	'scintilla/LexR.cxx', 'scintilla/LexRuby.cxx', 'scintilla/LexSQL.cxx',
+	'scintilla/LexTCL.cxx', 'scintilla/LexTxt2tags.cxx',
 	'scintilla/LexVHDL.cxx', 'scintilla/LexVerilog.cxx', 'scintilla/LexYAML.cxx',
 	'scintilla/LineMarker.cxx', 'scintilla/PerLine.cxx',
 	'scintilla/PlatGTK.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