iar-linker-config-mode.el
changeset 318 6a430707c23e
parent 279 fd6164dfec82
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iar-linker-config-mode.el	Mon Feb 22 11:49:37 2010 +0200
@@ -0,0 +1,71 @@
+;;; iar-linker-config-mode.el --- major mode for highlighting IAR Embedded Workbench 5.x linker scripts
+
+;; Copyright (C) 2009, 2010 by Oleksandr Gavenko <gavenkoa@gmail.com>
+
+;; You can do anything with this file without any warranty.
+
+;; Author: Oleksandr Gavenko <gavenkoa@gmail.com>
+;; Maintainer: Oleksandr Gavenko <gavenkoa@gmail.com>
+;; Created: 2009-11-08
+;; Version: 0.1
+;; Keywords: languages
+
+;;; Commentary:
+;;
+;; Very pure highlighting and not all available syntax.
+
+;;; Code:
+
+;;;###autoload
+(define-generic-mode iar-linker-config-mode
+  '("// " ("/*" . "*/"))
+  '("zeroinit" "code" "readwrite" "rw" "readonly" "ro")
+  '(
+    ("\\(define +symbol\\) +\\([_a-zA-Z0-9]+\\) *= *\\(0x[0-9a-fA-F]+\\);"
+     (1 font-lock-keyword-face)
+     (2 font-lock-variable-name-face)
+     (3 font-lock-constant-face) )
+    ("\\(define +memory\\) +\\([_a-zA-Z]+\\) +\\(with +size\\) = \\(0x[0-9a-fA-F]+\\|[0-9]+\\)[GMK]?;"
+     (1 font-lock-keyword-face)
+     (2 font-lock-variable-name-face)
+     (3 font-lock-keyword-face)
+     (4 font-lock-constant-face) )
+    ("\\([_a-zA-Z]+\\):\\[\\(from\\) +\\([_a-zA-Z0-9]+\\) +\\(to\\|size\\) +\\([_a-zA-Z0-9]+\\)\\]"
+     (1 font-lock-variable-name-face)
+     (2 font-lock-keyword-face)
+     (3 font-lock-variable-name-face)
+     (4 font-lock-keyword-face)
+     (5 font-lock-variable-name-face) )
+    ("\\(define +region\\) +\\([_a-zA-Z]+\\) *="
+     (1 font-lock-keyword-face)
+     (2 font-lock-variable-name-face) )
+    ("\\(define +block\\) +\\([_a-zA-Z]+\\) +\\(with +alignment\\) *= *[0-9]+, *\\(size\\) *= *\\([_a-zA-Z]+\\).*;"
+     (1 font-lock-keyword-face)
+     (2 font-lock-variable-name-face)
+     (3 font-lock-keyword-face)
+     (4 font-lock-keyword-face)
+     (5 font-lock-variable-name-face) )
+    ("\\(do +not +initialize\\) *{"
+     (1 font-lock-keyword-face) )
+    ("\\(place +in\\) +\\([_a-zA-Z]+\\) *{"
+     (1 font-lock-keyword-face)
+     (2 font-lock-variable-name-face) )
+    ("\\(place +at +address\\) +\\([_a-zA-Z]+\\):\\([_a-zA-Z]+\\) *{"
+     (1 font-lock-keyword-face)
+     (2 font-lock-variable-name-face)
+     (3 font-lock-variable-name-face) )
+    ("\\(initialize by copy\\) *{"
+     (1 font-lock-keyword-face) )
+    ("\\(block\\|section\\) +\\([_.a-zA-Z0-9]+\\)"
+     (1 font-lock-keyword-face)
+     (2 font-lock-variable-name-face) )
+    )
+  (list "\\.\\(icf\\)\\'")
+  (list
+   (lambda () (setq comment-start "/* " comment-end " */"))
+   )
+  "Generic mode for iar linker config files.")
+
+(provide 'iar-linker-config-mode)
+
+;;; iar-linker-config-mode.el ends here