Contact/support | Changelog

snobol-mode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
;;; snobol-mode.el --- snobol mode

;; Copyright (C) 2012  Shae Erisson

;; Author: Shae Erisson <shae@ScannedInAvian.com>
;; Keywords: languages

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; adapted from http://claystuart.blogspot.com/2012/09/a-snobol4-major-mode-for-emacs.html
;; who got it from http://emacs-fu.blogspot.com/2010/04/creating-custom-modes-easy-way-with.html

(require 'generic-x) ;; required

(define-generic-mode 'snobol-mode
  (list "*")                                       ;; comments
;; keywords
  (list "OUTPUT" "INPUT" "ANY" "ARBNO" "BREAK" "LEN" "NOTANY" "POS" "RPOS"
        "RTAB" "SPAN" "APPLY" "ARG" "ARRAY" "BACKSPACE" "CHOP" "CODE"
        "COLLECT" "CONVERT" "COPY" "DATATYPE" "DATE" "DEFINE" "DETACH"
        "DIFFER" "DUMP" "DUPL" "ENDFILE" "EQ" "EVAL" "EXP" "FIELD" "GE"
        "GT" "IDENT" "INTEGER" "ITEM" "LE" "LEQ" "LGE" "LGT" "LLE" "LLT"
        "LN" "LNE" "LOAD" "LOCAL" "LPAD" "LT" "NE" "OPSYN" "PROTOTYPE"
        "REMDR" "REPLACE" "REVERSE" "REWIND" "RPAD" "RSORT" "SEEK" "SIZE"
        "SORT" "STATEMENTS" "STOPTR" "SUBSTR" "TELL" "TRACE" "TRIM" "UNLOAD"
        "VALUE")

  '(("^\\w\\{1,8\\}"  . font-lock-warning-face)    ;; highlights labels
    (":.?[(].*[)]" . font-lock-constant-face))     ;; highlights gotos
  '("\\.SNO$")                                     ;; file endings
   nil                                             ;; other function calls
  "A mode for Snobol4 files"                       ;; doc string
)

(provide 'snobol-mode)

snobol-mode (annotation)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
;;; snobol-mode.el --- snobol mode

;; Copyright (C) 2012  Shae Erisson

;; Author: Shae Erisson <shae@ScannedInAvian.com>
;; Keywords: languages

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; adapted from http://claystuart.blogspot.com/2012/09/a-snobol4-major-mode-for-emacs.html
;; who got it from http://emacs-fu.blogspot.com/2010/04/creating-custom-modes-easy-way-with.html

(require 'generic-x) ;; required

(define-generic-mode snobol-mode
  (list "*")                                       ;; comments
;; keywords
  (list "OUTPUT" "INPUT" "ANY" "ARBNO" "BREAK" "LEN" "NOTANY" "POS" "RPOS"
        "RTAB" "SPAN" "APPLY" "ARG" "ARRAY" "BACKSPACE" "CHOP" "CODE"
        "COLLECT" "CONVERT" "COPY" "DATATYPE" "DATE" "DEFINE" "DETACH"
        "DIFFER" "DUMP" "DUPL" "ENDFILE" "EQ" "EVAL" "EXP" "FIELD" "GE"
        "GT" "IDENT" "INTEGER" "ITEM" "LE" "LEQ" "LGE" "LGT" "LLE" "LLT"
        "LN" "LNE" "LOAD" "LOCAL" "LPAD" "LT" "NE" "OPSYN" "PROTOTYPE"
        "REMDR" "REPLACE" "REVERSE" "REWIND" "RPAD" "RSORT" "SEEK" "SIZE"
        "SORT" "STATEMENTS" "STOPTR" "SUBSTR" "TELL" "TRACE" "TRIM" "UNLOAD"
        "VALUE")

  '(("^\\w\\{1,8\\}"  . font-lock-warning-face)    ;; highlights labels
    (":.?[(].*[)]" . font-lock-constant-face))     ;; highlights gotos
  '("\\.SNO$")                                     ;; file endings
   nil                                             ;; other function calls
  "A mode for Snobol4 files"                       ;; doc string
)
;; allows compile to call snobol4 with the file-name, assuming snobol4 is in your path
(add-hook 'snobol-mode-hook
          (lambda ()
            (set (make-local-variable 'compile-command)
                 (concat "snobol4 " buffer-file-name))))

(provide 'snobol-mode)