Commit 6c8dd4a3 authored by athomps's avatar athomps
Browse files

Added emacs syntax highlighting

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5360 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent a9dd87de
Loading
Loading
Loading
Loading
+199 −141
Original line number Diff line number Diff line
@@ -4,47 +4,109 @@

 ;; define several keyword classes
(defvar lammps-output
   '("log" "write_restart" "dump" "undump" "thermo" "thermo_modify" "thermo_style" "print")
  '("log"
    "write_restart"
    "dump"
    "undump"
    "thermo"
    "thermo_modify"
    "thermo_style"
    "print")
  "LAMMPS output.")

(defvar lammps-read
   '("include" "read" "read_restart" "read_data")
  '("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")
  '("boundary"
    "units"
    "atom_style"
    "lattice"
    "region"
    "create_box"
    "create_atoms"
    "dielectric"
    "delete_atoms"
    "change_box"
    "dimension"
    "replicate")
  "LAMMPS lattice.")

(defvar lammps-define
   '("variable" "group")
  '("variable"
    "group")
  "LAMMPS define.")

(defvar lammps-run
   '("minimize" "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")
  '("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")
  '("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")
  '("jump"
    "next"
    "loop")
  "LAMMPS repeat.")

(defvar lammps-operator
   '("equal" "add" "sub" "mult" "div")
  '("equal"
    "add"
    "sub"
    "mult"
    "div")
  "LAMMPS operator.")

(defvar lammps-conditional
   '("if" "then" "elif" "else")
  '("if"
    "then"
    "elif"
    "else")
  "LAMMPS conditional.")

(defvar lammps-special
   '("EDGE" "NULL")
  '("EDGE"
    "NULL")
  "LAMMPS special.")

;; create the regex string for each class of keywords
@@ -63,20 +125,16 @@
;; Add some more classes using explicit regexp

(defvar lammps-number-regexp
   "\\<[0-9]\\>"
   )
  "\\<[0-9]\\>")

(defvar lammps-float-regexp
   "\\<[0-9-+]+.[0-9-+]*\\>"
   )
  "\\<[0-9-+]+.[0-9-+]*\\>")

(defvar lammps-comment-regexp
   "#*"
  )
  "#*")

(defvar lammps-variable-regexp
   "\\$\\({[a-zA-Z0-9_]+}\\)\\|\\$[A-Za-z]"
   )
  "\\$\\({[a-zA-Z0-9_]+}\\)\\|\\$[A-Za-z]")

;; clear memory
(setq lammps-output nil)
@@ -93,9 +151,9 @@

;; 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)
(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)
@@ -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))
    )
  )
  ))