PL/1 mode?

PL/1 mode?

Post by Markus Sto » Wed, 03 Nov 2004 22:53:11


Hi, is there a major mode for writing PL/1 code? (So far I couldn't find
one.)

Thanks
Markus
 
 
 

PL/1 mode?

Post by rob » Thu, 04 Nov 2004 18:56:12


This is something I threw together a while back when I needed to look
at some old PL/M code. It's not perfect and I don't know if it's any
use for PL/1. Save it to plm-mode.el and add (require 'plm-mode) to
your .emacs
I've tested on GNU Emacs 21. Xemacs might need (require 'generic-mode)
instead of (require 'generic)

Rob

(apologies if google groups mangles the line breaks)

;;; begin plm-mode.el

(require 'generic)

(defun plm-mode-setup ()
(modify-syntax-entry ?_ "w")
(setq imenu-generic-expression '((nil
"^\\([A-Za-z0-9$_]+\\)\\s-*:\\s-*\\(\\(ACCESS\\|LOCAL\\|ROOT\\)\\b\\s-*\\)?PROCEDURE\\b"
1))))

;;;###autoload
(define-generic-mode
'plm-mode
'(("/*" . "*/"))
'("IF" "THEN" "ELSE" "WHILE"
"DO" "END"
"CALL" "RETURN"
"PROCEDURE" "DECLARE" "STRUCTURE"
"LITERALLY" "BASED" "AT"
"AND" "OR" "NOT"
"TRUE" "FALSE"
"DATA" "LOCAL" "PUBLIC")
'(("[^_]\\(INTEGER\\|WORD\\|DWORD\\|REAL\\|BYTE\\|BOOLEAN\\|POINTER\\)[^(_]"
. (1 font-lock-type-face))
("^\\$\\sw+" . font-lock-preprocessor-face)
("^\\([A-Za-z0-9$_]+\\)\\s-*:.*PROCEDURE.*;\\s-*$" . (1
font-lock-function-name-face))
("^END\\s-+\\([A-Za-z0-9$_]+\\)\\s-*;\\s-*$" . (1
font-lock-function-name-face))
("'.*'" . font-lock-constant-face))
'("\\.plm\\'" "\\.PLM\\'" "\\.ext\\'" "\\.EXT\\'")
'(plm-mode-setup)
"Mode for editing PL/M source"
)


(provide 'plm-mode)

;;; end plm-mode.el