qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs extra-modes.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs extra-modes.c
Date: Tue, 13 Jun 2017 01:27:56 -0400 (EDT)

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        17/06/13 01:27:56

Modified files:
        .              : extra-modes.c 

Log message:
        lua-mode: small fixes in colorizer
        - fix number parsing
        - support function call syntax for single string or object literal
          without parentheses

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/extra-modes.c?cvsroot=qemacs&r1=1.66&r2=1.67

Patches:
Index: extra-modes.c
===================================================================
RCS file: /sources/qemacs/qemacs/extra-modes.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- extra-modes.c       29 May 2017 06:21:42 -0000      1.66
+++ extra-modes.c       13 Jun 2017 05:27:55 -0000      1.67
@@ -1523,7 +1523,7 @@
 
 static char const lua_keywords[] = {
     "|and|break|do|else|elseif|end|false|for|function|goto|if|in"
-    "|local|nil|not|or|repeat|require|return|then|true|until|while"
+    "|local|nil|not|or|repeat|return|then|true|until|while"
     "|self"
     "|"
 };
@@ -1569,7 +1569,7 @@
 static void lua_colorize_line(QEColorizeContext *cp,
                               unsigned int *str, int n, ModeDef *syn)
 {
-    int i = 0, start = i, c, sep = 0, level = 0, level1, style;
+    int i = 0, j, start = i, c, sep = 0, level = 0, level1, style;
     int state = cp->colorize_state;
     char kbuf[64];
 
@@ -1656,7 +1656,7 @@
             if (qe_isdigit(c)) {
                 /* XXX: should parse actual number syntax */
                 for (; i < n; i++) {
-                    if (!qe_isalnum(str[i] && str[i] != '.'))
+                    if (!qe_isalnum(str[i]) && str[i] != '.')
                         break;
                 }
                 SET_COLOR(str, start, i, LUA_STYLE_NUMBER);
@@ -1668,7 +1668,11 @@
                     SET_COLOR(str, start, i, LUA_STYLE_KEYWORD);
                     continue;
                 }
-                if (check_fcall(str, i)) {
+                for (j = i; j < n && qe_isspace(str[j]); j++)
+                    continue;
+                /* function calls use parenthesized argument list or
+                   single string or table literal */
+                if (qe_findchar("('\"{", str[j])) {
                     SET_COLOR(str, start, i, LUA_STYLE_FUNCTION);
                     continue;
                 }



reply via email to

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