Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stéphane Adjemian
dynare
Commits
4875d6c1
Commit
4875d6c1
authored
14 years ago
by
Sébastien Villemot
Browse files
Options
Downloads
Patches
Plain Diff
Added Dynare mode for Emacs contributed by Yannick Kalantzis
parent
c47b1775
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
dynare.el
+112
-0
112 additions, 0 deletions
dynare.el
license.txt
+17
-0
17 additions, 0 deletions
license.txt
windows/dynare.nsi
+2
-1
2 additions, 1 deletion
windows/dynare.nsi
with
131 additions
and
1 deletion
dynare.el
0 → 100644
+
112
−
0
View file @
4875d6c1
;;; dynare.el --- major mode to edit .mod files for dynare
;; Created: 2010 Sep 10
;; Version: 0.1
;; 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 GNU Emacs; see the file COPYING. 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))
;;; Changelog
;; 2010-09-07 by Yannick Kalantzis
;; Minor changes. Add `require'. Add builtin operators `;' and `='.
;; 2010-09-06 by Yannick Kalantzis
;; 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
'
(
"var"
"varexo"
"parameters"
"model"
"initval"
"endval"
"end"
"shocks"
"periods"
"values"
"resid"
"for"
"endfor"
"define"
"in"
)
"dynare keywords."
)
(
defvar
dynare-functions
'
(
"simul"
"steady"
"check"
"rplot"
"dynatype"
)
"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-functions-regexp
.
font-lock-function-name-face
)
(
,
dynare-keywords-regexp
.
font-lock-keyword-face
)
(
";\\|="
.
font-lock-builtin-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 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
This diff is collapsed.
Click to expand it.
license.txt
+
17
−
0
View file @
4875d6c1
...
@@ -305,3 +305,20 @@ License: GPL-2+ with special Autoconf exception
...
@@ -305,3 +305,20 @@ License: GPL-2+ with special Autoconf exception
configuration script generated by GNU Autoconf, you may include
configuration script generated by GNU Autoconf, you may include
it under the same distribution terms that you use for the rest
it under the same distribution terms that you use for the rest
of that program.
of that program.
Files: dynare.el
Copyright: 2010, Yannick Kalantzis
License: GPL-3+
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 GNU Emacs; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>.
This diff is collapsed.
Click to expand it.
windows/dynare.nsi
+
2
−
1
View file @
4875d6c1
...
@@ -52,7 +52,7 @@ Section "Dynare core (preprocessor and M-files)"
...
@@ -52,7 +52,7 @@ Section "Dynare core (preprocessor and M-files)"
SectionIn RO
SectionIn RO
!insertmacro DETERMINE_CONTEXT
!insertmacro DETERMINE_CONTEXT
SetOutPath $INSTDIR
SetOutPath $INSTDIR
File README.txt mexopts.bat ..\license.txt
File README.txt mexopts.bat ..\license.txt
..\dynare.el
SetOutPath $INSTDIR\matlab
SetOutPath $INSTDIR\matlab
File /r ..\matlab\*.m
File /r ..\matlab\*.m
...
@@ -145,6 +145,7 @@ Section "Uninstall"
...
@@ -145,6 +145,7 @@ Section "Uninstall"
Delete $INSTDIR\README.txt
Delete $INSTDIR\README.txt
Delete $INSTDIR\license.txt
Delete $INSTDIR\license.txt
Delete $INSTDIR\mexopts.bat
Delete $INSTDIR\mexopts.bat
Delete $INSTDIR\dynare.el
Rmdir /r $INSTDIR\matlab
Rmdir /r $INSTDIR\matlab
Rmdir /r $INSTDIR\mex
Rmdir /r $INSTDIR\mex
Rmdir /r $INSTDIR\dynare++
Rmdir /r $INSTDIR\dynare++
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment