emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/pspp-mode 91b72ce 12/12: pspp-mode.el: Make all keyword


From: Stefan Monnier
Subject: [elpa] externals/pspp-mode 91b72ce 12/12: pspp-mode.el: Make all keywords case insensitive
Date: Sat, 4 Jul 2020 12:00:56 -0400 (EDT)

branch: externals/pspp-mode
commit 91b72ce14aa3942fa9f4e1a7dd311406673fe90d
Author: John Darrington <john@darrington.wattle.id.au>
Commit: John Darrington <john@darrington.wattle.id.au>

    pspp-mode.el: Make all keywords case insensitive
---
 pspp-mode.el | 61 +++++++++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 42 insertions(+), 19 deletions(-)

diff --git a/pspp-mode.el b/pspp-mode.el
index a54d014..23fc419 100644
--- a/pspp-mode.el
+++ b/pspp-mode.el
@@ -49,8 +49,10 @@
       (while (not (or
                    (or (bobp) pspp-end-of-block-found)
                    pspp-start-of-block-found))
-        (set 'pspp-end-of-block-found (looking-at "^[ \t]*END[\t ]+DATA\."))
-        (set 'pspp-start-of-block-found (looking-at "^[ \t]*BEGIN[\t ]+DATA"))
+        (set 'pspp-end-of-block-found
+             (looking-at "^[ \t]*\\(END\\|end\\)[\t ]+\\(DATA\\|data\\)\."))
+        (set 'pspp-start-of-block-found
+             (looking-at "^[ \t]*\\(BEGIN\\|begin\\)[\t ]+\\(DATA\\|data\\)"))
         (forward-line -1))
 
       (and pspp-start-of-block-found (not pspp-end-of-block-found)))))
@@ -61,23 +63,43 @@
   "size of indent")
 
 
+(defun downcase-list (l)
+  "Takes a list of strings and returns that list with all elements downcased"
+  (if l
+      (cons (downcase (car l)) (downcase-list (cdr l)))
+    nil))
+
+
+(defun upcase-list (l)
+  "Takes a list of strings and returns that list with all elements upcased"
+  (if l
+      (cons (upcase (car l)) (upcase-list (cdr l)))
+    nil))
+
+
+(defun updown-list (l)
+  "Takes a list of strings and returns that list with all elements upcased
+and downcased"
+  (append (upcase-list l) (downcase-list l)))
+
+
 (defconst pspp-indenters
   (concat "^[\t ]*"
-          (regexp-opt '("DO"
-                        "BEGIN"
-                        "LOOP"
-                        "INPUT") t)
+          (regexp-opt (updown-list '("DO"
+                                     "BEGIN"
+                                     "LOOP"
+                                     "INPUT")) t)
           "[\t ]+")
   "constructs which cause indentation")
 
 
 (defconst pspp-unindenters
-  (concat "^[\t ]*END[\t ]+"
-          (regexp-opt '("IF"
-                        "DATA"
-                        "LOOP"
-                        "REPEAT"
-                        "INPUT") t)
+  (concat "^[\t ]*\\(END\\|end\\)[\t ]+"
+          (regexp-opt (updown-list '("IF"
+                                     "DATA"
+                                     "LOOP"
+                                     "REPEAT"
+                                     "INPUT")) t)
           "[\t ]*")
   ;; Note that "END CASE" and "END FILE" do not unindent.
   "constructs which cause end of indentation")
@@ -135,6 +157,7 @@
   "Returns t if the current line is the first line of a comment, nil otherwise"
   (beginning-of-line)
   (or (looking-at "^\*")
+      (looking-at "^[\t ]*comment[\t ]")
       (looking-at "^[\t ]*COMMENT[\t ]")))
 
 
@@ -177,7 +200,7 @@
 
 (defvar pspp-mode-syntax-table
   (let ((x-pspp-mode-syntax-table (make-syntax-table)))
-    
+
     ;; Special chars allowed in variables
     (modify-syntax-entry ?#  "w" x-pspp-mode-syntax-table)
     (modify-syntax-entry ?@  "w" x-pspp-mode-syntax-table)
@@ -204,7 +227,7 @@
 (defconst pspp-font-lock-keywords
   (list (cons
          (concat "\\<"
-                 (regexp-opt '(
+                 (regexp-opt (updown-list '(
                                "END DATA"
                                "ACF"
                                "ADD FILES"
@@ -376,18 +399,18 @@
                                "WEIGHT"
                                "WRITE"
                                "WRITE FORMATS"
-                               "XSAVE") t) "\\>")
+                               "XSAVE")) t) "\\>")
          'font-lock-builtin-face)
 
         (cons
-         (concat "\\<" (regexp-opt
-                        '("ALL" "AND" "BY" "EQ" "GE" "GT" "LE" "LT" "NE" "NOT" 
"OR" "TO" "WITH")
+         (concat "\\<" (regexp-opt (updown-list
+                        '("ALL" "AND" "BY" "EQ" "GE" "GT" "LE" "LT" "NE" "NOT" 
"OR" "TO" "WITH"))
                         t) "\\>")
          'font-lock-keyword-face)
 
         (cons
          (concat "\\<"
-                 (regexp-opt '(
+                 (regexp-opt (updown-list '(
                                "ABS"
                                "ACOS"
                                "ANY"
@@ -602,7 +625,7 @@
                                "XDATE.WEEK"
                                "XDATE.WKDAY"
                                "XDATE.YEAR"
-                               "YRMODA")
+                               "YRMODA"))
                              t) "\\>")  'font-lock-function-name-face)
 
         '( "\\<[#$@a-zA-Z][a-zA-Z0-9_]*\\>" . font-lock-variable-name-face))



reply via email to

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