+\f
+;; Regexps written with help from Ron Forrester <ron@orcad.com>
+;; and Spencer Allain <sallain@teknowledge.com>.
+(defconst m3-font-lock-keywords-1
+ '(
+ ;;
+ ;; Module definitions.
+ ("\\<\\(INTERFACE\\|MODULE\\|PROCEDURE\\)\\>[ \t]*\\(\\sw+\\)?"
+ (1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))
+ ;;
+ ;; Import directives.
+ ("\\<\\(EXPORTS\\|FROM\\|IMPORT\\)\\>"
+ (1 font-lock-keyword-face)
+ (font-lock-match-c-style-declaration-item-and-skip-to-next
+ nil (goto-char (match-end 0))
+ (1 font-lock-constant-face)))
+ ;;
+ ;; Pragmas as warnings.
+ ;; Spencer Allain <sallain@teknowledge.com> says do them as comments...
+ ;; ("<\\*.*\\*>" . font-lock-warning-face)
+ ;; ... but instead we fontify the first word.
+ ("<\\*[ \t]*\\(\\sw+\\)" 1 font-lock-warning-face prepend)
+ )
+ "Subdued level highlighting for Modula-3 modes.")
+
+(defconst m3-font-lock-keywords-2
+ (append m3-font-lock-keywords-1
+ (eval-when-compile
+ (let ((m3-types
+ (regexp-opt
+ '("INTEGER" "BITS" "BOOLEAN" "CARDINAL" "CHAR" "FLOAT" "REAL"
+ "LONGREAL" "REFANY" "ADDRESS" "ARRAY" "SET" "TEXT"
+ "MUTEX" "ROOT" "EXTENDED")))
+ (m3-keywords
+ (regexp-opt
+ '("AND" "ANY" "AS" "BEGIN" "BRANDED" "BY" "CASE" "CONST" "DIV"
+ "DO" "ELSE" "ELSIF" "EVAL" "EXCEPT" "EXIT" "FINALLY"
+ "FOR" "GENERIC" "IF" "IN" "LOCK" "LOOP" "METHODS" "MOD" "NOT"
+ "OBJECT" "OF" "OR" "OVERRIDES" "READONLY" "RECORD" "REF"
+ "REPEAT" "RETURN" "REVEAL" "THEN" "TO" "TRY"
+ "TYPE" "TYPECASE" "UNSAFE" "UNTIL" "UNTRACED" "VAR" "VALUE"
+ "WHILE" "WITH")))
+ (m3-builtins
+ (regexp-opt
+ '("ABS" "ADR" "ADRSIZE" "BITSIZE" "BYTESIZE" "CEILING"
+ "DEC" "DISPOSE" "FIRST" "FLOOR" "INC" "ISTYPE" "LAST"
+ "LOOPHOLE" "MAX" "MIN" "NARROW" "NEW" "NUMBER" "ORD"
+ "ROUND" "SUBARRAY" "TRUNC" "TYPECODE" "VAL")))
+ )
+ (list
+ ;;
+ ;; Keywords except those fontified elsewhere.
+ (concat "\\<\\(" m3-keywords "\\)\\>")
+ ;;
+ ;; Builtins.
+ (cons (concat "\\<\\(" m3-builtins "\\)\\>") 'font-lock-builtin-face)
+ ;;
+ ;; Type names.
+ (cons (concat "\\<\\(" m3-types "\\)\\>") 'font-lock-type-face)
+ ;;
+ ;; Fontify tokens as function names.
+ '("\\<\\(END\\|EXCEPTION\\|RAISES?\\)\\>[ \t{]*"
+ (1 font-lock-keyword-face)
+ (font-lock-match-c-style-declaration-item-and-skip-to-next
+ nil (goto-char (match-end 0))
+ (1 font-lock-function-name-face)))
+ ;;
+ ;; Fontify constants as references.
+ '("\\<\\(FALSE\\|NIL\\|NULL\\|TRUE\\)\\>" . font-lock-constant-face)
+ ))))
+ "Gaudy level highlighting for Modula-3 modes.")
+
+(defvar m3-font-lock-keywords m3-font-lock-keywords-1
+ "Default expressions to highlight in Modula-3 modes.")
+
+;; We don't actually have different keywords for Modula-2. Volunteers?
+(defconst m2-font-lock-keywords-1 m3-font-lock-keywords-1
+ "Subdued level highlighting for Modula-2 modes.")
+
+(defconst m2-font-lock-keywords-2 m3-font-lock-keywords-2
+ "Gaudy level highlighting for Modula-2 modes.")
+
+(defvar m2-font-lock-keywords m2-font-lock-keywords-1
+ "Default expressions to highlight in Modula-2 modes.")
+\f