SF.net SVN: geany:[4747] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Tue Mar 9 17:07:54 UTC 2010


Revision: 4747
          http://geany.svn.sourceforge.net/geany/?rev=4747&view=rev
Author:   ntrel
Date:     2010-03-09 17:07:53 +0000 (Tue, 09 Mar 2010)

Log Message:
-----------
Backport minor formatting/style changes from Scintilla project.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/scintilla/LexMarkdown.cxx

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-03-09 16:56:04 UTC (rev 4746)
+++ trunk/ChangeLog	2010-03-09 17:07:53 UTC (rev 4747)
@@ -14,6 +14,8 @@
  - code:
    Add argument to utils_str_replace_escape() for keeping
    uninterpreted backslash escapes e.g. '\\', '\e'.
+ * scintilla/LexMarkdown.cxx:
+   Backport minor formatting/style changes from Scintilla project.
 
 
 2010-03-09  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/scintilla/LexMarkdown.cxx
===================================================================
--- trunk/scintilla/LexMarkdown.cxx	2010-03-09 16:56:04 UTC (rev 4746)
+++ trunk/scintilla/LexMarkdown.cxx	2010-03-09 17:07:53 UTC (rev 4747)
@@ -18,8 +18,7 @@
  *  there is a following blank line issue that can't be ignored, 
  *  explained in the next paragraph. Embedded HTML and code 
  *  blocks would be better supported with language specific 
- *  highlighting; something Scintilla isn't really architected 
- *  to support yet.
+ *  highlighting.
  * 
  *  The highlighting aims to accurately reflect correct syntax,
  *  but a few restrictions are relaxed. Delimited code blocks are
@@ -30,8 +29,8 @@
  * 
  *  Written by Jon Strait - jstrait at moonloop.net
  *
- *   This source code is released for free distribution under the
- *   terms of the GNU General Public License.
+ *  The License.txt file describes the conditions under which this
+ *  software may be distributed.
  *
  *****************************************************************/
 
@@ -59,8 +58,8 @@
 }
 
 // True if can follow ch down to the end with possibly trailing whitespace
-static bool FollowToLineEnd(const int ch, const int state, const int endPos, StyleContext &sc) {
-    int i = 0;
+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
@@ -78,13 +77,12 @@
 // 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) {
-    int i = 0;
     sc.SetState(state);
     sc.Forward(length);
     sc.SetState(SCE_MARKDOWN_DEFAULT);
     sc.Forward();
+    bool started = false;
     while (sc.More() && !IsNewline(sc.ch)) {
-        bool started = false;
         if (sc.ch == token && !started) {
             sc.SetState(state);
             started = true;
@@ -113,8 +111,9 @@
     return false;
 }
 
-static bool IsValidHrule(const int endPos, StyleContext &sc) {
-    int c, i = 0, count = 1;
+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) 
@@ -131,35 +130,17 @@
             }
             else {
                 sc.SetState(SCE_MARKDOWN_DEFAULT);
-                return false;
+		return false;
             }
         }
     }
+    return false;
 }
 
-// Only consume if already valid.  Doesn't work for delimiting multiple lines.
-static void ConsumeEnd(const int state, const int origPos, const int endPos, 
-        const char *token, StyleContext &sc) {
-    int targetPos;
-    while (sc.currentPos + 1 < endPos) {
-        sc.Forward();
-        if (sc.Match(token) && sc.chPrev != '\\' && sc.chPrev != ' ') {
-            targetPos = sc.currentPos + strlen(token);
-            sc.currentPos = origPos;
-            sc.SetState(state);
-            sc.Forward(targetPos - origPos);
-            sc.SetState(SCE_MARKDOWN_DEFAULT);
-            break;
-        }
-    }
-}
-
 static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle,
-                               WordList *keywordlists[], Accessor &styler) {
-
-    int digitCount = 0;
-    int endPos = startPos + length;
-    int precharCount;
+                               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.
@@ -330,7 +311,7 @@
             }
             // Ordered list
             else if (IsADigit(sc.ch)) {
-                digitCount = 0;
+                int digitCount = 0;
                 while (IsADigit(sc.GetRelative(++digitCount)))
                     ;
                 if (sc.GetRelative(digitCount) == '.' && 
@@ -354,7 +335,6 @@
         
         // New state anywhere in doc
         if (sc.state == SCE_MARKDOWN_DEFAULT) {
-            int origPos = sc.currentPos;
             if (sc.atLineStart && sc.ch == '#') {
                 sc.SetState(SCE_MARKDOWN_LINE_BEGIN);
                 freezeCursor = true;
@@ -430,4 +410,3 @@
 }
 
 LexerModule lmMarkdown(SCLEX_MARKDOWN, ColorizeMarkdownDoc, "markdown");
-


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