qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs qe.h clang.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs qe.h clang.c
Date: Mon, 19 May 2014 19:11:44 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        14/05/19 19:11:44

Modified files:
        .              : qe.h clang.c 

Log message:
        add colorizer for Dart

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.172&r2=1.173
http://cvs.savannah.gnu.org/viewcvs/qemacs/clang.c?cvsroot=qemacs&r1=1.65&r2=1.66

Patches:
Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -b -r1.172 -r1.173
--- qe.h        18 May 2014 22:40:04 -0000      1.172
+++ qe.h        19 May 2014 19:11:43 -0000      1.173
@@ -1982,6 +1982,7 @@
     CLANG_ICI,
     CLANG_JSX,
     CLANG_HAXE,
+    CLANG_DART,
     CLANG_FLAVOR = 0x1F,
 };
 

Index: clang.c
===================================================================
RCS file: /sources/qemacs/qemacs/clang.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -b -r1.65 -r1.66
--- clang.c     18 May 2014 22:40:05 -0000      1.65
+++ clang.c     19 May 2014 19:11:44 -0000      1.66
@@ -77,16 +77,19 @@
 };
 
 static const char java_keywords[] = {
-    "abstract|assert|break|byte|case|catch|class|const|continue|"
-    "default|do|extends|false|final|finally|for|function|"
+    "abstract|assert|break|case|catch|class|const|continue|"
+    "default|do|else|extends|false|final|finally|for|function|"
     "if|implements|import|in|instanceof|interface|native|new|null|"
     "package|private|protected|public|return|"
     "static|super|switch|synchronized|"
     "this|throw|throws|transient|true|try|var|while|with|"
+    "@Override|@SuppressWarnings|@Deprecated|"
 };
 
 static const char java_types[] = {
-    "boolean|byte|char|double|float|int|long|short|void|String|"
+    "boolean|byte|char|double|float|int|long|short|void|"
+    "String|Object|List|Set|Exception|Thread|Class|HashMap|Integer|"
+    "Collection|Block|"
 };
 
 static const char css_keywords[] = {
@@ -285,6 +288,25 @@
     "auto|"
 };
 
+static const char dart_keywords[] = {
+    "abstract|as|assert|break|call|case|catch|class|const|continue|default|do|"
+    "else|equals|extends|external|factory|false|final|finally|for|"
+    "get|if|implements|in|interface|is|negate|new|null|on|operator|return|"
+    "set|show|static|super|switch|this|throw|true|try|typedef|while|"
+    // should match only at line start
+    "import|include|source|library|"
+    "@observable|@published|@override|@runTest|"
+    // XXX: should colorize is! as a keyword
+};
+
+static const char dart_types[] = {
+    "bool|double|dynamic|int|num|var|void|"
+    
"String|StringBuffer|Object|RegExp|Date|DateTime|TimeZone|Duration|Stopwatch|DartType|"
+    "Collection|Comparable|Completer|Function|Future|Match|Options|Pattern|"
+    "HashMap|HashSet|Iterable|Iterator|LinkedHashMap|List|Map|Queue|Set|"
+    "Dynamic|Exception|Error|AssertionError|TypeError|FallThroughError|" 
+};
+
 struct QEModeFlavor {
     const char *keywords;
     const char *types;
@@ -308,6 +330,7 @@
     { ici_keywords,      ici_types },      /* CLANG_ICI */
     { jsx_keywords,      jsx_types },      /* CLANG_JSX */
     { haxe_keywords,     haxe_types },     /* CLANG_HAXE */
+    { dart_keywords,     dart_types },     /* CLANG_DART */
 };
 
 static const char c_mode_extensions[] = {
@@ -322,6 +345,7 @@
     "jav|java|"         /* Java */
     "jsx|"              /* JSX (extended Javascript) */
     "hx|"               /* Haxe (extended Javascript) */
+    "dart|"             /* Dart (extended Javascript) */
     "go|"               /* Go language */
     "d|di|"             /* D language */
     "cyc|cyl|cys|"      /* Cyclone language */
@@ -647,6 +671,7 @@
             style1 = C_STYLE_STRING;
             delim = '\"';
         string:
+            // XXX: should handle triple quoted strings (Dart)
             style = style1;
             while (i < n) {
                 c = str[i++];
@@ -1350,6 +1375,10 @@
         s->mode_name = "Haxe";
         s->mode_flags = CLANG_HAXE | CLANG_REGEX;
     } else
+    if (match_extension(base, "dart")) {
+        s->mode_name = "Dart";
+        s->mode_flags = CLANG_DART;
+    } else
     if (match_extension(base, "go")) {
         s->mode_name = "Go";
         s->mode_flags = CLANG_GO;



reply via email to

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