[430] | 1 | ;;; madx-mode-el -- Major mode for editing MAD-X files |
---|
| 2 | |
---|
| 3 | ;; Author: Oscar Roberto Blanco Garcia |
---|
| 4 | ;; email : <oscar.roberto.blanco.garcia@cern.ch> |
---|
| 5 | ;; Version: 1.0 |
---|
| 6 | ;; Created: 17.05.2012 |
---|
| 7 | ;; Keywords: MAD-X major-mode |
---|
| 8 | |
---|
| 9 | ;; This program is free software; you can redistribute it and/or |
---|
| 10 | ;; modify it under the terms of the GNU General Public License as |
---|
| 11 | ;; published by the Free Software Foundation; either version 2 of |
---|
| 12 | ;; the License, or (at your option) any later version. |
---|
| 13 | |
---|
| 14 | ;; This program is distributed in the hope that it will be |
---|
| 15 | ;; useful, but WITHOUT ANY WARRANTY; without even the implied |
---|
| 16 | ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
---|
| 17 | ;; PURPOSE. See the GNU General Public License for more details. |
---|
| 18 | |
---|
| 19 | ;; You should have received a copy of the GNU General Public |
---|
| 20 | ;; License along with this program; if not, write to the Free |
---|
| 21 | ;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
---|
| 22 | ;; MA 02111-1307 USA |
---|
| 23 | |
---|
| 24 | ;;; Commentary: |
---|
| 25 | ;; |
---|
| 26 | ;; This mode is modified from an example used in a tutorial about Emacs |
---|
| 27 | ;; mode creation. The tutorial can be found here: |
---|
| 28 | ;; http://two-wugs.net/emacs/mode-tutorial.html |
---|
| 29 | |
---|
| 30 | ;; Add this to your .emacs file to load and bind it to files with extension |
---|
| 31 | ;; .madx |
---|
| 32 | |
---|
| 33 | ;;; Code: |
---|
| 34 | |
---|
| 35 | (defgroup madx nil |
---|
| 36 | "Major mode to edit MAD-X files scripts in emacs" |
---|
| 37 | :group 'languages |
---|
| 38 | ) |
---|
| 39 | |
---|
| 40 | (defvar madx-mode-hook nil) |
---|
| 41 | |
---|
| 42 | ;(defvar madx-mode-map |
---|
| 43 | ; (let ((madx-mode-map (make-keymap))) |
---|
| 44 | ; (define-key madx-mode-map "\C-j" 'newline-and-indent) |
---|
| 45 | ; madx-mode-map) |
---|
| 46 | ; "Keymap for MAD-X major mode") |
---|
| 47 | |
---|
| 48 | (add-to-list 'auto-mode-alist '("\\.madx\\'" . madx-mode)) |
---|
| 49 | |
---|
| 50 | (defconst madx-font-lock-keywords-simul |
---|
| 51 | (list |
---|
| 52 | ; These define the beginning and end of each MAD-X entity definition |
---|
| 53 | '("\\<\\(APERTURE\\|CONSTRAINT\\|DYNAP\\|E\\(?:MIT\\|ND\\(?:_?MATCH\\)\\)\\|G\\(?:LOBAL\\|WEIGHT\\)\\|LINE\\|MA\\(?:KETHIN\\|TCH\\)\\|OBSERVE\\|PTC_\\(?:ALIGN\\|CREATE_\\(?:LAYOUT\\|UNIVERSE\\)\\|DUMPMAPS\\|E\\(?:ND\\|PLACEMENT\\)\\|KNOB\\|MO\\(?:MENTS\\|VE_TO_LAYOUT\\)\\|NORMAL\\|OBSERVE\\|PRINTFRAMES\\|READ_ERRORS\\|S\\(?:E\\(?:LECT\\(?:_MOMENT\\)?\\|T\\(?:ACCEL_METHOD\\|DEBUGLEVEL\\|EXACTMIS\\|FRINGE \\|KNOBVALUE\\|RADIATION\\|SWITCH\\|T\\(?:IME\\|OTALPATH\\)\\)\\)\\|TART\\)\\|T\\(?:RACK\\(?:_\\(?:END\\|LINE\\)\\)?\\|WISS\\)\\|VARYKNOB\\)\\|RUN\\|S\\(?:ELECT_PTC_NORMAL\\|IXTRACK\\|TART\\)\\|TWISS\\|VARY\\|WEIGHT\\)\\>" |
---|
| 54 | . font-lock-builtin-face) |
---|
| 55 | ) |
---|
| 56 | "Highlighting expressions for MAD-X mode (simul).") |
---|
| 57 | |
---|
| 58 | (defconst madx-font-lock-keywords-programflow |
---|
| 59 | (list |
---|
| 60 | '("\\<\\(ELSE\\(?:IF\\)?\\|IF\\|MACRO\\|WHILE\\)\\>" |
---|
| 61 | . font-lock-keyword-face) |
---|
| 62 | ) |
---|
| 63 | "Highlighting expressions for MAD-X mode (programflow).") |
---|
| 64 | |
---|
| 65 | (defconst madx-font-lock-keywords-controlstm |
---|
| 66 | (list |
---|
| 67 | '("\\<\\(ASSIGN\\|C\\(?:ALL\\|O\\(?:GUESS\\|NST\\)\\|REATE\\)\\|D\\(?:ELETE\\|UMPSEQU\\)\\|E\\(?:OPTION\\|SAVE\\|X\\(?:EC\\|IT\\)\\)\\|FILL\\|HELP\\|OPTION\\|PRINT\\|QUIT\\|RE\\(?:A\\(?:D\\(?:\\(?:MY\\)?TABLE\\)\\|L\\)\\|SBEAM\\|TURN\\)\\|S\\(?:AVE\\(?:BETA\\)?\\|E\\(?:LECT\\|T\\(?:VARS\\)?\\)\\|HOW\\|TOP\\|YSTEM\\)\\|T\\(?:ABSTRING\\|ITLE\\)\\|\\(?:US\\|VALU\\|WRIT\\)E\\)\\>" |
---|
| 68 | . font-lock-builtin-face) |
---|
| 69 | ) |
---|
| 70 | "Highlighting expressions for MAD-X mode (controlstm).") |
---|
| 71 | |
---|
| 72 | (defconst madx-font-lock-keywords-elements |
---|
| 73 | (list |
---|
| 74 | '("\\<\\(BEAMBEAM\\|CRABCAVITY\\|D\\(?:IPEDGE\\|RIFT\\)\\|E\\(?:\\(?:COLLIM\\|LSEPAR\\)ATOR\\)\\|H\\(?:\\(?:KICKE\\|MONITO\\)R\\)\\|INSTRUMENT\\|KICKER\\|M\\(?:A\\(?:RKER\\|TRIX\\)\\|ONITOR\\|ULTIPOLE\\)\\|OCTUPOLE\\|QUADRUPOLE\\|R\\(?:BEND\\|COLLIMATOR\\|FCAVITY\\)\\|S\\(?:BEND\\|EXTUPOLE\\|OLENOID\\|ROTATION\\)\\|V\\(?:\\(?:KICKE\\|MONITO\\)R\\)\\|YROTATION\\)\\>" |
---|
| 75 | . font-lock-type-face) |
---|
| 76 | ) |
---|
| 77 | "Highlighting expressions for MAD-X mode (elements).") |
---|
| 78 | |
---|
| 79 | (defconst madx-font-lock-keywords-beamspec |
---|
| 80 | (list |
---|
| 81 | '("\\<\\(\\(?:RES\\)?BEAM\\)\\>" |
---|
| 82 | . font-lock-builtin-face) |
---|
| 83 | ) |
---|
| 84 | "Highlighting expressions for MAD-X mode (beamspec).") |
---|
| 85 | |
---|
| 86 | (defconst madx-font-lock-keywords-matchingmet |
---|
| 87 | (list |
---|
| 88 | '("\\<\\(JACOBIAN\\|LMDIF\\|MIGRAD\\|SIMPLEX\\|USE_MACRO\\)\\>" |
---|
| 89 | . font-lock-builtin-face) |
---|
| 90 | ) |
---|
| 91 | "Highlighting expressions for MAD-X mode (matchingmet).") |
---|
| 92 | |
---|
| 93 | (defconst madx-font-lock-keywords-orbit_corr |
---|
| 94 | (list |
---|
| 95 | '("\\<\\(C\\(?:O\\(?:PTION\\|RRECT \\)\\|SAVE\\)\\|ENDTRACK\\|S\\(?:ETCORR\\|ODD\\|URVEY\\|XF\\(?:READ\\|WRITE\\)\\)\\|T\\(?:\\(?:OUSCHE\\|RAC\\)K\\)\\|USE\\(?:KICK\\|MONITOR\\)\\)\\>" |
---|
| 96 | . font-lock-builtin-face) |
---|
| 97 | ) |
---|
| 98 | "Highlighting expressions for MAD-X mode (orbit_corr).") |
---|
| 99 | |
---|
| 100 | (defconst madx-font-lock-keywords-plot |
---|
| 101 | (list |
---|
| 102 | '("\\<\\(EPRINT\\|PLOT\\|R\\(?:ESPLOT\\|PLOT\\|TRACKSTORE\\|VIEWER\\)\\|SETPLOT\\)\\>" |
---|
| 103 | . font-lock-builtin-face) |
---|
| 104 | ) |
---|
| 105 | "Highlighting expressions for MAD-X mode (plot).") |
---|
| 106 | |
---|
| 107 | (defconst madx-font-lock-keywords-seqediting |
---|
| 108 | (list |
---|
| 109 | '("\\<\\(CYCLE\\|ENDEDIT\\|FLATTEN\\|INSTALL\\|MOVE\\|RE\\(?:FLECT\\|MOVE\\)\\|SEQEDIT\\)\\>" |
---|
| 110 | . font-lock-builtin-face) |
---|
| 111 | ) |
---|
| 112 | "Highlighting expressions for MAD-X mode (seqediting).") |
---|
| 113 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\\(?:0\\|DISTR\\)\\|lagf\\|r\\(?:ph[12]\\|v[1-4]\\)\\|[HL]\\)\\>" |
---|
| 117 | . font-lock-doc-face) |
---|
| 118 | ) |
---|
| 119 | "Highlighting expressions for MAD-X mode (parameters).") |
---|
| 120 | |
---|
| 121 | (defconst madx-font-lock-keywords-errordef |
---|
| 122 | (list |
---|
| 123 | '("\\<\\(E\\(?:ALIGN\\|FCOMP\\|RROR\\)\\|SETERR\\)\\>" |
---|
| 124 | . font-lock-warning-face) |
---|
| 125 | ) |
---|
| 126 | "Highlighting expressions for MAD-X mode (errordef).") |
---|
| 127 | |
---|
| 128 | (defconst madx-font-lock-keywords-constants |
---|
| 129 | (list |
---|
| 130 | '("\\<\\(ANTIPROTON\\|C\\(?:ENTRE\\|IRCLE\\|LIGHT\\|OLLIM\\)\\|DEGRAD\\|E\\(?:L\\(?:ECTRON\\|LIPSE\\)\\|MASS\\|NTRY\\|XIT\\)?\\|FALSE\\|LHCSCREEN\\|M\\(?:ARGUERITE\\|UMASS\\)\\|NEGMUON\\|P\\(?:I\\|MASS\\|\\(?:OS\\(?:ITR\\|MU\\)\\|ROT\\)ON\\)\\|QELECT\\|R\\(?:A\\(?:CETRACK\\|DDEG\\)\\|ECT\\(?:\\(?:ANGL\\|ELLIPS\\)E\\)\\)\\|SIMPLE\\|T\\(?:EAPOT\\|RUE\\|WOPI\\)\\)\\>" |
---|
| 131 | . font-lock-constant-face) |
---|
| 132 | ) |
---|
| 133 | "Highlighting expressions for MAD-X mode (constants).") |
---|
| 134 | |
---|
| 135 | (defconst madx-font-lock-keywords-stringatt |
---|
| 136 | (list |
---|
| 137 | '("\\<\\(TITLE\\|system\\)\\>" |
---|
| 138 | . font-lock-builtin-face) |
---|
| 139 | ) |
---|
| 140 | "Highlighting expressions for MAD-X mode (stringatt).") |
---|
| 141 | |
---|
| 142 | (defconst madx-font-lock-keywords-functions |
---|
| 143 | (list |
---|
| 144 | '("\\<\\(A\\(?:BS\\|COS\\|\\(?:SI\\|TA\\)N\\)\\|COSH?\\|EXP\\|GAUSS\\|LOG\\(?:10\\)?\\|RANF\\|S\\(?:INH?\\|QRT\\)\\|T\\(?:ANH?\\|GAUSS\\)\\)\\>" |
---|
| 145 | . font-lock-function-name-face) |
---|
| 146 | ) |
---|
| 147 | "Highlighting expressions for MAD-X mode (functions).") |
---|
| 148 | |
---|
| 149 | (defconst madx-font-lock-keywords-variables_madx |
---|
| 150 | (list |
---|
| 151 | '("\\<\\(A\\(?:LF\\(?:A[1-3][1-3]P?\\|[XY]\\)\\|PER_[1-4]\\)\\|BET\\(?:A[1-3][1-3]P?\\|[XY]\\)\\|D\\(?:D\\(?:P[XY]\\|Q[12]\\|[XY]\\)\\|ELTAP\\|ISP[1-4]\\(?:P[1-3]\\)?\\|MU[XY]\\|P[XY]\\|Q[12]\\|[XY]\\)\\|E\\(?:IGN[1-6][1-6]\\|NERGY\\)\\|GAMA[1-3][1-3]P?\\|K\\(?:\\(?:ICK\\)?[1-6]\\)\\|MU\\(?:[1-3]\\|[XY]\\)\\|N\\(?:1\\(?:[XY]_M\\)?\\|AME\\)\\|ON_\\(?:AP\\|ELEM\\)\\|P\\(?:HI[TXY]?\\|[TXY]N\\|[TXY]\\)\\|Q[12]\\|R\\(?:E\\(?:[1-6][1-6]\\)?\\|M[1-6][1-6]\\|TOL\\|[1-6][1-6]\\)\\|T\\(?:HETA\\|M[1-6][1-6][1-6]\\|N\\|[1-6][1-6][1-6]\\)\\|W[TXY]\\|X\\(?:N\\|TOL\\)\\|Y\\(?:N\\|TOL\\)\\|[RSTXY]\\)\\>" |
---|
| 152 | ; . font-lock-negation-char-face) |
---|
| 153 | . font-lock-variable-name-face) |
---|
| 154 | ) |
---|
| 155 | "Highlighting expressions for MAD-X mode (variables_madx).") |
---|
| 156 | |
---|
| 157 | (defconst madx-font-lock-special_operators |
---|
| 158 | (list |
---|
| 159 | '("\\(->\\|:=\\)" |
---|
| 160 | . font-lock-warning-face) |
---|
| 161 | ) |
---|
| 162 | "Highlighting expressions for MAD-X mode (variables_madx).") |
---|
| 163 | |
---|
| 164 | (defconst madx-font-lock-special_constants |
---|
| 165 | (list |
---|
| 166 | '("\\(#[es]\\)" |
---|
| 167 | . font-lock-constant-face) |
---|
| 168 | ) |
---|
| 169 | "Highlighting expressions for MAD-X mode (variables_madx).") |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | (defconst madx-font-lock-keywords-3 |
---|
| 173 | (append |
---|
| 174 | madx-font-lock-special_operators |
---|
| 175 | madx-font-lock-special_constants |
---|
| 176 | madx-font-lock-keywords-programflow |
---|
| 177 | madx-font-lock-keywords-simul |
---|
| 178 | madx-font-lock-keywords-controlstm |
---|
| 179 | madx-font-lock-keywords-elements |
---|
| 180 | madx-font-lock-keywords-beamspec |
---|
| 181 | madx-font-lock-keywords-matchingmet |
---|
| 182 | madx-font-lock-keywords-orbit_corr |
---|
| 183 | madx-font-lock-keywords-plot |
---|
| 184 | madx-font-lock-keywords-seqediting |
---|
| 185 | madx-font-lock-keywords-parameters |
---|
| 186 | madx-font-lock-keywords-errordef |
---|
| 187 | madx-font-lock-keywords-constants |
---|
| 188 | madx-font-lock-keywords-stringatt |
---|
| 189 | madx-font-lock-keywords-functions |
---|
| 190 | madx-font-lock-keywords-variables_madx |
---|
| 191 | madx-font-lock-special_operators |
---|
| 192 | madx-font-lock-special_constants |
---|
| 193 | ) |
---|
| 194 | "Balls-out highlighting in MAD-X mode.") |
---|
| 195 | |
---|
| 196 | (defvar madx-font-lock-keywords madx-font-lock-keywords-3 |
---|
| 197 | "Default highlighting expressions for MAD-X mode.") |
---|
| 198 | |
---|
| 199 | (defvar madx-mode-syntax-table |
---|
| 200 | (let ((madx-mode-syntax-table (make-syntax-table))) |
---|
| 201 | |
---|
| 202 | ; This is added so entity names with unde rscores can be more easily parsed |
---|
| 203 | (modify-syntax-entry ?_ "w" madx-mode-syntax-table) |
---|
| 204 | (modify-syntax-entry ?. "w" madx-mode-syntax-table) |
---|
| 205 | |
---|
| 206 | ; Comment styles are same as C++ |
---|
| 207 | (modify-syntax-entry ?/ ". 124 b" madx-mode-syntax-table) |
---|
| 208 | (modify-syntax-entry ?* ". 23" madx-mode-syntax-table) |
---|
| 209 | (modify-syntax-entry ?\n "> b" madx-mode-syntax-table) |
---|
| 210 | (modify-syntax-entry ?! "< b" madx-mode-syntax-table) |
---|
| 211 | (modify-syntax-entry ?' "|" madx-mode-syntax-table) |
---|
| 212 | madx-mode-syntax-table) |
---|
| 213 | "Syntax table for madx-mode") |
---|
| 214 | |
---|
| 215 | ;;; ### autoload |
---|
| 216 | (defun madx-mode () |
---|
| 217 | "Major mode for editing MAD-X script files" |
---|
| 218 | (interactive) |
---|
| 219 | (kill-all-local-variables) |
---|
| 220 | (setq mode-name "MAD-X") |
---|
| 221 | (setq major-mode 'madx-mode) |
---|
| 222 | ; (setq comment-start "!") |
---|
| 223 | ; (use-local-map madx-mode-map) |
---|
| 224 | (set-syntax-table madx-mode-syntax-table) |
---|
| 225 | (make-local-variable 'font-lock-defaults) |
---|
| 226 | (setq font-lock-defaults '(madx-font-lock-keywords nil t)) |
---|
| 227 | ;; Set up search |
---|
| 228 | (add-hook 'madx-mode-hook |
---|
| 229 | (lambda () (setq case-fold-search t))) |
---|
| 230 | (run-hooks 'madx-mode-hook) |
---|
| 231 | ) |
---|
| 232 | (provide 'madx-mode) |
---|
| 233 | |
---|
| 234 | ;;; madx-mode.el ends here |
---|
| 235 | |
---|