This file is indexed.

/usr/share/emacs/site-lisp/dynare-common/dynare.el is in dynare-common 4.4.1-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
;;; dynare.el --- major mode to edit .mod files for dynare
;; Created: 2010 Sep 10
;; Version: 0.2

;; Copyright (C) 2010 Yannick Kalantzis
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see
;; <http://www.gnu.org/licenses/>.

;; Keywords: dynare

;; To comment/uncomment, use `ALT-;'. See `comment-dwim' for further details.

;;; Installation:
;;
;;   Put the this file as "dynare.el" somewhere on your load path, then
;;   add this to your .emacs or site-init.el file:
;;
;;   (require 'dynare)
;;   (autoload 'dynare-mode "dynare" "Enter dynare mode." t)
;;   (setq auto-mode-alist (cons '("\\.mod\\'" . dynare-mode) auto-mode-alist))

;;; Commentary:
;;
;;   Use C-c ; to comment/uncomment (or the default M-;).

;;; Changelog
;;
;;  2010-10-08 by Yannick Kalantzis v0.2
;;    Change syntax table: decimal numbers are words, mathematical
;;    operators are punctuation. `@' and `#' are symbols.
;;    Better font-lock for var, varexo, and parameters declaration,
;;    and for macrocommands.
;;    Add new keybinding for comment/uncomment: C-c ;
;;
;;  2010-09-07 by Yannick Kalantzis 
;;    Minor changes. Add `require'. Add builtin operators `;' and `='.
;;    Highlight lags and leads.
;;
;;  2010-09-06 by Yannick Kalantzis v0.1
;;    Created.  
;;    Reproduces Xah Lee's instructions.  See
;;    <http://xahlee.org/emacs/elisp_syntax_coloring.html>. Very basic
;;    syntax highlighting: comments, some keywords.

;;; TODO
;;    - indentation 
;;    - blocks templates "model/end", "initval/end", etc.
;;    - functions to insert main keywords

;;; Code:

;; function to comment/uncomment text
(defun dynare-comment-dwim (arg)
"Comment or uncomment current line or region in a smart way.
For detail, see `comment-dwim'."
   (interactive "*P")
   (require 'newcomment)
   (let ((deactivate-mark nil) (comment-start "//") (comment-end ""))
     (comment-dwim arg)))

;; define several class of keywords
(defvar dynare-keywords
  '("model" "initval" "endval" "end" "shocks" "periods" "values") 
  "dynare keywords.")

(defvar dynare-constructs-regexp
  "^[\s-]*\\(var\\|varexo\\|parameters\\)[a-zA-Z0-9,\s-@{}]*;"
  "regexp for dynare constructs.")

(defvar dynare-macrocommand-regexp
  "\\(@#define\\|@#include\\|@#endfor\\|@#for\\s-+[a-zA-Z0-9]+\\s-+in\\s-+[a-zA-Z0-9]+\\|@{[a-zA-Z0-9]+}\\)"
  "regexp for dynare macrocommand.")

(defvar dynare-functions
  '("simul" "stoch_simul" "steady" "check" "rplot" "dynatype" "dynasave" "resid")
  "dynare functions.")

;; create the regex string for each class of keywords
(defvar dynare-keywords-regexp (regexp-opt dynare-keywords 'words))
(defvar dynare-functions-regexp (regexp-opt dynare-functions 'words))

;; clear memory
(setq dynare-keywords nil)
(setq dynare-functions nil)

;; create the list for font-lock.
;; each class of keyword is given a particular face
(setq dynare-font-lock-keywords
  `(
    (,dynare-macrocommand-regexp . font-lock-builtin-face)
    (,dynare-functions-regexp . font-lock-function-name-face)
    (,dynare-keywords-regexp . font-lock-keyword-face)
    (,dynare-constructs-regexp . font-lock-keyword-face)
    (";\\|=" . font-lock-builtin-face)
    ("(\\(+\\|-\\)[1-9])" . font-lock-constant-face)
    ))

;; define the major mode
(define-derived-mode dynare-mode fundamental-mode
  "dynare mode"
  "dynare is a mode for editing mod files used by dynare."
  (setq mode-name "dynare mode")

  ;; modify the keymap
  (define-key dynare-mode-map [remap comment-dwim] 'dynare-comment-dwim)
  (define-key dynare-mode-map (kbd "C-c ;") 'dynare-comment-dwim)


  ;; decimal numbers should be treated as words
  (modify-syntax-entry ?\. "w" dynare-mode-syntax-table) 

  ;; mathematical operators are treated as punctuation
  (modify-syntax-entry ?+ "." dynare-mode-syntax-table)
  (modify-syntax-entry ?- "." dynare-mode-syntax-table)
  (modify-syntax-entry ?* "." dynare-mode-syntax-table)
  (modify-syntax-entry ?/ "." dynare-mode-syntax-table)
  (modify-syntax-entry ?^ "." dynare-mode-syntax-table)

  ;; symbols for the macrolanguage
  (modify-syntax-entry ?@ "_" dynare-mode-syntax-table)
  (modify-syntax-entry ?# "_" dynare-mode-syntax-table)

  ;; define C++ style comment  “/* ... */” and “// ...” 
  (modify-syntax-entry ?\/ ". 124b" dynare-mode-syntax-table) 
  ;; "/" is the 1st and 2nd char of /* and */ (a-style) and the 2nd char of //
  ;; (b-style)
  (modify-syntax-entry ?* ". 23" dynare-mode-syntax-table)
  ;; "*" is the 2nd and 1st char of /* and */ (a-style only)
  (modify-syntax-entry ?\n "> b" dynare-mode-syntax-table)
  ;; newline is the comment-end sequence of b-style comments

  ;; syntax highlighting
  (setq font-lock-defaults '((dynare-font-lock-keywords)))

  ;; clear memory
  (setq dynare-keywords-regexp nil)
  (setq dynare-functions-regexp nil)
  )

(provide 'dynare)
;;; dynare.el ends here