Skip to content

Instantly share code, notes, and snippets.

@iwillspeak
Created August 14, 2013 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwillspeak/6234995 to your computer and use it in GitHub Desktop.
Save iwillspeak/6234995 to your computer and use it in GitHub Desktop.
Mode files for Emacs
;; Defines a simple generic mode to hilight lasm files
(define-generic-mode 'lasm-mode
;; Comment start marker, we just do single line comments for now
'("//")
;; Keywords, these are just taken verbose from opslist.h
'("pushloc" "pusharg" "pushlitn" "pushlitd" "pushlits" "pushtrue" "pushfalse"
"pushnull" "pushident" "poploc" "poparg" "dup" "pop" "idlook" "ntod" "ntos"
"dtos" "btos" "xton" "xtod" "xtob" "xtos" "add" "sub" "mul" "div" "mod"
"pow" "log" "neg" "inc" "dec" "cat" "slice" "strchar" "strcmp" "lt" "lteq"
"gt" "gteq" "eq" "noteq" "not" "and" "or" "print" "jump" "jumpt" "jumpf"
"call" "ret" "creset" "cnext" "cended" "cgeti" "cgetk" "lmake"
"lgeti" "lseti" "lpush" "mmake" "mgeti" "mseti" "mdeli" "opushnew"
"ogetfield" "osetfield" "omethlook")
;; Extra font locks, this is for labels and pseudo operators
'(("^[a-z]+:" . 'font-lock-type-face)
("\\(\\.\\(import\\|func\\)\\)" . 'font-lock-builtin-face)
("\\-?[0-9]+\\(\\.[0-9]*\\)?" . 'font-lock-constant-face))
;; Lasm is where it's at
'("\\.lasm$")
;; No extra functions to attach
nil
;; Docstring, says it all realy
"A simple mode for editing Leet Lang assembly files")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment