mirror of https://github.com/lammps/lammps.git
Added emacs syntax highlighting
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5360 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
a9dd87de56
commit
6c8dd4a34a
|
@ -3,99 +3,157 @@
|
|||
;; see http://xahlee.org/emacs/elisp_syntax_coloring.html
|
||||
|
||||
;; define several keyword classes
|
||||
(defvar lammps-output
|
||||
'("log" "write_restart" "dump" "undump" "thermo" "thermo_modify" "thermo_style" "print")
|
||||
(defvar lammps-output
|
||||
'("log"
|
||||
"write_restart"
|
||||
"dump"
|
||||
"undump"
|
||||
"thermo"
|
||||
"thermo_modify"
|
||||
"thermo_style"
|
||||
"print")
|
||||
"LAMMPS output.")
|
||||
|
||||
(defvar lammps-read
|
||||
'("include" "read" "read_restart" "read_data")
|
||||
(defvar lammps-read
|
||||
'("include"
|
||||
"read"
|
||||
"read_restart"
|
||||
"read_data")
|
||||
"LAMMPS read.")
|
||||
|
||||
(defvar lammps-lattice
|
||||
'("boundary" "units" "atom_style" "lattice" "region" "create_box" "create_atoms" "dielectric" "delete_atoms" "change_box" "dimension" "replicate")
|
||||
(defvar lammps-lattice
|
||||
'("boundary"
|
||||
"units"
|
||||
"atom_style"
|
||||
"lattice"
|
||||
"region"
|
||||
"create_box"
|
||||
"create_atoms"
|
||||
"dielectric"
|
||||
"delete_atoms"
|
||||
"change_box"
|
||||
"dimension"
|
||||
"replicate")
|
||||
"LAMMPS lattice.")
|
||||
|
||||
(defvar lammps-define
|
||||
'("variable" "group")
|
||||
(defvar lammps-define
|
||||
'("variable"
|
||||
"group")
|
||||
"LAMMPS define.")
|
||||
|
||||
(defvar lammps-run
|
||||
'("minimize" "run")
|
||||
(defvar lammps-run
|
||||
'("minimize"
|
||||
"run")
|
||||
"LAMMPS run.")
|
||||
|
||||
(defvar lammps-setup
|
||||
'("min_style" "fix_modify" "run_style" "timestep" "neighbor" "neigh_modify" "fix" "unfix" "communicate" "newton" "nthreads" "processors" "reset_timestep")
|
||||
(defvar lammps-setup
|
||||
'("min_style"
|
||||
"fix_modify"
|
||||
"run_style"
|
||||
"timestep"
|
||||
"neighbor"
|
||||
"neigh_modify"
|
||||
"fix"
|
||||
"unfix"
|
||||
"communicate"
|
||||
"newton"
|
||||
"nthreads"
|
||||
"processors"
|
||||
"reset_timestep")
|
||||
"LAMMPS setup.")
|
||||
|
||||
(defvar lammps-particle
|
||||
'("pair_coeff" "pair_style" "pair_modify" "mass" "velocity" "angle_coeff" "angle_style" "atom_modify" "atom_style" "bond_coeff" "bond_style" "delete_bonds" "kspace_style" "kspace_modify" "dihedral_style" "dihedral_coeff" "improper_style" "improper_coeff")
|
||||
(defvar lammps-particle
|
||||
'("pair_coeff"
|
||||
"pair_style"
|
||||
"pair_modify"
|
||||
"mass"
|
||||
"velocity"
|
||||
"angle_coeff"
|
||||
"angle_style"
|
||||
"atom_modify"
|
||||
"atom_style"
|
||||
"bond_coeff"
|
||||
"bond_style"
|
||||
"delete_bonds"
|
||||
"kspace_style"
|
||||
"kspace_modify"
|
||||
"dihedral_style"
|
||||
"dihedral_coeff"
|
||||
"improper_style"
|
||||
"improper_coeff")
|
||||
"LAMMPS particle.")
|
||||
|
||||
(defvar lammps-repeat
|
||||
'("jump" "next" "loop")
|
||||
(defvar lammps-repeat
|
||||
'("jump"
|
||||
"next"
|
||||
"loop")
|
||||
"LAMMPS repeat.")
|
||||
|
||||
(defvar lammps-operator
|
||||
'("equal" "add" "sub" "mult" "div")
|
||||
(defvar lammps-operator
|
||||
'("equal"
|
||||
"add"
|
||||
"sub"
|
||||
"mult"
|
||||
"div")
|
||||
"LAMMPS operator.")
|
||||
|
||||
(defvar lammps-conditional
|
||||
'("if" "then" "elif" "else")
|
||||
(defvar lammps-conditional
|
||||
'("if"
|
||||
"then"
|
||||
"elif"
|
||||
"else")
|
||||
"LAMMPS conditional.")
|
||||
|
||||
(defvar lammps-special
|
||||
'("EDGE" "NULL")
|
||||
(defvar lammps-special
|
||||
'("EDGE"
|
||||
"NULL")
|
||||
"LAMMPS special.")
|
||||
|
||||
;; create the regex string for each class of keywords
|
||||
(defvar lammps-output-regexp (regexp-opt lammps-output 'words))
|
||||
(defvar lammps-read-regexp (regexp-opt lammps-read 'words))
|
||||
(defvar lammps-lattice-regexp (regexp-opt lammps-lattice 'words))
|
||||
(defvar lammps-define-regexp (regexp-opt lammps-define 'words))
|
||||
(defvar lammps-run-regexp (regexp-opt lammps-run 'words))
|
||||
(defvar lammps-setup-regexp (regexp-opt lammps-setup 'words))
|
||||
(defvar lammps-particle-regexp (regexp-opt lammps-particle 'words))
|
||||
(defvar lammps-repeat-regexp (regexp-opt lammps-repeat 'words))
|
||||
(defvar lammps-operator-regexp (regexp-opt lammps-operator 'words))
|
||||
(defvar lammps-conditional-regexp (regexp-opt lammps-conditional 'words))
|
||||
(defvar lammps-special-regexp (regexp-opt lammps-special 'words))
|
||||
;; create the regex string for each class of keywords
|
||||
(defvar lammps-output-regexp (regexp-opt lammps-output 'words))
|
||||
(defvar lammps-read-regexp (regexp-opt lammps-read 'words))
|
||||
(defvar lammps-lattice-regexp (regexp-opt lammps-lattice 'words))
|
||||
(defvar lammps-define-regexp (regexp-opt lammps-define 'words))
|
||||
(defvar lammps-run-regexp (regexp-opt lammps-run 'words))
|
||||
(defvar lammps-setup-regexp (regexp-opt lammps-setup 'words))
|
||||
(defvar lammps-particle-regexp (regexp-opt lammps-particle 'words))
|
||||
(defvar lammps-repeat-regexp (regexp-opt lammps-repeat 'words))
|
||||
(defvar lammps-operator-regexp (regexp-opt lammps-operator 'words))
|
||||
(defvar lammps-conditional-regexp (regexp-opt lammps-conditional 'words))
|
||||
(defvar lammps-special-regexp (regexp-opt lammps-special 'words))
|
||||
|
||||
;; Add some more classes using explicit regexp
|
||||
|
||||
(defvar lammps-number-regexp
|
||||
"\\<[0-9]\\>"
|
||||
)
|
||||
(defvar lammps-number-regexp
|
||||
"\\<[0-9]\\>")
|
||||
|
||||
(defvar lammps-float-regexp
|
||||
"\\<[0-9-+]+.[0-9-+]*\\>"
|
||||
)
|
||||
(defvar lammps-float-regexp
|
||||
"\\<[0-9-+]+.[0-9-+]*\\>")
|
||||
|
||||
(defvar lammps-comment-regexp
|
||||
"#*"
|
||||
)
|
||||
(defvar lammps-comment-regexp
|
||||
"#*")
|
||||
|
||||
(defvar lammps-variable-regexp
|
||||
"\\$\\({[a-zA-Z0-9_]+}\\)\\|\\$[A-Za-z]"
|
||||
)
|
||||
(defvar lammps-variable-regexp
|
||||
"\\$\\({[a-zA-Z0-9_]+}\\)\\|\\$[A-Za-z]")
|
||||
|
||||
;; clear memory
|
||||
(setq lammps-output nil)
|
||||
(setq lammps-read nil)
|
||||
(setq lammps-lattice nil)
|
||||
(setq lammps-define nil)
|
||||
(setq lammps-run nil)
|
||||
(setq lammps-setup nil)
|
||||
(setq lammps-particle nil)
|
||||
(setq lammps-repeat nil)
|
||||
(setq lammps-operator nil)
|
||||
(setq lammps-conditional nil)
|
||||
(setq lammps-special nil)
|
||||
;; clear memory
|
||||
(setq lammps-output nil)
|
||||
(setq lammps-read nil)
|
||||
(setq lammps-lattice nil)
|
||||
(setq lammps-define nil)
|
||||
(setq lammps-run nil)
|
||||
(setq lammps-setup nil)
|
||||
(setq lammps-particle nil)
|
||||
(setq lammps-repeat nil)
|
||||
(setq lammps-operator nil)
|
||||
(setq lammps-conditional nil)
|
||||
(setq lammps-special nil)
|
||||
|
||||
;; create the list for font-lock.
|
||||
;; each class of keyword is given a particular face
|
||||
(setq lammps-font-lock-keywords
|
||||
`(
|
||||
(,lammps-output-regexp . font-lock-function-name-face)
|
||||
;; create the list for font-lock.
|
||||
;; each class of keyword is given a particular face
|
||||
(setq
|
||||
lammps-font-lock-keywords
|
||||
`((,lammps-output-regexp . font-lock-function-name-face)
|
||||
(,lammps-read-regexp . font-lock-preprocessor-face)
|
||||
(,lammps-lattice-regexp . font-lock-type-face)
|
||||
(,lammps-define-regexp . font-lock-variable-name-face)
|
||||
|
@ -115,8 +173,8 @@
|
|||
;; would be highlighted.
|
||||
))
|
||||
|
||||
;; define the mode
|
||||
(define-derived-mode lammps-mode shell-script-mode
|
||||
;; define the mode
|
||||
(define-derived-mode lammps-mode shell-script-mode
|
||||
"lammps mode"
|
||||
"Major mode for editing LAMMPS input scripts ..."
|
||||
;; ...
|
||||
|
@ -139,14 +197,14 @@
|
|||
(setq lammps-number-regexp nil)
|
||||
(setq lammps-float-regexp nil)
|
||||
(setq lammps-comment-regexp nil)
|
||||
(setq lammps-variable-regexp nil)
|
||||
)
|
||||
(setq lammps-variable-regexp nil))
|
||||
|
||||
;; apply it to specified filename patterns
|
||||
(setq auto-mode-alist
|
||||
(append auto-mode-alist
|
||||
(setq
|
||||
auto-mode-alist
|
||||
(append
|
||||
auto-mode-alist
|
||||
'(("in\\." . lammps-mode))
|
||||
'(("\\.lmp\\'" . lammps-mode))
|
||||
)
|
||||
)
|
||||
))
|
||||
|
||||
|
|
Loading…
Reference in New Issue