Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mapfile v2 colouring
(define-generic-mode mapfile-mode
'(?#)
'("CAPABILITY" "DEPEND_VERSIONS" "HDR_NOALLOC" "LOAD_SEGMENT"
"NOTE_SEGMENT" "NULL_SEGMENT" "PHDR_ADD_NULL" "SEGMENT_ORDER"
"STACK" "SYMBOL_SCOPE" "SYMBOL_VERSION" "STUB_OBJECT")
`(("^\$[^\s-]+" 0 font-lock-preprocessor-face)
("\\<SYMBOL_VERSION\\s-+\\<\\([A-Za-z0-9_.]+\\)\\>"
1 font-lock-function-name-face)
;; visibility
("\\<\\(global\\|local\\|protected\\|default\\|hidden\\|symbolic\\):" 0
font-lock-type-face)
;; CAPABILITY
(,(regexp-opt '("HW_1" "HW_2" "MACHINE" "PLATFORM" "SF") 'words) 0
font-lock-variable-name-face)
;; DEPEND_VERSIONS
(,(regexp-opt '("ALLOW" "REQUIRE") 'words) 0 font-lock-variable-name-face)
;; _SEGMENT
(,(regexp-opt '("ASSIGN_SECTION" "FILE_BASENAME" "FILE_OBJNAME" "FILE_PATH"
"FLAGS" "IS_NAME" "TYPE" "IS_ORDER" "OS_ORDER" "ALIGN"
"MAX_SIZE" "PADDR" "ROUND" "SIZE_SYMBOL" "VADDR") 'words)
0 font-lock-variable-name-face)
(,(regexp-opt '("DISABLE" "NOHDR") 'words) 0 font-lock-keyword-face)
(,(regexp-opt '("ALLOC" "WRITE" "EXECUTE" "AMD64_LARGE") 'words)
0 font-lock-constant-face)
;; SYMBOL_VERSION/SCOPE
(,(regexp-opt '("ASSERT" "FILTER" "FLAGS" "SIZE" "TYPE" "VALUE" "AUXILIARY"
"SH_ATTR" "BIND" "ALIAS") 'words)
0 font-lock-variable-name-face)
(,(regexp-opt '("BITS" "NOBITS" "DIRECT" "DYNSORT" "EXTERN" "INTERPOSE"
"NODIRECT" "NODYNSORT" "NOSTUB" "PARENT" "WEAK"
"LOCAL" "GLOBAL") 'words)
0 font-lock-constant-face)
(,(regexp-opt '("FUNCTION" "OBJECT" "DATA" "COMMON" "TLS") 'words)
0 font-lock-constant-face))
'("mapfile-vers\\'")
nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment