qemacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemacs-commit] qemacs extra-modes.c groovy.c icon.c qe.h swift.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs extra-modes.c groovy.c icon.c qe.h swift.c
Date: Fri, 07 Aug 2015 16:45:11 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        15/08/07 16:45:11

Modified files:
        .              : extra-modes.c groovy.c icon.c qe.h swift.c 

Log message:
        factorized check_fcall(), simplified some colorizers

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/extra-modes.c?cvsroot=qemacs&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/qemacs/groovy.c?cvsroot=qemacs&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qemacs/icon.c?cvsroot=qemacs&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.187&r2=1.188
http://cvs.savannah.gnu.org/viewcvs/qemacs/swift.c?cvsroot=qemacs&r1=1.2&r2=1.3

Patches:
Index: extra-modes.c
===================================================================
RCS file: /sources/qemacs/qemacs/extra-modes.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- extra-modes.c       4 Aug 2015 11:22:33 -0000       1.44
+++ extra-modes.c       7 Aug 2015 16:45:10 -0000       1.45
@@ -22,12 +22,6 @@
 
 #define MAX_KEYWORD_SIZE  16
 
-static int check_fcall(unsigned int *str, int i) {
-    while (str[i] == ' ')
-        i++;
-    return str[i] == '(';
-}
-        
 /*---------------- x86 Assembly language coloring ----------------*/
 
 static char const asm_prepkeywords1[] = {

Index: groovy.c
===================================================================
RCS file: /sources/qemacs/qemacs/groovy.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- groovy.c    7 Aug 2015 08:28:59 -0000       1.1
+++ groovy.c    7 Aug 2015 16:45:11 -0000       1.2
@@ -18,16 +18,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-static int check_fcall(unsigned int *str, int i) {
-    while (str[i] == ' ')
-        i++;
-    return str[i] == '(';
-}
-
-static inline int qe_match2(int c, int c1, int c2) {
-    return c == c1 || c == c2;
-}
-
 static const char groovy_keywords[] = {
     /* language specific keywords */
     "as|def|in|trait|"

Index: icon.c
===================================================================
RCS file: /sources/qemacs/qemacs/icon.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- icon.c      28 Jul 2015 19:03:23 -0000      1.1
+++ icon.c      7 Aug 2015 16:45:11 -0000       1.2
@@ -54,7 +54,7 @@
 static void icon_colorize_line(QEColorizeContext *cp,
                                unsigned int *str, int n, ModeDef *syn)
 {
-    int i, start, i1, indent, c, state, style, klen, delim;
+    int i, start, indent, c, state, style, klen, delim;
     char kbuf[32];
 
     for (i = 0; qe_isspace(str[i]); i++)
@@ -172,13 +172,7 @@
                     style = ICON_STYLE_KEYWORD;
                     break;
                 }
-
-                i1 = i;
-                while (qe_isblank(str[i1]))
-                    i1++;
-
-                if (str[i1] == '(') {
-                    /* function call */
+                if (check_fcall(str, i)) {
                     /* XXX: different styles for call and definition */
                     style = ICON_STYLE_FUNCTION;
                     break;

Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -b -r1.187 -r1.188
--- qe.h        19 Jun 2015 14:34:31 -0000      1.187
+++ qe.h        7 Aug 2015 16:45:11 -0000       1.188
@@ -319,6 +319,16 @@
     return -1;
 }
 
+static inline int qe_match2(int c, int c1, int c2) {
+    return c == c1 || c == c2;
+}
+
+static inline int check_fcall(const unsigned int *str, int i) {
+    while (str[i] == ' ')
+        i++;
+    return str[i] == '(';
+}
+
 int qe_strcollate(const char *s1, const char *s2);
 void qe_strtolower(char *buf, int buf_size, const char *str);
 void skip_spaces(const char **pp);

Index: swift.c
===================================================================
RCS file: /sources/qemacs/qemacs/swift.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- swift.c     19 Jun 2015 14:34:31 -0000      1.2
+++ swift.c     7 Aug 2015 16:45:11 -0000       1.3
@@ -179,7 +179,7 @@
 static void swift_colorize_line(QEColorizeContext *cp,
                                 unsigned int *str, int n, ModeDef *syn)
 {
-    int i = 0, start, i1, level;
+    int i = 0, start, level;
     int c, state, style, klen, flavor;
     int mode_flags;
     char kbuf[32];
@@ -279,21 +279,16 @@
                     SET_COLOR(str, start, i, C_STYLE_KEYWORD);
                     continue;
                 }
-                i1 = i;
-                if (qe_isblank(str[i1]))
-                    i1++;
-
                 if (strfind(syn->types, kbuf)) {
                     style = C_STYLE_TYPE;
-                    if (str[i1] == '(' && flavor != CLANG_PIKE) {
+                    if (check_fcall(str, i) && flavor != CLANG_PIKE) {
                         /* function style cast */
                         style = C_STYLE_KEYWORD;
                     }
                     SET_COLOR(str, start, i, style);
                     continue;
                 }
-                if (str[i1] == '(') {
-                    /* function call */
+                if (check_fcall(str, i)) {
                     SET_COLOR(str, start, i, C_STYLE_FUNCTION);
                     continue;
                 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]