;;; C++ highlighting package ;; Put these contents in a file "hilit-cpp.el", and activate in .emacs with ;; (require 'hilit19) ;; (load "/pathname-to-this-file/hilit-cpp") ;; Bill Harlan (hilit-set-mode-patterns 'c++-mode '( ;; red flags ("\\<\\(XXX\\|xxx\\|TODO\\)\\>" nil red) ;; comments ("/\\*\\*" "\\*/" lightgreen) ("\\(^\\|[^/]\\)/\\*" "\\*/" orange) ("//.*$" nil orange) ;; Directives ("^\\([#] *\\(if \\|define \\|include \\|line \\|elif \\|endif\\|error \\|pragma \\|undef \\|ifn?def \\|else\\).*$\\)" nil green) ("^[^ \t].*::[^ \t(]*" nil green) ("^class[ \t]+[^ \t]+[ \t]" nil green) ;; strings (hilit-string-find ?' moccasin) ;; errors ("^\\([#] *[a-zA-Z]*\\>\\)" nil red) ;; misspelled directive ("\\<\\(null\\|NULL\\|Bool\\|boolean\\)\\>" red) ;; ;; Macros, typedefs, constants in all caps ("\\<\\([A-Z][A-Z]+\\)\\>" nil white) ;; member variables ("[^a-zA-Z0-9_]\\([scfmk]?_[a-z][a-zA-Z_0-9]*\\)\\>" nil gray80) ("[^a-zA-Z0-9_]\\([scfmk][A-Z][a-zA-Z_0-9]*\\)\\>" nil gray80) ;; key words ;("[^_]\\< \\>[^_]" ("\\<\\(static_cast\\|dynamic_cast\\|const_cast\\|extern\\|invalid_argument\\|logic_error\\|runtime_error\\|assert\\|operator\\|typedef\\|namespace\\|class\\|template\\|virtual\\|const\\|return\\|goto\\|if\\|else\\|enum\\|case\\|switch\\|break\\|continue\\|while\\|do\\|for\\|default\\|public\\|protected\\|private\\|abstract\\|static\\|mutable\\|delete\\|new\\|this\\|try\\|catch\\|throw\\)\\>" 0 cyan) ;; standard values ("\\<\\([tT]rue\\|[fF]alse\\|cerr\\|cout\\|cin\\|endl\\)\\>" nil gray80) ;; any ascii character 'a' ("[ \n\t(),=.{]\\('..'\\|'.'\\)[ \n\t):;,!=.]" nil gray80) ;;nil white-bold) ;; primitive types ("[^_]\\<\\(bool\\|string\\|float\\|double\\|void\\|Boolean\\|char\\|byte\\|short\\|int\\|long\\)\\>[^_]" nil yellow) ;; Objects/Class names ("\\<\\([A-Z][a-zA-Z0-9]+\\.?\\)+\\>" nil yellow) ("\\<[a-z]+_t\\>" nil yellow) ("\\<\\(T\\)\\>" nil yellow) ) ) ;;