Path: news.daimi.aau.dk!news.uni-c.dk!sunic!pipex!uunet!munnari.oz.au!ariel.ucs.unimelb.EDU.AU!ariel.ucs.unimelb.EDU.AU!law From: law@tauon.ph.unimelb.edu.au (Lachlan Witham) Newsgroups: comp.lang.beta Subject: ANNOUNCE: Emacs Hilit19 mode for BETA Followup-To: comp.lang.beta Date: 31 Oct 1994 00:34:28 GMT Organization: University of Melbourne Lines: 205 Distribution: world Message-ID: Reply-To: law@tauon.ph.unimelb.edu.au NNTP-Posting-Host: tauon.ph.unimelb.edu.au Hi everyone, Here is an Emacs highlighting mode for BETA utilizing the Hilit19 package for Emacs v19. I'm calling this version 0.1 as (a) it is a first release and (b) I would like some feedback on what people think of the highlighting format I've chosen. Because of the very abstract syntactic style of BETA I decided to provide a lot of new colouring definitions (I only kept "comment" and "string" defaults) for the different syntactic constructs of BETA. So please try out different colouring options and tell me what you think works best for programming in BETA. I'll release a revised version when I have some of your opinions. Enjoy! Lachlan. --------------------- Cut Here ------------------------------------ ;; beta-mode-hilit.el ;; Set the mode patterns for hilighting BETA code ;; ;; Written by Lachlan Witham, law@tauon.ph.unimelb.edu.au ;; First release (v0.1) date 31/10/94 ;; ;; This code is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY. No author or distributor ;; accepts responsibility to anyone for the consequences of using it ;; or for whether it serves any particular purpose or works at all, ;; unless he says so in writing. Refer to the GNU Emacs General Public ;; License for full details. ;; Everyone is granted permission to copy, modify and redistribute ;; this code, but only under the conditions described in the ;; GNU Emacs General Public License. A copy of this license is ;; supposed to have been given to you along with GNU Emacs so you ;; can know your rights and responsibilities. It should be in a ;; file named COPYING. Among other things, the copyright notice ;; and this notice must be preserved on all copies. ;; ;; NB: The order in which the regexp matches are defined is IMPORTANT ;; as earlier definitions override later ones in this file. ;; ;; Please mail me any bugs, suggestions for improvements, comments, etc. ;; TODO: Labelled (compound) imperatives. (Suggestions anybody? :-) (hilit-set-mode-patterns 'beta-mode '(;; Comments blocks ("(\\*" "\\*)" comment) ;; Fragment language lines containing property statements ;; NB: These regexp pairs follow the BETA v5.0 compiler syntax ;; i.e. only new-style INCLUDE lines and no "[[....]]" supported. ("\\<\\(ORIGIN\\|INCLUDE\\|BODY\\|MDBODY\\|OBJFILE\\|BETARUN\\|MAKE\\|LIBFILE\\|ON\\|OFF\\|BETAOPTS\\|TMPDIR\\)\\>" ";" fragmentproperty) ;; Fragment form definition header ("--" "$" fragmentform) ;; Fragment slot definition ("<<" ">>" fragmentslot) ;; BETA strings ("'" "[^\\\\]'" string) ;; Repetition declarations and slices ("\\[\\w+\\(:\\w+\\)?\\]" nil repetition) ;; Pattern Declaration ("\\w+\\(,[ \t]*\\w+\\)*:[^:<]" nil patterndecl) ;; Virtual declaration ("\\w+:<" nil virtualdecl) ;; Extended/Final binding of virtual declaration ("\\w+::]" nil assignment) ;; Object descriptor start/end ("(#" nil descriptor) ("#)" nil descriptor) ;; if-imperative constructs including selection operator ("(if" nil selection) ("if)" nil selection) ("//" nil selection) ("then" nil selection) ("else" nil selection) ;; for-imperative constructs ("(for" "repeat" looping) ("for)" nil looping) ;; Keywords to hilight ("\\<\\(do\\|range\\|enter\\|exit\\|inner\\|INNER\\|leave\\|restart\\|none\\|NONE\\|this\\|suspend\\|loop\\|while\\|until\\|and\\|or\\|not\\|true\\|TRUE\\|false\\|FALSE\\)\\>" nil betakeyword) ) ) (provide 'beta-mode-hilit) --------------------- Cut Here ------------------------------------ ;; Lachlan Witham, law@tauon.ph.unimelb.edu.au, 31/10/94. ;; Excerpts from my .emacs file which shows beta-mode autoload hook ;; and how to initialize the hilit19 highlighting package. You need ;; something similar to these in your .emacs file. The colour name ;; definitions are essential. ;; Add my own emacs directory to the library load path... (setq load-path (append '( "~/emacs" ) load-path )) ;; Add BETA source files to auto-mode-alist. Emacs will automatically ;; enter beta-mode when a file ending in ".bet" is loaded. (autoload 'beta-mode "~/emacs/beta-mode.el") (setq auto-mode-alist (append auto-mode-alist '(("\\.bet\\'" . beta-mode)))) ;; Include the hilit19 package which "colourises" buffers :-) (cond (window-system (setq hilit-mode-enable-list '(not text-mode) hilit-background-mode 'light hilit-inhibit-hooks nil hilit-inhibit-rebinding nil) (require 'hilit19) ;; Enable automatic highlighting (colourising) of files when opened (setq hilit-auto-highlight t) ;; Use these colours for BETA mode hilighting with hilit19 ;; "comment" and "string" are defined within hilit already ;; Change colour names to suit your personal taste :-) (hilit-translate fragmentproperty 'Sienna) (hilit-translate fragmentform 'Sienna) (hilit-translate fragmentslot 'Sienna) (hilit-translate virtualdecl 'VioletRed) (hilit-translate virtualbinding 'VioletRed) (hilit-translate subpattern 'Violet) (hilit-translate patterndecl 'DarkViolet) (hilit-translate patternrefdecl 'DeepPink) (hilit-translate patternref 'DeepPink) (hilit-translate objectrefdecl 'DarkGreen) (hilit-translate objectref 'Brown) (hilit-translate remoteobject 'NavyBlue) (hilit-translate remoteobjectref 'Brown) (hilit-translate componentdecl 'DarkGreen) (hilit-translate repetition 'ForestGreen) (hilit-translate betakeyword 'Black) (hilit-translate descriptor 'Black) (hilit-translate creation 'DarkOrange) (hilit-translate assignment 'DarkOrange) (hilit-translate selection 'grey20) (hilit-translate looping 'grey20) ;; Load beta-mode highlight settings. (add-hook 'beta-mode-hook (function (lambda () (require 'beta-mode-hilit) ))) ) ) --------------------- Cut Here ------------------------------------ ------------------------------------------------------------------- Lachlan Witham law@tauon.ph.unimelb.edu.au PhD student Micro Analytical Research Centre School of Physics University of Melbourne, Australia -- ------------------------------------------------------------------- Lachlan Witham law@tauon.ph.unimelb.edu.au PhD student Micro Analytical Research Centre School of Physics University of Melbourne, Australia