lisp/iar-linker-config-mode.el
changeset 270 61173396cfe4
parent 263 5f7cdce0e795
child 274 7c18567f0754
equal deleted inserted replaced
269:81c80df45b37 270:61173396cfe4
       
     1 ;;; iar-linker-config-mode.el --- major mode for highlighting IAR Embedded Workbench 5.x linker scripts
       
     2 
       
     3 ;; Copyright (C) 2009, 2010 by Oleksandr Gavenko <gavenkoa@gmail.com>
       
     4 
       
     5 ;; Author: Oleksandr Gavenko <gavenkoa@gmail.com>
       
     6 ;; Maintainer: Oleksandr Gavenko <gavenkoa@gmail.com>
       
     7 ;; Created: 2009-11-08
       
     8 ;; Version: 0.1
       
     9 ;; Keywords: languages
       
    10 
       
    11 ;;; Commentary:
       
    12 ;;
       
    13 ;; Very pure highlighting and not all available syntax.
       
    14 
       
    15 ;;; Code:
       
    16 
       
    17 (define-generic-mode iar-linker-config-mode
       
    18   '("// " ("/*" . "*/"))
       
    19   '("zeroinit" "code" "readwrite" "rw" "readonly" "ro")
       
    20   '(
       
    21     ("\\(define +symbol\\) +\\([_a-zA-Z0-9]+\\) *= *\\(0x[0-9a-fA-F]+\\);"
       
    22      (1 font-lock-keyword-face)
       
    23      (2 font-lock-variable-name-face)
       
    24      (3 font-lock-constant-face) )
       
    25     ("\\(define +memory\\) +\\([_a-zA-Z]+\\) +\\(with +size\\) = \\(0x[0-9a-fA-F]+\\|[0-9]+\\)[GMK]?;"
       
    26      (1 font-lock-keyword-face)
       
    27      (2 font-lock-variable-name-face)
       
    28      (3 font-lock-keyword-face)
       
    29      (4 font-lock-constant-face) )
       
    30     ("\\([_a-zA-Z]+\\):\\[\\(from\\) +\\([_a-zA-Z0-9]+\\) +\\(to\\|size\\) +\\([_a-zA-Z0-9]+\\)\\]"
       
    31      (1 font-lock-variable-name-face)
       
    32      (2 font-lock-keyword-face)
       
    33      (3 font-lock-variable-name-face)
       
    34      (4 font-lock-keyword-face)
       
    35      (5 font-lock-variable-name-face) )
       
    36     ("\\(define +region\\) +\\([_a-zA-Z]+\\) *="
       
    37      (1 font-lock-keyword-face)
       
    38      (2 font-lock-variable-name-face) )
       
    39     ("\\(define +block\\) +\\([_a-zA-Z]+\\) +\\(with +alignment\\) *= *[0-9]+, *\\(size\\) *= *\\([_a-zA-Z]+\\).*;"
       
    40      (1 font-lock-keyword-face)
       
    41      (2 font-lock-variable-name-face)
       
    42      (3 font-lock-keyword-face)
       
    43      (4 font-lock-keyword-face)
       
    44      (5 font-lock-variable-name-face) )
       
    45     ("\\(do +not +initialize\\) *{"
       
    46      (1 font-lock-keyword-face) )
       
    47     ("\\(place +in\\) +\\([_a-zA-Z]+\\) *{"
       
    48      (1 font-lock-keyword-face)
       
    49      (2 font-lock-variable-name-face) )
       
    50     ("\\(place +at +address\\) +\\([_a-zA-Z]+\\):\\([_a-zA-Z]+\\) *{"
       
    51      (1 font-lock-keyword-face)
       
    52      (2 font-lock-variable-name-face)
       
    53      (3 font-lock-variable-name-face) )
       
    54     ("\\(initialize by copy\\) *{"
       
    55      (1 font-lock-keyword-face) )
       
    56     ("\\(block\\|section\\) +\\([_.a-zA-Z0-9]+\\)"
       
    57      (1 font-lock-keyword-face)
       
    58      (2 font-lock-variable-name-face) )
       
    59     )
       
    60   (list "\\.\\(icf\\)\\'")
       
    61   (list
       
    62    (lambda () (setq comment-start "/* " comment-end " */"))
       
    63    )
       
    64   "Generic mode for iar linker config files.")
       
    65 
       
    66 (provide 'iar-linker-config-mode)
       
    67 
       
    68 ;;; iar-linker-config-mode.el ends here