qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs arm.c clang.c forth.c lisp.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs arm.c clang.c forth.c lisp.c
Date: Sun, 01 Jun 2014 18:03:55 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        14/06/01 18:03:55

Modified files:
        .              : arm.c clang.c forth.c lisp.c 

Log message:
        simplify colorizers: syn is never NULL

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/arm.c?cvsroot=qemacs&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qemacs/clang.c?cvsroot=qemacs&r1=1.75&r2=1.76
http://cvs.savannah.gnu.org/viewcvs/qemacs/forth.c?cvsroot=qemacs&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qemacs/lisp.c?cvsroot=qemacs&r1=1.19&r2=1.20

Patches:
Index: arm.c
===================================================================
RCS file: /sources/qemacs/qemacs/arm.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- arm.c       30 May 2014 19:59:42 -0000      1.1
+++ arm.c       1 Jun 2014 18:03:54 -0000       1.2
@@ -142,7 +142,7 @@
                 SET_COLOR(str, start, i, ASM_STYLE_OPCODE);
                 continue;
             }
-            if (syn && syn->keywords && strfind(syn->keywords, keyword)) {
+            if (strfind(syn->keywords, keyword)) {
                 SET_COLOR(str, start, i, ASM_STYLE_REGISTER);
                 continue;
             }
@@ -259,7 +259,7 @@
                             keyword[len++] = str[i];
                     }
                     keyword[len] = '\0';
-                    if (syn && syn->keywords && strfind(syn->keywords, 
keyword))
+                    if (strfind(syn->keywords, keyword))
                         SET_COLOR(str, start, i, LST_STYLE_KEYWORD);
                     continue;
                 }

Index: clang.c
===================================================================
RCS file: /sources/qemacs/qemacs/clang.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -b -r1.75 -r1.76
--- clang.c     30 May 2014 22:57:34 -0000      1.75
+++ clang.c     1 Jun 2014 18:03:54 -0000       1.76
@@ -86,13 +86,14 @@
     "@class|@interface|@implementation|@public|@private|@protected|"
     "@try|@catch|@throw|@finally|@end|@protocol|@selector|@synchronized|"
     "@encode|@defs|@optional|@required|@property|@dynamic|@synthesize|"
+    "@compatibility_alias|"
     // context sensitive keywords
     "in|out|inout|bycopy|byref|oneway|"
     "getter|setter|readwrite|readonly|assign|retain|copy|nonatomic|"
 };
 
 static const char objc_types[] = {
-    "id|BOOL|SEL|"
+    "id|BOOL|SEL|Class|Object|"
 };
 
 static const char csharp_keywords[] = {
@@ -491,17 +492,13 @@
 static void c_colorize_line(QEColorizeContext *cp,
                             unsigned int *str, int n, ModeDef *syn)
 {
-    const char *keywords = NULL;
-    const char *types = NULL;
     int i = 0, start, i1, i2, indent, level;
     int c, state, style, style0, style1, type_decl, klen, delim, flavor;
     int mode_flags;
     char kbuf[32];
 
-    mode_flags = syn ? syn->colorize_flags : 0;
+    mode_flags = syn->colorize_flags;
     flavor = (mode_flags & CLANG_FLAVOR);
-    keywords = syn ? syn->keywords : NULL;
-    types = syn ? syn->types : NULL;
 
     for (indent = 0; qe_isspace(str[indent]); indent++)
         continue;
@@ -809,7 +806,7 @@
                 klen = get_c_identifier(kbuf, countof(kbuf), str + start, 
flavor);
                 i = start + klen;
 
-                if ((keywords && strfind(keywords, kbuf))
+                if (strfind(syn->keywords, kbuf)
                 ||  ((mode_flags & CLANG_CC) && strfind(c_keywords, kbuf))
                 ||  ((flavor == CLANG_CSS) && str[i] == ':')
                    ) {
@@ -826,7 +823,7 @@
 
                 if ((start == 0 || str[start - 1] != '.')
                 &&  (!qe_findchar(".(:", str[i]) || flavor == CLANG_PIKE)
-                &&  ((types && strfind(types, kbuf))
+                &&  (strfind(syn->types, kbuf)
                 ||   ((mode_flags & CLANG_CC) && strfind(c_types, kbuf))
                 ||   (((mode_flags & CLANG_CC) || (flavor == CLANG_D)) &&
                      strend(kbuf, "_t", NULL))

Index: forth.c
===================================================================
RCS file: /sources/qemacs/qemacs/forth.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- forth.c     30 May 2014 17:53:18 -0000      1.1
+++ forth.c     1 Jun 2014 18:03:54 -0000       1.2
@@ -270,7 +270,6 @@
         if (word[len - 1] == '\"')
             goto has_string;
 
-        if (syn && syn->keywords) {
             if (!strcmp("|`", word) || strfind(syn->keywords, word)) {
                 SET_COLOR(str, start, i, FF_STYLE_KEYWORD);
                 continue;
@@ -283,7 +282,6 @@
                     continue;
                 }
             }
-        }
         numlen = len;
         if (numlen > 1 && qe_findchar("|&^+-*/%~,", word[numlen - 1]))
             word[--numlen] = '\0';

Index: lisp.c
===================================================================
RCS file: /sources/qemacs/qemacs/lisp.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- lisp.c      30 May 2014 22:57:34 -0000      1.19
+++ lisp.c      1 Jun 2014 18:03:55 -0000       1.20
@@ -124,9 +124,7 @@
 {
     int colstate = cp->colorize_state;
     int i = 0, start = i, len, level, style, has_expr;
-    int mode_flags = syn ? syn->colorize_flags : 0;
-    const char *keywords = syn && syn->keywords ? syn->keywords : 
lisp_keywords;
-    const char *types = syn && syn->types ? syn->types : lisp_types;
+    int mode_flags = syn->colorize_flags;
     char kbuf[32];
 
     level = colstate & IN_LISP_LEVEL;
@@ -316,11 +314,11 @@
                     SET_COLOR(str, start, i, LISP_STYLE_NUMBER);
                     continue;
                 }
-                if (strfind(keywords, kbuf)) {
+                if (strfind(syn->keywords, kbuf)) {
                     SET_COLOR(str, start, i, LISP_STYLE_KEYWORD);
                     continue;
                 }
-                if (strfind(types, kbuf)) {
+                if (strfind(syn->types, kbuf)) {
                     SET_COLOR(str, start, i, LISP_STYLE_TYPE);
                     continue;
                 }



reply via email to

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