SRecode templates for MATLAB Script.

This commit is contained in:
zappo 2009-07-06 19:51:41 +00:00
parent 564db2c9e0
commit 37b77b5615

View file

@ -0,0 +1,112 @@
;; srecode-matlab.srt --- SREcode Templates for MATLAB.
;; Copyright (C) 2008 Eric Ludlam
;; Author: Eric Ludlam <eludlam@mathworks.com>
;; X-RCS: $Id$
;; 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 2, 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; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
set mode "matlab-mode"
set escape_start "{{"
set escape_end "}}"
context file
set comment_start "%"
set comment_prefix "%"
set comment_end ""
;; @todo - add argument support.
;; choose template based on script/function or class in current dir.
template empty :file :user :time
"Fill out an empty file."
----
function {{FILE}}
% {{FILE:upcase}} -
{{comment_prefix}} Copyright (C) {{YEAR}} {{?AUTHOR}}
{{^}}
end
----
bind "e"
context declaration
prompt NAME "Name for declaration: "
template classdef :time
"Template to declare a class"
----
classdef {{?NAME}}
% Class {{NAME}}
%
% Copyright (C) {{YEAR}} {{?AUTHOR}}
properties
end
methods
function h = {{NAME}}(varargin)
{{^}}
end
end
end
----
bind "c"
template function :blank :indent
"Template to declare a function."
----
function {{?NAME}}
{{^}}
end
----
bind "f"
template variable :blank :indent
"Template to declare a variable."
----
global {{?NAME}}
----
bind "v"
context code
template function :blank :indent
"Nested functions are indented."
----
function {{?NAME}}
{{^}}
end
----
bind "f"
template variable :blank :indent
"Template to declare a variable."
----
persistent {{?NAME}}
----
bind "v"
;; end