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: Fri, 16 May 2014 07:37:47 +0000

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        14/05/16 07:37:46

Modified files:
        .              : qe.h clang.c 

Log message:
        added c-mode flavor for Actionscript

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.168&r2=1.169
http://cvs.savannah.gnu.org/viewcvs/qemacs/clang.c?cvsroot=qemacs&r1=1.61&r2=1.62

Patches:
Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -b -r1.168 -r1.169
--- qe.h        14 May 2014 21:24:56 -0000      1.168
+++ qe.h        16 May 2014 07:37:40 -0000      1.169
@@ -1958,24 +1958,27 @@
 /* clang.c */
 
 /* C mode flavors */
-#define CLANG_SYNTAX    0
-#define CLANG_C         1
-#define CLANG_CPP       2
-#define CLANG_OBJC      3
-#define CLANG_CSHARP    4
-#define CLANG_JS        5
-#define CLANG_JAVA      6
-#define CLANG_PHP       7
-#define CLANG_GO        8
-#define CLANG_D         9
-#define CLANG_LIMBO     10
-#define CLANG_CYCLONE   11
-#define CLANG_CH        12
-#define CLANG_SQUIRREL  13
-#define CLANG_ICI       14
-#define CLANG_JSX       15
-#define CLANG_HAXE      16
-#define CLANG_FLAVOR    0x1F
+enum {
+    CLANG_SYNTAX,
+    CLANG_C,
+    CLANG_CPP,
+    CLANG_OBJC,
+    CLANG_CSHARP,
+    CLANG_JS,
+    CLANG_AS,
+    CLANG_JAVA,
+    CLANG_PHP,
+    CLANG_GO,
+    CLANG_D,
+    CLANG_LIMBO,
+    CLANG_CYCLONE,
+    CLANG_CH,
+    CLANG_SQUIRREL,
+    CLANG_ICI,
+    CLANG_JSX,
+    CLANG_HAXE,
+    CLANG_FLAVOR = 0x1F,
+};
 
 /* C mode options */
 #define CLANG_CC          0x0100  /* all C language features */

Index: clang.c
===================================================================
RCS file: /sources/qemacs/qemacs/clang.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- clang.c     14 May 2014 21:24:56 -0000      1.61
+++ clang.c     16 May 2014 07:37:40 -0000      1.62
@@ -109,6 +109,25 @@
     "void|var|"
 };
 
+static const char as_keywords[] = {
+    "as|break|case|catch|class|continue|default|do|else|false|"
+    "finally|for|function|if|import|interface|internal|is|new|null|"
+    "package|private|protected|public|return|super|switch|this|throw|"
+    "true|try|while|"
+    // The following AS3 keywords are no longer in AS4:
+    "delete|include|instanceof|namespace|typeof|use|with|in|const|"
+    // other constants
+    "undefined|Infinity|NaN|"
+    // introduced in AS4 (spec abandoned in december 2012)
+    //"let|defer|get|set|override|native|extends|implements|"
+};
+
+static const char as_types[] = {
+    "void|var|bool|byte|int|uint|long|ulong|float|double|"
+    "Array|Boolean|Number|Object|String|Function|Event|RegExp|"
+    "Class|Interface|"
+};
+
 static const char jsx_keywords[] = {
     // literals shared with ECMA 262
     "null|true|false|NaN|Infinity|"
@@ -268,6 +287,7 @@
     { objc_keywords,     objc_types },     /* CLANG_OBJC */
     { csharp_keywords,   csharp_types },   /* CLANG_CSHARP */
     { js_keywords,       js_types },       /* CLANG_JS */
+    { as_keywords,       as_types },       /* CLANG_AS */
     { java_keywords,     java_types },     /* CLANG_JAVA */
     { php_keywords,      php_types },      /* CLANG_PHP */
     { go_keywords,       go_types },       /* CLANG_GO */
@@ -289,6 +309,7 @@
     "cs|"               /* C Sharp */
     "jav|java|"         /* Java */
     "js|json|"          /* Javascript, JSon */
+    "as|"               /* Actionscript */
     "jsx|"              /* JSX (extended Javascript) */
     "hx|"               /* Haxe (extended Javascript) */
     "go|"               /* Go language */
@@ -678,13 +699,15 @@
                 while (str[i2] == '*' || qe_isblank(str[i2]))
                     i2++;
 
-                if ((types && strfind(types, kbuf))
+                if ((start == 0 || str[start - 1] != '.')
+                &&  !qe_findchar(".(:", str[i])
+                &&  ((types && strfind(types, kbuf))
                 ||  ((mode_flags & CLANG_CC) && strfind(c_types, kbuf))
                 ||  (((mode_flags & CLANG_CC) || (flavor == CLANG_D)) &&
                      strend(kbuf, "_t", NULL))
                 ||  (flavor == CLANG_HAXE && qe_isupper(kbuf[0]) &&
-                     qe_islower(kbuf[1]) && !qe_findchar(".(:", str[i]) &&
-                     (start == 0 || !qe_findchar(".(", str[start - 1])))) {
+                     qe_islower(kbuf[1]) && 
+                     (start == 0 || !qe_findchar("(", str[start - 1]))))) {
                     /* if not cast, assume type declaration */
                     if (str[i2] != ')') {
                         type_decl = 1;
@@ -1295,6 +1318,10 @@
         s->mode_name = "Javascript";
         s->mode_flags = CLANG_JS | CLANG_REGEX;
     } else
+    if (match_extension(base, "as")) {
+        s->mode_name = "Actionscript";
+        s->mode_flags = CLANG_AS | CLANG_REGEX;
+    } else
     if (match_extension(base, "jsx")) {
         s->mode_name = "JSX";
         s->mode_flags = CLANG_JSX | CLANG_REGEX;



reply via email to

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