qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs clang.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs clang.c
Date: Sun, 7 May 2017 16:29:29 -0400 (EDT)

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        17/05/07 16:29:29

Modified files:
        .              : clang.c 

Log message:
        clang: add Game Monkey scripting language

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/clang.c?cvsroot=qemacs&r1=1.127&r2=1.128

Patches:
Index: clang.c
===================================================================
RCS file: /sources/qemacs/qemacs/clang.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -b -r1.127 -r1.128
--- clang.c     19 Apr 2017 08:14:31 -0000      1.127
+++ clang.c     7 May 2017 20:29:29 -0000       1.128
@@ -63,6 +63,7 @@
     CLANG_VALA,
     CLANG_PAWN,
     CLANG_CMINUS,
+    CLANG_GMSCRIPT,
     CLANG_RUST,
     CLANG_SWIFT,
     CLANG_ICON,
@@ -411,7 +412,7 @@
             delim = '\'';
             goto string;
         case '`':
-            if (flavor == CLANG_SCALA) {
+            if (flavor == CLANG_SCALA || flavor == CLANG_GMSCRIPT) {
                 /* scala quoted identifier */
                 while (i < n) {
                     c = str[i++];
@@ -2812,6 +2813,50 @@
     .fallback = &c_mode,
 };
 
+/*---------------- Game Monkey scripting language ----------------*/
+
+/* Simple C like syntax with some extensions:
+
+   c = "My " "house"; // creates the string 'My house'
+   d = `c:\windows\sys`; // d is a string
+   c = `Chris``s bike`; // creates the string 'Chris`s bike'
+   c = 2.4f // c is a float
+   a = 'BLCK'; // characters as four bytes making integer
+   a = 179; // decimal
+   a = 0xB3; // hexadecimal
+   a = 0b10110011; // binary
+   myRect = CreateRect(0, 0, 5, 10); // Construct a table that describes
+                                     // a rectangle
+   area = myRect.Area(); // myRect is automatically assigned to 'this'
+                         // within the area method.
+   Size = function() { return .width * .height; };
+   s = myRect:Size(); // Calls Size function passing 'myRect' as 'this'
+ */
+
+static const char gmscript_keywords[] = {
+    "if|else|for|while|foreach|in|and|or|function|"
+    "dowhile|break|continue|return|"
+    "array|table|global|local|member|this|"
+    "true|false|null|",
+};
+
+static const char gmscript_types[] = {
+    ""
+};
+
+static ModeDef gmscript_mode = {
+    .name = "Game Monkey",
+    .mode_name = "gmscript",
+    .extensions = "gm",
+    .colorize_func = c_colorize_line,
+    .colorize_flags = CLANG_GMSCRIPT,
+    .keywords = gmscript_keywords,
+    .types = gmscript_types,
+    .indent_func = c_indent_line,
+    .auto_indent = 1,
+    .fallback = &c_mode,
+};
+
 /*---------------- Other C based syntax modes ----------------*/
 
 #include "rust.c"
@@ -2875,6 +2920,7 @@
     qe_register_mode(&vala_mode, MODEF_SYNTAX);
     qe_register_mode(&pawn_mode, MODEF_SYNTAX);
     qe_register_mode(&cminus_mode, MODEF_SYNTAX);
+    qe_register_mode(&gmscript_mode, MODEF_SYNTAX);
     rust_init();
     swift_init();
     icon_init();



reply via email to

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