[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))
- [elpa] externals/pspp-mode 7eed0f2 03/12: Updated pspp-mode.el., (continued)
- [elpa] externals/pspp-mode 7eed0f2 03/12: Updated pspp-mode.el., Stefan Monnier, 2020/07/04
- [elpa] externals/pspp-mode 4820404 09/12: Delete trailing whitespace at line endings., Stefan Monnier, 2020/07/04
- [elpa] externals/pspp-mode 70e2b20 08/12: changed emacs mode description to comply with elpa, Stefan Monnier, 2020/07/04
- [elpa] externals/pspp-mode 66b3b97 11/12: pspp-mode.el: Make indentation closer to what lisp people like., Stefan Monnier, 2020/07/04
- [elpa] externals/pspp-mode 5d35382 01/12: Added the beginnings of an emacs pspp-mode for editing pspp files., Stefan Monnier, 2020/07/04
- [elpa] externals/pspp-mode 27fe820 04/12: Fixed a build error that make distcheck didn't catch (automake bug)., Stefan Monnier, 2020/07/04
- [elpa] externals/pspp-mode 9b8b43b 05/12: Continue reforming procedure execution. In this phase, remove PROCESS, Stefan Monnier, 2020/07/04
- [elpa] externals/pspp-mode dd4bf58 02/12: Changed all the licence notices in all the files., Stefan Monnier, 2020/07/04
- [elpa] externals/pspp-mode d47efc5 07/12: Change license from GPLv2+ to GPLv3+., Stefan Monnier, 2020/07/04
- [elpa] externals/pspp-mode 79a877c 10/12: pspp-mode.el: update elpa autoload comment, Stefan Monnier, 2020/07/04
- [elpa] externals/pspp-mode 91b72ce 12/12: pspp-mode.el: Make all keywords case insensitive,
Stefan Monnier <=
- [elpa] externals/pspp-mode 0b5c5f1 06/12: Removed my authorship lines., Stefan Monnier, 2020/07/04