qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs TODO.org clang.c extra-modes.c makemode....


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs TODO.org clang.c extra-modes.c makemode....
Date: Sun, 05 Apr 2015 15:10:06 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        15/04/05 15:10:06

Modified files:
        .              : TODO.org clang.c extra-modes.c makemode.c qe.c 
        tests          : NonBMP1.utf8 

Log message:
        added language coloring for Neko and NekoML
        
        - added language coloring for Neko and NekoML
        - improved Makefile parsing and coloring

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/TODO.org?cvsroot=qemacs&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/qemacs/clang.c?cvsroot=qemacs&r1=1.79&r2=1.80
http://cvs.savannah.gnu.org/viewcvs/qemacs/extra-modes.c?cvsroot=qemacs&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/qemacs/makemode.c?cvsroot=qemacs&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.185&r2=1.186
http://cvs.savannah.gnu.org/viewcvs/qemacs/tests/NonBMP1.utf8?cvsroot=qemacs&r1=1.1&r2=1.2

Patches:
Index: TODO.org
===================================================================
RCS file: /sources/qemacs/qemacs/TODO.org,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- TODO.org    24 Apr 2014 22:07:02 -0000      1.5
+++ TODO.org    5 Apr 2015 15:10:01 -0000       1.6
@@ -5,6 +5,12 @@
 
 * Needed for release version 5
 
+** test 
/Users/ogu/Applications/AirspaceApps/CyberScienceMotion.app/Contents/Data/Managed/etc/mono/1.0/DefaultWsdlHelpGenerator.aspx
+** crash on tests/dartIdl.json (overlong line)
+** crash on /Users/ogu/comp/lang/pike/pike/refdoc/template.xsl
+   
+** new flavor for GoogleClosureCompiler
+
 ** basic: indent-rigidly
 ** basic: minibuffer completion -> bad return on C-x C-f . SPC qe SPC RET
 ** basic: scripting
@@ -21,11 +27,11 @@
 ** doc: move doc and TODO to markdown format
 ** doc: rewrite TODO file with more sections and explanations
 ** files: minibuffer-electric-yank in minibuffer to fix pathname
+** files: minibuffer input ~ should not kill http: prefix
 ** files: check file date to detect asynchronous modifications on disk
 ** files: fix s->offset reset to 0 upon C-x C-f newfile ENT C-x 2 C-x b ENT
 ** files: insert-file: load via separate buffer with charset conversion
 ** files: reload-file on C-x C-r
-** html: fix scoring for xml / html / htmlsrc
 ** html-src/xml: fix colorizer for multi-line tags and attributes
 ** modes: header-line format
 ** modes: mode-line format
@@ -42,6 +48,7 @@
 ** shell: yank at shell prompt
 ** undo: undo should handle sequence of undo records upto tagged start.
 ** x11: handle X11 window manager close window event and exit cleanly
+** html: DONE fix scoring for xml / html / htmlsrc
 ** DONE basic: indent-region
 ** DONE basic: untabify-region, untabify-buffer
 ** DONE basic: indent on TAB according to indent-width and indent-with-tabs
@@ -256,7 +263,7 @@
 ** fix terminal size inside shell window ?
 ** cmdline arg to force lines and columns to test shell.
 ** toggling interactive shell mode is not automatic enough
-** man pager -> more bindings
+** man pager -> more bindings, such as RET -> push-button (jump to map page)
 ** accented letter input in shell mode
 ** transcode between tty charset and shell buffer charset
 ** track unsupported escapes in shell buffer
@@ -318,8 +325,11 @@
 ** mode for undo buffers
 ** visual-diff-mode -> Use color-coding to compare two buffers.
 ** improve existing language modes:
+*** html-mode: support hex entities
+*** calc-mode: fix syntax, disable C++ comments
 *** asm-mode -> Assembly Language files.
 *** haskell-mode ->
+*** julia-mode ->
 *** lisp-mode -> Lisp language
 *** lua-mode ->
 *** makefile-mode -> Gnu and other makefiles.
@@ -332,8 +342,13 @@
 *** ruby-mode ->
 *** scheme-mode ->
 *** sh-mode -> shell script files
+Handle here documents
+Handle multiline strings
 *** sql-mode ->
 *** vbasic-mode -> Visual Basic.
+*** css-mode -> CSS files.
+*** fcl-mode ->
+*** forth-mode ->
 ** missing languages:
 *** ada-mode -> Ada
 *** asp-mode -> 
@@ -348,7 +363,6 @@
 *** cmake-mode ->
 *** cobol-mode ->
 *** conf-mode -> configuration files.
-*** css-mode -> CSS files.
 *** cuda-mode ->
 *** DCL mode
 *** def-mode ->
@@ -363,8 +377,6 @@
 *** eiffel-mode ->
 *** erlang-mode ->
 *** exelis-mode ->
-*** fcl-mode ->
-*** forth-mode ->
 *** fortran-mode ->
 *** fsharp-mode ->
 *** gams-mode -> GAMS files.
@@ -375,7 +387,6 @@
 *** imagej-mode ->
 *** ini-mode -> Windows .ini files.
 *** j-mode ->
-*** julia-mode ->
 *** language-mode ->
 *** libtool-mode ->
 *** literate-mode ->

Index: clang.c
===================================================================
RCS file: /sources/qemacs/qemacs/clang.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -b -r1.79 -r1.80
--- clang.c     9 Aug 2014 17:21:59 -0000       1.79
+++ clang.c     5 Apr 2015 15:10:02 -0000       1.80
@@ -51,8 +51,10 @@
     CLANG_ELASTIC,
     CLANG_JED,
     CLANG_CSL,  /* Peter Koch's CSL C Scripting Language */
+    CLANG_NEKO,
+    CLANG_NML,
     CLANG_SWIFT,
-    CLANG_FLAVOR = 0x1F,
+    CLANG_FLAVOR = 0x3F,
 };
 
 /* C mode options */
@@ -438,9 +440,30 @@
 };
 
 static const char csl_types[] = {
+    "var|void|string|int|"
+};
+
+static const char neko_keywords[] = {
+    "function|if|else|return|while|do|switch|default|"
+    "try|catch|break|continue|"
+    "this|null|true|false|"
+};
+
+static const char neko_types[] = {
     "var|"
 };
 
+static const char nml_keywords[] = {
+    "function|rec|if|then|else|return|while|do|switch|default|"
+    "try|catch|break|continue|when|"
+    "this|null|true|false|or|and|xor|"
+    "match|type|exception|throw|mutable|list|"
+};
+
+static const char nml_types[] = {
+    "var|int|float|string|bool|char|void|"
+};
+
 static const char c_extensions[] = {
     "c|h|i|C|H|I|"      /* C language */
     /* Other C flavors */
@@ -1861,6 +1884,32 @@
     .fallback = &c_mode,
 };
 
+ModeDef neko_mode = {
+    .name = "Neko",
+    .extensions = "neko",
+    .shell_handlers = NULL,
+    .colorize_func = c_colorize_line,
+    .colorize_flags = CLANG_NEKO,
+    .keywords = neko_keywords,
+    .types = neko_types,
+    .indent_func = c_indent_line,
+    .auto_indent = 1,
+    .fallback = &c_mode,
+};
+
+ModeDef nml_mode = {
+    .name = "NekoML",
+    .extensions = "nml",
+    .shell_handlers = NULL,
+    .colorize_func = c_colorize_line,
+    .colorize_flags = CLANG_NML,
+    .keywords = nml_keywords,
+    .types = nml_types,
+    .indent_func = c_indent_line,
+    .auto_indent = 1,
+    .fallback = &c_mode,
+};
+
 #include "swift.c"
 
 static int c_init(void)
@@ -1903,6 +1952,8 @@
     qe_register_mode(&ec_mode, MODEF_SYNTAX);
     qe_register_mode(&sl_mode, MODEF_SYNTAX);
     qe_register_mode(&csl_mode, MODEF_SYNTAX);
+    qe_register_mode(&neko_mode, MODEF_SYNTAX);
+    qe_register_mode(&nml_mode, MODEF_SYNTAX);
     swift_init();
 
     return 0;

Index: extra-modes.c
===================================================================
RCS file: /sources/qemacs/qemacs/extra-modes.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- extra-modes.c       8 Jun 2014 10:56:59 -0000       1.30
+++ extra-modes.c       5 Apr 2015 15:10:02 -0000       1.31
@@ -1612,6 +1612,7 @@
                             (level & IN_LUA_LEVEL);
                     goto parse_longlit;
                 }
+                i = n;
                 SET_COLOR(str, start, i, LUA_STYLE_COMMENT);
                 continue;
             }

Index: makemode.c
===================================================================
RCS file: /sources/qemacs/qemacs/makemode.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- makemode.c  1 Jun 2014 18:01:50 -0000       1.23
+++ makemode.c  5 Apr 2015 15:10:02 -0000       1.24
@@ -50,6 +50,7 @@
     MAKEFILE_STYLE_STRING     = QE_STYLE_STRING,
     MAKEFILE_STYLE_PREPROCESS = QE_STYLE_PREPROCESS,
     MAKEFILE_STYLE_TARGET     = QE_STYLE_FUNCTION,
+    MAKEFILE_STYLE_FUNCTION   = QE_STYLE_FUNCTION,
     MAKEFILE_STYLE_VARIABLE   = QE_STYLE_VARIABLE,
     MAKEFILE_STYLE_MACRO      = QE_STYLE_TYPE,
 };
@@ -58,9 +59,10 @@
                                    unsigned int *str, int n, ModeDef *syn)
 {
     char buf[32];
-    int i = 0, j = i, level;
+    int i = 0, start = i, bol = 1, from = 0, level, style;
+    unsigned int c;
 
-    if (qe_isalnum_(str[i])) {
+    if (qe_isalpha_(str[i])) {
         get_word_lc(buf, countof(buf), str);
         if (strfind("ifeq|ifneq|ifdef|ifndef|include|else|endif", buf))
             goto preprocess;
@@ -69,86 +71,85 @@
         goto preprocess;
 
     while (i < n) {
-        switch (str[i]) {
+        start = i;
+        c = str[i++];
+        switch (c) {
         case '$':
-            i += 1;
-            j = i + 1;
+            style = MAKEFILE_STYLE_MACRO;
             if (str[i] == '(') {
-                i += 1;
                 level = 1;
-                for (j = i; j < n; j++) {
-                    if (str[j] == '(')
+                for (i += 1; i < n; i++) {
+                    if (str[i] == '(')
                         level++;
-                    if (str[j] == ')' && --level <= 0)
+                    if (str[i] == ')' && --level <= 0)
                         break;
-                    if (str[j] == ' ' || str[j] == '$') {
+                    if (str[i] == ' ' || str[i] == '$') {
                         /* should have function color */
-                        j = i;
-                        break;
                     }
                 }
+                from = i + 1;
+                SET_COLOR(str, start + 2, i, style);
+                continue;
             }
-            if (i < j)
-                SET_COLOR(str, i, j, MAKEFILE_STYLE_MACRO);
-            i = j;
+            /* Should colorize non parenthesized macro */
             continue;
         case ' ':
         case '\t':
-            if (i == 0)
-                j = 1;
+            if (start == 0)
+                bol = 0;
             break;
         case '+':
-            if (!j && str[i+1] == '=')
+        case '?':
+            if (bol && str[i] == '=')
                 goto variable;
+            break;
         case ':':
-            if (j)
+            if (!bol)
                 break;
-            if (str[i+1] == '=')
+            if (str[i] == '=')
                 goto variable;
-            SET_COLOR(str, j, i, MAKEFILE_STYLE_TARGET);
+            SET_COLOR(str, from, i - 1, MAKEFILE_STYLE_TARGET);
+            bol = 0;
             break;
         case '=':
-            if (j)
+            if (!bol)
                 break;
         variable:
-            SET_COLOR(str, j, i, MAKEFILE_STYLE_VARIABLE);
+            SET_COLOR(str, from, i - 1, MAKEFILE_STYLE_VARIABLE);
+            bol = 0;
             break;
         case '#':
-            if (i > 0 && str[i - 1] == '\\')
+            if (i > 1 && str[i - 2] == '\\')
                 break;
-            SET_COLOR(str, i, n, MAKEFILE_STYLE_COMMENT);
             i = n;
+            SET_COLOR(str, start, i, MAKEFILE_STYLE_COMMENT);
             continue;
         case '!':
             /*          case '.':*/
-            if (i > 0)
+            if (start > 0)
                 break;
         preprocess:
             /* scan for comment */
-            for (j = i + 1; j < n; j++) {
-                if (str[j] == '#')
+            for (; i < n; i++) {
+                if (str[i] == '#')
                     break;
             }
-            SET_COLOR(str, i, j, MAKEFILE_STYLE_PREPROCESS);
-            i = j;
+            SET_COLOR(str, start, i, MAKEFILE_STYLE_PREPROCESS);
             continue;
         case '\'':
         case '`':
         case '"':
             /* parse string const */
-            for (j = i + 1; j < n; j++) {
-                if (str[j] == str[i]) {
-                    j++;
+            while (i < n) {
+                if (str[i++] == c) {
                     break;
                 }
             }
-            SET_COLOR(str, i, j, MAKEFILE_STYLE_STRING);
-            i = j;
+            SET_COLOR(str, start, i, MAKEFILE_STYLE_STRING);
             continue;
         default:
             break;
         }
-        i++;
     }
 }
 

Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -b -r1.185 -r1.186
--- qe.c        9 Aug 2014 17:42:15 -0000       1.185
+++ qe.c        5 Apr 2015 15:10:03 -0000       1.186
@@ -6779,7 +6779,7 @@
 void do_doctor(EditState *s)
 {
     /* Should show keys? */
-    put_status(s, "Hello, how are you ?");
+    put_status(s, "Hello, how are you?");
 }
 
 static int get_line_height(QEditScreen *screen, int style_index)

Index: tests/NonBMP1.utf8
===================================================================
RCS file: /sources/qemacs/qemacs/tests/NonBMP1.utf8,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- tests/NonBMP1.utf8  15 Mar 2014 14:55:05 -0000      1.1
+++ tests/NonBMP1.utf8  5 Apr 2015 15:10:05 -0000       1.2
@@ -1,5 +1,5 @@
 ************ Non BMP1 characters ****************
-𐀀𐀁𐀂𐀃🿿
+𐀀𐀁𐀂𐀃🿿𐁁
 𐀀𠀀񀀀򀀀󿿿
 ô€€€õ€€€ö€€€÷€€€÷¿¿¿
 øˆ€€€ø€€€ø €€€ø¿¿¿¿



reply via email to

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