From c05676c5ac4c1722bcac8a31668f5fab2e7ae6d4 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 3 Oct 2009 19:28:56 +0000 Subject: [PATCH] * srecode: New directory for SRecode template files. --- etc/ChangeLog | 4 + etc/srecode/cpp.srt | 260 ++++++++++++++++++++++++++++++ etc/srecode/default.srt | 63 ++++++++ etc/srecode/doc-cpp.srt | 84 ++++++++++ etc/srecode/doc-default.srt | 80 ++++++++++ etc/srecode/doc-java.srt | 85 ++++++++++ etc/srecode/ede-make.srt | 49 ++++++ etc/srecode/el.srt | 311 ++++++++++++++++++++++++++++++++++++ etc/srecode/getset-cpp.srt | 50 ++++++ etc/srecode/java.srt | 181 +++++++++++++++++++++ etc/srecode/make.srt | 79 +++++++++ etc/srecode/template.srt | 224 ++++++++++++++++++++++++++ etc/srecode/test.srt | 148 +++++++++++++++++ etc/srecode/texi.srt | 173 ++++++++++++++++++++ etc/srecode/wisent.srt | 94 +++++++++++ 15 files changed, 1885 insertions(+) create mode 100644 etc/srecode/cpp.srt create mode 100644 etc/srecode/default.srt create mode 100644 etc/srecode/doc-cpp.srt create mode 100644 etc/srecode/doc-default.srt create mode 100644 etc/srecode/doc-java.srt create mode 100644 etc/srecode/ede-make.srt create mode 100644 etc/srecode/el.srt create mode 100644 etc/srecode/getset-cpp.srt create mode 100644 etc/srecode/java.srt create mode 100644 etc/srecode/make.srt create mode 100644 etc/srecode/template.srt create mode 100644 etc/srecode/test.srt create mode 100644 etc/srecode/texi.srt create mode 100644 etc/srecode/wisent.srt diff --git a/etc/ChangeLog b/etc/ChangeLog index 861b2064e7..7d1ef38b32 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2009-10-03 Chong Yidong + + * srecode: New directory for SRecode template files. + 2009-10-01 Michael Albinus * NEWS: delete-directory has an optional parameter RECURSIVE. diff --git a/etc/srecode/cpp.srt b/etc/srecode/cpp.srt new file mode 100644 index 0000000000..4a144eb810 --- /dev/null +++ b/etc/srecode/cpp.srt @@ -0,0 +1,260 @@ +;;; cpp.srt --- SRecode templates for c++-mode + +;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set mode "c++-mode" + +set comment_start "/**" +set comment_end " */" +set comment_prefix " *" + +;; OVERRIDE THIS in your user or project template file to whatever +;; you use for your project. +set HEADEREXT ".h" + +context file + +template empty :time :user :file :cpp +---- +{{>:filecomment}} + +{{#NOTHEADER}} + +{{^}} +{{/NOTHEADER}} +{{#HEADER}} +{{>:header_guard}} +{{/HEADER}} +---- + +template header_guard :file :blank +---- +#ifndef {{FILENAME_SYMBOL}} +#define {{FILENAME_SYMBOL}} 1 + +{{^}} + +#endif // {{FILENAME_SYMBOL}} +---- + +context misc + +template arglist +"Insert an argument list for a function. +@todo - Support smart CR in a buffer for not too long lines." +---- +({{#ARGS}}{{TYPE}} {{NAME}}{{#NOTLAST}},{{/NOTLAST}}{{/ARGS}}) +---- + +context declaration + +prompt TYPE "Return Type: " + +template function :indent :blank +"Insert a function declaration." +---- +{{?TYPE}} {{?NAME}}{{>:misc:arglist}} +{{#INITIALIZERS}}{{>B:initializers}}{{/INITIALIZERS}} +{ +{{^}} +} +---- +bind "f" + +template function-prototype :indent :blank +"Insert a function declaration." +---- +{{?TYPE}} {{?NAME}}{{>:misc:arglist}}; +---- + + +prompt TYPE "Data Type: " + +template variable :indent :blank +"Insert a variable declaration." +---- +{{?TYPE}} {{?NAME}}{{#HAVEDEFAULT}} = {{DEFAULT}}{{/HAVEDEFAULT}}; +---- +bind "v" + +template variable-prototype :indent :blank +"Insert a variable declaration." +---- +{{?TYPE}} {{?NAME}}; +---- +bind "v" + +template class :indent :blank +"Insert a C++ class. For use by user insertion. +Override this template to change contents of a class. +Override `class-tag' to override the outer structure of the class." +---- +{{CONSTRUCTOR:classdecl:constructor-tag}} + {{>DESTRUCTOR:classdecl:destructor-tag}} + private: + {{^}} + +{{/A}} +---- + +template subclass :indent :blank +"Insert a C++ subclass of some other class." +sectiondictionary "PARENTS" +set NAME "?PARENTNAME" +---- +{{>A:class}} +---- + +template class-tag :indent :blank +"Insert a C++ class with the expectation of it being used by a tag inserter. +Override this to affect applications, or the outer class structure for +the user-facing template." +---- +class {{?NAME}} {{#PARENTS}}{{#FIRST}}: {{/FIRST}}public {{NAME}}{{/PARENTS}} +{ + {{^}} +}; +---- +bind "c" + +template method :indent :blank +"Method belonging to some class, declared externally." +---- +{{?TYPE}} {{?PARENT}}::{{?NAME}}{{>:misc:arglist}} +{{#INITIALIZERS}}{{>B:initializers}}{{/INITIALIZERS}} +{ +{{^}} +} +---- + +template include :blank +"An include statement." +---- +#include "{{?NAME}}" +---- +bind "i" + +template label :blank :indent +---- + {{?NAME}}: +---- + +context classdecl + +template constructor-tag :indent :blank +---- +{{?NAME}}{{>:misc:arglist}} +{ {{^}} } +---- + +;; This one really sucks. How can I finish it? +template initializers :indent +---- +{{#FIRST}}: +{{/FIRST}}{{INITNAME}}(){{#NOTLAST}},{{/NOTLAST}} +---- + +template destructor-tag :indent :blank +---- +~{{?NAME}}{{>:misc:arglist}} +{ {{^}} } +---- + +;;; Base Comment functions for overriding. +context classdecl + +template comment-function-group-start :indent :blank +"Used for putting comments in front of a functional group of declarations. +Override this with your own preference to avoid using doxygen." +---- +{{>A:classdecl:doxygen-function-group-start}} +---- + +template comment-function-group-end :indent :blank +"Used for putting comments in front of a functional group of declarations. +Override this with your own preference to avoid using doxygen." +---- +{{>A:classdecl:doxygen-function-group-end}} +---- + +context declaration + +template comment-function :indent :blank +"Used to put a nice comment in front of a function. +Override this with your own preference to avoid using doxygen" +---- +{{>A:declaration:doxygen-function}} +---- + +;;; DOXYGEN FEATURES +;; +;; +context classdecl + +prompt GROUPNAME "Name of declaration group: " + +template doxygen-function-group-start :indent :blank +---- +/** + * {{?GROUPNAME}} + * @{ + */ + +---- + +template doxygen-function-group-end :indent :blank +---- +/** + * @} + */ + +---- + +context declaration + +template doxygen-function :indent :blank +---- +/** + * @name {{NAME}} - {{DOC}}{{^}}{{#ARGS}} + * @param {{NAME}} - {{DOC}}{{/ARGS}} + * @return {{TYPE}} + */ +---- + +template doxygen-variable-same-line +---- +/**< {{DOC}}{{^}} */ +---- + +template doxygen-section-comment :blank :indent +"Insert a comment that separates sections of an Emacs Lisp file." +---- + +/** {{?TITLE}} + * + * {{^}} + */ + +---- + + +;; end diff --git a/etc/srecode/default.srt b/etc/srecode/default.srt new file mode 100644 index 0000000000..a4fae80f6a --- /dev/null +++ b/etc/srecode/default.srt @@ -0,0 +1,63 @@ +;;; default.srt --- SRecode templates for srecode-template-mode + +;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set mode "default" + +set comment_start "#" + +set COPYRIGHT "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 DOLLAR "$" + +context file + +template copyright +---- +{{COPYRIGHT:srecode-comment-prefix}} +---- + +template filecomment :file :user :time +---- +{{comment_start}} {{FILENAME}} --- {{^}} +{{comment_prefix}} +{{comment_prefix}} Copyright (C) {{YEAR}} {{?AUTHOR}} +{{comment_prefix}} +{{comment_prefix}} Author: {{AUTHOR}} <{{EMAIL}}>{{#RCS}} +{{comment_prefix}} X-RCS: {{DOLLAR}}Id{{DOLLAR}}{{/RCS}} +{{comment_prefix}} +{{>:copyright}} +{{comment_end}} +---- + +;; end \ No newline at end of file diff --git a/etc/srecode/doc-cpp.srt b/etc/srecode/doc-cpp.srt new file mode 100644 index 0000000000..c7933447b6 --- /dev/null +++ b/etc/srecode/doc-cpp.srt @@ -0,0 +1,84 @@ +;; doc-c.srt --- SRecode templates for "document" applications + +;; Copyright (C) 2008, 2009 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set mode "c++-mode" + +set application "document" +context declaration + +;;; Notes on the DOCUMENT templates. +;; +;; These templates recycle existing templates for doxygen in the +;; more general C++ template set. + +template section-comment :indent :blank +"A comment separating major sections of a file." +---- +{{>:declaration:doxygen-section-comment}} +---- + +template function-comment :tag :indent :blank +"A comment occuring in front of a function. +Recycle doxygen comment code from the more general template set." +---- +{{>:declaration:doxygen-function}} +---- + +template variable-same-line-comment :tag +"A comment occuring after a veriable declaration. +Recycle doxygen comment code from the more general template set." +---- +{{>:declaration:doxygen-variable-same-line}} +---- + +;; These happen to be the same as in a classdecl. +template group-comment-start :blank :indent +"A comment occuring in front of a group of declarations. +Recycle doxygen comment code from the more general template set." +---- +{{>:classdecl:doxygen-function-group-start}} +---- + +template group-comment-end :blank :indent +"A comment occuring at the end of a a group of declarations. +Recycle doxygen comment code from the more general template set." +---- +{{>:classdecl:doxygen-function-group-end}} +---- + +;; Some templates only show up in classdecls. +context classdecl + +template group-comment-start :blank :indent +"A comment occuring in front of a group of declarations. +Recycle doxygen comment code from the more general template set." +---- +{{>:classdecl:doxygen-function-group-start}} +---- + +template group-comment-end :blank :indent +"A comment occuring at the end of a a group of declarations. +Recycle doxygen comment code from the more general template set." +---- +{{>:classdecl:doxygen-function-group-end}} +---- + +;; end diff --git a/etc/srecode/doc-default.srt b/etc/srecode/doc-default.srt new file mode 100644 index 0000000000..76cae31430 --- /dev/null +++ b/etc/srecode/doc-default.srt @@ -0,0 +1,80 @@ +;; doc-default.srt --- SRecode templates for "document" applications + +;; Copyright (C) 2009 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set mode "default" + +set application "document" + +context declaration + +template section-comment :blank :indent +"A comment occuring in front of a group of declarations." +---- +{{comment_start}} {{?TITLE}} +{{comment_prefix}} +{{comment_prefix}} {{^}} +{{comment_end}} +---- + +template function-comment :tag :indent :blank +"A comment occuring in front of a function." +---- +{{comment_start}} {{?NAME}} -- +{{DOC:srecode-comment-prefix}} +{{comment_end}} +---- + +template variable-same-line-comment :tag +"A comment occuring after a veriable declaration." +---- +{{comment_start}} {{?DOC}} {{comment_end}} +---- + +;; These happen to be the same as in a classdecl. +template group-comment-start :blank :indent +"A comment occuring in front of a group of declarations." +---- +{{comment_start}} {{?GROUPNAME}} -- +{{comment_end}} +---- + +template group-comment-end :indent +"A comment occuring at the end of a a group of declarations." +---- +{{comment_start}} End {{?GROUPNAME}} {{comment_end}} +---- + +;; Some templates only show up in classdecls. +context classdecl + +template group-comment-start :blank :indent +"A comment occuring in front of a group of declarations." +---- +{{>:declaration:group-comment-start}} +---- + +template group-comment-end :indent +"A comment occuring at the end of a a group of declarations." +---- +{{>:declaration:group-comment-end}} +---- + +;; end \ No newline at end of file diff --git a/etc/srecode/doc-java.srt b/etc/srecode/doc-java.srt new file mode 100644 index 0000000000..727ff09ba0 --- /dev/null +++ b/etc/srecode/doc-java.srt @@ -0,0 +1,85 @@ +;; doc-java.srt --- SRecode templates for "document" applications + +;; Copyright (C) 2009 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set mode "java-mode" + +set application "document" + +context declaration + +;;; Notes on the DOCUMENT templates. +;; +;; These templates recycle existing templates for javadoc in the +;; more general C++ template set. + +template section-comment :indent :blank +"A comment separating major sections of a file." +---- +{{>:declaration:javadoc-section-comment}} +---- + +template function-comment :tag :indent :blank +"A comment occuring in front of a function. +Recycle javadoc comment code from the more general template set." +---- +{{>:declaration:javadoc-function}} +---- + +template variable-same-line-comment :tag +"A comment occuring after a veriable declaration. +Recycle javadoc comment code from the more general template set." +---- +{{>:declaration:javadoc-variable-same-line}} +---- + +;; These happen to be the same as in a classdecl. +template group-comment-start :blank :indent +"A comment occuring in front of a group of declarations. +Recycle javadoc comment code from the more general template set." +---- +{{>:classdecl:javadoc-function-group-start}} +---- + +template group-comment-end :blank :indent +"A comment occuring at the end of a a group of declarations. +Recycle javadoc comment code from the more general template set." +---- +{{>:classdecl:javadoc-function-group-end}} +---- + +;; Some templates only show up in classdecls. +context classdecl + +template group-comment-start :blank :indent +"A comment occuring in front of a group of declarations. +Recycle javadoc comment code from the more general template set." +---- +{{>:classdecl:javadoc-function-group-start}} +---- + +template group-comment-end :blank :indent +"A comment occuring at the end of a a group of declarations. +Recycle javadoc comment code from the more general template set." +---- +{{>:classdecl:javadoc-function-group-end}} +---- + +;; end diff --git a/etc/srecode/ede-make.srt b/etc/srecode/ede-make.srt new file mode 100644 index 0000000000..e0d6f734db --- /dev/null +++ b/etc/srecode/ede-make.srt @@ -0,0 +1,49 @@ +;; ede-make.srt --- SRecode templates for Makefiles used by EDE. + +;; Copyright (C) 2008 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set mode "makefile-mode" +set escape_start "{{" +set escape_end "}}" +set application "ede" + +context file + +template ede-empty :file +---- +# Automatically Generated {{FILE}} by EDE. +# For use with: {{MAKETYPE}} +# +# DO NOT MODIFY THIS FILE OR YOUR CHANGES MAY BE LOST. +# EDE is the Emacs Development Environment. +# http://cedet.sourceforge.net/ede.shtml +# + +---- + +context declaration + +template ede-vars +---- +{{#VARIABLE}} +{{NAME}}={{#VALUE}} {{VAL}}{{/VALUE}}{{/VARIABLE}} +---- + +;; end \ No newline at end of file diff --git a/etc/srecode/el.srt b/etc/srecode/el.srt new file mode 100644 index 0000000000..5bd3538be6 --- /dev/null +++ b/etc/srecode/el.srt @@ -0,0 +1,311 @@ +;;; el.srt --- SRecode templates for Emacs Lisp mode + +;; Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. + +;; Author: Eric Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set escape_start "$" +set escape_end "$" + +set mode "emacs-lisp-mode" + +set comment_start ";;;" +set comment_prefix ";;" +set comment_end "" + +set DOLLAR "$" + +context file + +template section-comment :blank +"Insert a comment that separates sections of an Emacs Lisp file." +---- + +;;; $^$ +;; + +---- +bind "s" + + +template empty :user :time :file +"Insert a skeleton for an Emacs Lisp file." +---- +$>:filecomment$ + +;;; Commentary: +;; +;; $^$ + +;;; Code: + + +(provide '$FILE$) + +;;; $FILENAME$ ends here + +---- + +prompt MODESYM "Major Mode Symbol (sans -mode): " +prompt MODENAME "Nice Name of mode: " defaultmacro "MODESYM" +prompt MODEEXTENSION "File name extension for mode: " + +template major-mode :file :blank :indent +"Insert the framework needed for a major mode." +sectiondictionary "FONTLOCK" +set NAME macro "MODESYM" "-mode-font-lock-keywords" +set DOC "Keywords for use with srecode macros and font-lock." +sectiondictionary "MODEHOOK" +set NAME macro "MODESYM" "-mode-hook" +set DOC "Hook run when " macro "MODESYM" " starts." +set GROUP macro "MODESYM" "-mode" +set CUSTOMTYPE "'hook" +sectiondictionary "MODEFCN" +set NAME macro "MODESYM" "-mode" +set DOC "Major-mode for " macro "MODESYM" "-mode buffers." +set INTERACTIVE "" +---- +$>:declaration:defgroup$ + +$>:syntax-table$ + +$:declaration:keymap$ + +$" table) ;; Comment end + (modify-syntax-entry ?\" "\"" table) ;; String + (modify-syntax-entry ?\- "_" table) ;; Symbol + (modify-syntax-entry ?\\ "\\" table) ;; Quote + (modify-syntax-entry ?\` "'" table) ;; Prefix ` (backquote) + (modify-syntax-entry ?\' "'" table) ;; Prefix ' (quote) + (modify-syntax-entry ?\, "'" table) ;; Prefix , (comma) + + table) +$/A$ +---- + + +context declaration + +template include :blank +"Insert a require statement." +---- +(require '$?NAME$) +---- +bind "i" + +template include-protected :blank +"Insert a require statement." +---- +(condition-case nil + (require '$?NAME$) + (error nil)) +---- + +prompt INTERACTIVE "Is this an interactive function? " default " (interactive)\n " read y-or-n-p +prompt NAME "Name: " defaultmacro "PRENAME" + +template function :el :indent :blank +"Insert a defun outline." +---- +(defun $?NAME$ ($#ARGS$$NAME$$#NOTLAST$ $/NOTLAST$$/ARGS$) + "$DOC$" +$?INTERACTIVE$$^$ + ) +---- +bind "f" + + +template variable :el :indent :blank +"Inert a variable. +DOC is optional." +---- +(defvar $?NAME$ $^$ + "$DOC$") +---- +bind "v" + +template variable-const :el :indent :blank +"Inert a variable." +---- +(defconst $?NAME$ $^$ + "$DOC$") +---- + +template variable-option :el :el-custom :indent :blank +"Inert a variable created using defcustom." +---- +(defcustom $?NAME$ $^$ + "*$DOC$" + :group $GROUP$ + :type $?CUSTOMTYPE$) +---- +bind "o" + +template class :el :indent :blank +"Insert a new class." +---- +(defclass $?NAME$ () + (($?ARG1$ :initarg :$ARG1$ + :documentation + "$^$") + ) + "Class $NAME$ ") +---- +bind "c" + +template class-tag :el :indent :blank +"Insert a new class." +---- +(defclass $?NAME$ ($#PARENTS$$NAME$ $/PARENTS$) + ($^$ + ) + "Class $NAME$ ") +---- + +template method :el :ctxt :indent :blank +"Insert a new method." +---- +(defmethod $?NAME$ ((this $?PARENT$)) + "$DOC$" + $^$ + ) +---- +bind "m" + +template method-tag :el :ctxt :indent :blank +"Insert a new method for tag inserter." +---- +(defmethod $NAME$ ($#ARGS$$#FIRST$($NAME$ $PARENT$)$/FIRST$$#NOTFIRST$ $NAME$$/NOTFIRST$$/ARGS$) + "$DOC$" + $^$ + ) +---- + +prompt NAME "Method to Override: " defaultmacro "PRENAME" read mode-local-read-function +prompt PARENT "Major Mode for binding: " defaultmacro "MODESYM" + +;; Note: PARENT is used for override methods and for classes. Handy! +template modelocal :el :ctxt :indent :blank +"Insert a new mode-local function." +---- +(define-mode-local-override $?NAME$ $?PARENT$ () + "$DOC$" + $^$) +---- +bind "l" + + +template defgroup :indent :blank +"Create a custom group." +---- +(defgroup $?MODESYM$-mode nil + "$MODESYM$ group." + :group 'langauges) +---- +bind "g" + + +template keymap :indent :blank +"Insert a keymap of some sort" +---- +(defvar $?MODESYM$-mode-map + (let ((km (make-sparse-keymap))) + (define-key km "\C-c\C-c" '$MODESYM$-mode$^$) + km) + "Keymap used in `$MODESYM$-mode'.") +---- +bind "k" + + +context classdecl + +prompt NAME "Slot Name: " + +template variable-tag :indent :indent :blank +"A field in a class." +---- +($?NAME$ :initarg :$NAME$ + $#DEFAULTVALUE$:initform $VALUE$$/DEFAULTVALUE$ + :documentation + "$DOC$") + +---- + +template variable :indent :indent :blank +"A field in a class." +---- +($?NAME$ :initarg :$NAME$ + :initform nil + :type list + :documentation + "$DOC$") + +---- +bind "s" + + + +;; end + + diff --git a/etc/srecode/getset-cpp.srt b/etc/srecode/getset-cpp.srt new file mode 100644 index 0000000000..089f803ea3 --- /dev/null +++ b/etc/srecode/getset-cpp.srt @@ -0,0 +1,50 @@ +;;; getset-cpp.srt --- SRecode templates for C++ class getter/setters. + +;; Copyright (C) 2007, 2008 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set mode "c++-mode" +set application "getset" + +context declaration + +template getset-in-class :tag :indent :blank +---- +{{>A:classdecl:comment-function-group-start}} +{{TYPE}} get{{NICENAME}}() const { + return {{NAME}}; +} +void set{{NICENAME}}({{TYPE}} {{NICENAME}}) { + {{NAME}} = {{NICENAME}}; +} +{{>A:classdecl:comment-function-group-end}} +---- + +template getset-field :blank :indent +---- +{{?TYPE}} f{{?NAME}}; +---- + +template getset-initializer :indent +---- +f{{NAME}}(){{#NOTLAST}},{{/NOTLAST}} +---- + +;; end + diff --git a/etc/srecode/java.srt b/etc/srecode/java.srt new file mode 100644 index 0000000000..764c6fb1ed --- /dev/null +++ b/etc/srecode/java.srt @@ -0,0 +1,181 @@ +;; java.srt + +;; Copyright (C) 2009 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set mode "java-mode" +set escape_start "{{" +set escape_end "}}" + +context file + +set comment_start "/**" +set comment_end " */" +set comment_prefix " *" + +template empty :file :user :time :java :indent +"Fill out an empty file." +sectiondictionary "CLASSSECTION" +set NAME macro "FILENAME_AS_CLASS" +---- +{{>:filecomment}} + +package {{FILENAME_AS_PACKAGE}}; + +{{>CLASSSECTION:declaration:class}} + +---- +bind "e" + +context declaration + +template import :blank :indent +"Template to import a package." +---- +{{>:declaration:include}} +---- +bind "i" + +template class :blank :indent +"Template to declare a variable." +sectiondictionary "DOCSECTION" +set NAME macro "NAME" +---- +{{>DOCSECTION:declaration:javadoc-class}} +public class {{?NAME}} { + + {{^}} + +} // {{NAME}} +---- +bind "c" + +;;; Semantic Tag support +;; +template class-tag :indent :blank +"Insert a Java class with the expectation of it being used by a tag inserter. +Override this to affect applications, or the outer class structure for +the user-facing template." +---- +{{>:declaration:javadoc-class}} +public Class {{?NAME}} {{#PARENTS}}{{#FIRST}}extends {{/FIRST}}{{#NOTFIRST}}implements {{/NOTFIRST}}{{NAME}}{{/PARENTS}} +{ + {{^}} +}; +---- + +template include :blank +"An include statement." +---- +import {{NAME}}; +---- + +context misc + +template arglist +"Insert an argument list for a function. +@todo - Support smart CR in a buffer for not too long lines." +---- +({{#ARGS}}{{TYPE}} {{NAME}}{{#NOTLAST}},{{/NOTLAST}}{{/ARGS}}) +---- + +context classdecl + +template function :indent :blank +---- +public {{?TYPE}} {{?NAME}}{{>:misc:arglist}} { +{{^}} +} +---- +bind "m" + +template variable :indent :blank +"Insert a variable declaration." +---- +{{?TYPE}} {{?NAME}}{{#HAVEDEFAULT}} = {{DEFAULT}}{{/HAVEDEFAULT}}; +---- +bind "v" + +;;; Java Doc Comments +;; +context classdecl + +prompt GROUPNAME "Name of declaration group: " + +template javadoc-function-group-start :indent :blank +---- +/** + * {{?GROUPNAME}} + * @{ + */ + +---- + +template javadoc-function-group-end :indent :blank +---- +/** + * @} + */ + +---- + +context declaration + +template javadoc-class :indent :blank :time :user :tag +---- +/** + * {{DOC}}{{^}} + * + * Created: {{DATE}} + * + * @author {{AUTHOR}} + * @version + * @since + */ +---- + +template javadoc-function :indent :blank :tag +---- +/** + * {{DOC}}{{^}} + * {{#ARGS}} + * @param {{?NAME}} - {{DOC}}{{/ARGS}} + * @return {{TYPE}}{{#THROWS}} + * @exception {{NAME}} - {{EXDOC}}{{/THROWS}} + */ +---- + +template javadoc-variable-same-line +---- +/**< {{DOC}}{{^}} */ +---- + +template javadoc-section-comment :blank :indent +"Insert a comment that separates sections of an Emacs Lisp file." +---- + +/** {{?TITLE}} + * + * {{^}} + */ + +---- + + +;; end \ No newline at end of file diff --git a/etc/srecode/make.srt b/etc/srecode/make.srt new file mode 100644 index 0000000000..3c9440b791 --- /dev/null +++ b/etc/srecode/make.srt @@ -0,0 +1,79 @@ +;; make.srt + +;; Copyright (C) 2009 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set mode "makefile-mode" +set escape_start "{{" +set escape_end "}}" +set comment_start "#" +set comment_prefix "#" +set TAB "\t" + +context file + +template empty :file :user +---- +{{>:filecomment}} + +all: {{^}} + +{{comment_start}} end +---- + +context declaration + +;; GNU Make has real functions you can define, but semantic uses +;; 'function for rules. This is unfortunate, and should be fixed. +template rule :blank +---- +{{?NAME}}: +{{TAB}}{{^}} +---- +bind "r" + +template inferencerule :blank +---- +%.{{?SRCEXTENSION}}: %.{{?DESTEXTENSION}} +{{TAB}}{{^}} +---- +bind "i" + +template phonyrule :blank +---- +.PHONY {{?NAME}} +{{NAME}}: +{{TAB}}{{^}} +---- +bind "p" + + +template variable :blank +"Insert a variable declaration." +---- +{{?NAME}}:= {{^}} +---- +bind "v" + +template include :blank +---- +include {{?NAME}} +---- + +;; end \ No newline at end of file diff --git a/etc/srecode/template.srt b/etc/srecode/template.srt new file mode 100644 index 0000000000..87cce2f319 --- /dev/null +++ b/etc/srecode/template.srt @@ -0,0 +1,224 @@ +;;; template.srt --- Templates for Semantic Recoders + +;; Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc. + +;; Author: Eric Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set escape_start "$" +set escape_end "$" +set mode "srecode-template-mode" +set priority "70" + +set comment_start ";;" +set comment_end "" +set comment_prefix ";;" + +set SEPARATOR "----" + +set DOLLAR "$" + +context file + +prompt MAJORMODE "Major Mode for templates: " read srecode-read-major-mode-name +prompt START "Escape Start Characters: " default "{{" +prompt END "Escape End Characters: " default "}}" + +template empty :file :user :time :srt +"Insert a skeleton for a template file." +---- +$>:filecomment$ + +set mode "$?MAJORMODE$" +set escape_start "$?START$" +set escape_end "$?END$" + +context file + +$^$ + + +;; end +---- + +template mode-basics :srt +"Fill out a full template including parts for basic new mode stuff." +sectiondictionary "E" +set NAME "empty :file :user :time" +set DOC "Fill out an empty file." +set KEY "e" +sectiondictionary "C1" +set NAME "declaration" +sectiondictionary "DTF" +set NAME "function :blank :indent" +set DOC "Template to declare a function." +set KEY "f" +sectiondictionary "DTV" +set NAME "variable :blank :indent" +set DOC "Template to declare a variable." +set KEY "v" +sectiondictionary "PR" +set NAME "NAME" +set PROMPT "Name for declaration: " +---- +$>:declaration:commentchars$ + +$:filecomment$ESCAPE_END$ +$/E$ + +$>C1:declaration:context$ + +$>PR:declaration:prompt$ + +$>DTF:declaration:function$ +$>DTV:declaration:function$ +---- +bind "m" + + +context declaration + +prompt NAME "Name of new template: " +prompt KEY "Key Binding: " read read-char + +template function :blank +"Insert a template block for Srecoder templates." +---- +template $?NAME$$#ARG$$NAME$$/ARG$ +"$DOC$" +$SEPARATOR$ +$^$ +$SEPARATOR$ +bind "$?KEY$" +---- +bind "f" + +prompt NAME "Name of new variable: " + +template variable :blank +"Inert a variable." +---- +set $?NAME$ "$^$" +---- +bind "v" + +template prompt :blank +"Insert a prompt." +---- +prompt $?NAME$ "$?PROMPT$" +---- +bind "p" + +template priority :blank +"Insert a priority statemept." +---- +set priority $^$ +---- + +template application :blank +"Insert a priority statemept." +---- +set application "$^$" +---- + +template context :blank +"Insert a context statement." +---- +context $NAME$ +---- +bind "c" + +template commentchars :blank +"Insert the variables for handling comments." +---- +set comment_start "" +set comment_end "" +set comment_prefix "" +---- + +context code + +prompt NAME "Name of variable: " read srecode-read-variable-name + +template variable :srt +"Insert a variable with completion from the current file." +---- +$ESCAPE_START$$?NAME$$ESCAPE_END$ +---- +bind "v" + +prompt NAME "Name of macro: " + +template ask :srt +"Insert a prompting variable." +---- +$ESCAPE_START$?$?NAME$$ESCAPE_END$ +---- +bind "a" + +template comment :srt +---- +$ESCAPE_START$!$^$$ESCAPE_END$ +---- +bind "c" + +prompt TEMPLATE "Template to include: " read srecode-read-template-name + +template include :srt +---- +$ESCAPE_START$>:$?TEMPLATE$$ESCAPE_END$ +---- +bind "i" + +template includewrap :srt +---- +$ESCAPE_START$<:$?TEMPLATE$$ESCAPE_END$$^$$ESCAPE_START$/$NAME$$ESCAPE_END$ +---- +bind "w" + +template point :srt +---- +$ESCAPE_START$^$ESCAPE_END$ +---- +bind "p" + +template section :srt +"Insert a section, or looping construct." +---- +$ESCAPE_START$#$?NAME$$ESCAPE_END$ +$^$ +$ESCAPE_START$/$NAME$$ESCAPE_END$ +---- +bind "s" + +template escape-start-quoted :srt +"Escape Start" +---- +$ESCAPE_START$ESCAPE_START$ESCAPE_END$ +---- +bind "q" + +template escape-end-quoted :srt +"Escape Start" +---- +$ESCAPE_START$ESCAPE_END$ESCAPE_END$ +---- +bind "e" + + +;; end diff --git a/etc/srecode/test.srt b/etc/srecode/test.srt new file mode 100644 index 0000000000..4c68f8ba17 --- /dev/null +++ b/etc/srecode/test.srt @@ -0,0 +1,148 @@ +;; test.srt --- SRecode templates for testing + +;; Copyright (C) 2008, 2009 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set mode "srecode-template-mode" +set escape_start "$" +set escape_end "$" +set application "tests" + +set UTESTVAR1 ".SRT VAR 1" +;; +;; These are for testing features of template files. +;; +context test + +template test :user +---- +$! This is a comment in the template. $ +;; $AUTHOR$ +;; $AUTHOR:upcase$ +---- + +template subs :blank +---- +;; Before Loop +$#LOOP$ +;; - loop stuff +$/LOOP$ +;; After Loop +---- + +;; Before insertion +;; After insertion + +template firstlast +sectiondictionary "A" +set MOOSE "FIRST" +sectiondictionary "A" +set MOOSE "MIDDLE" +sectiondictionary "A" +set MOOSE "LAST" +---- +$#A$ +;; << -- $MOOSE$ +$#FIRST$;; I'm First$/FIRST$ +$#NOTFIRST$;; I'm Not First$/NOTFIRST$ +$#LAST$;; I'm Last$/LAST$ +$#NOTLAST$;; I'm Not Last$/NOTLAST$ +;; -- >> +$/A$ +---- + + +template wrapsomething :region +---- +;; Put this line in front: +$REGIONTEXT$ +;; Put this line at the end: +---- + +template gapsomething :blank +---- +### ALL ALONE ON A LINE ### +---- + +template inlinetext +"Insert text that has no nelines" +---- + *In the middle* +---- + +template includable :blank +---- +;; An includable $COMMENT$ we could use. +;; $^$ +;; Text after a point inserter. +---- + +template wrapinclude-basic +---- +$>WI1:includable$ +---- + +template wrapinclude-around +---- +$ + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set mode "texinfo-mode" + +set escape_start "$" +set escape_end "$" +set DOLLAR "$" + +context file + +prompt NAME "Name of manual: " + +template empty :file :user :time +"Fill a new texinfo file with some baseline stuff." +---- +\input texinfo @c -*-texinfo-*- +$#RCS$ +@c +@c $Id: srecode-texi.srt,v 1.5 2009/01/01 19:01:42 zappo Exp $ +@c +$/RCS$ +@c %**start of header +@setfilename $FILE$.info +@set TITLE $?NAME$ +@set AUTHOR $?AUTHOR$ +@settitle @value{TITLE} +@c %**end of header + +@ifinfo +@format +START-INFO-DIR-ENTRY +* $FILE$: ($FILE$). $NAME$ +END-INFO-DIR-ENTRY +@end format +@end ifinfo + +@titlepage +@sp 10 +@center @titlefont{$FILE$} +@vskip 0pt plus 1 fill +Copyright @copyright{} $YEAR$ $AUTHOR$ +@end titlepage + +@node Top +@top @value{TITLE} + +$^$ + +@menu +* Index:: +@end menu + + + + +@node Index +@chapter Index + +@contents + +@bye +---- + +prompt NAME "Name of item: " + +context declaration + +;; Note to self: It would be cool to replace the junk in +;; semantic/document.el with macros from here. +template function :blank :texitag +"Import some function tag into texinfo." +---- + +@defun $NAME$$#ARGS$ $NAME$$/ARGS$ +@anchor{$NAME$} +$TAGDOC$ +@end defun + +---- +bind "f" + +template function-command :blank :texitag +"Import some function tag into texinfo." +---- + +@deffn Command $NAME$$#ARGS$ $NAME$$/ARGS$ +@anchor{$NAME$} +$TAGDOC$ +@end deffn + +---- +bind "f" + + +template variable :blank :texitag +"Import some variable tag into texinfo" +---- + +@defvar $NAME$$#ARGS$ $NAME$$/ARGS$ +@anchor{$NAME$} +$TAGDOC$ +@end defvar + +---- +bind "v" + +prompt NAME "Name of node: " + +template node :texi +"Insert a node right about here." +---- + +@node $?NAME$ +@$?LEVEL$ $NAME$ + +$^$ + +---- +bind "n" + +template subnode :texi +"Insert a node right about here." +---- + +@node $?NAME$ +@$?NEXTLEVEL$ $NAME$ + +$^$ + +---- +bind "n" + + +template menu :blank +"Menu items for texinfo." +---- + +@menu +$^$ +@end menu + +---- +bind "m" + +prompt NAME "Menu item: " + +template menuitem :blank +"Insert a menu item." +---- +* $?NAME$:: $^$ +---- + + +;; end \ No newline at end of file diff --git a/etc/srecode/wisent.srt b/etc/srecode/wisent.srt new file mode 100644 index 0000000000..ef7cddca06 --- /dev/null +++ b/etc/srecode/wisent.srt @@ -0,0 +1,94 @@ +;; wisent.srt --- SRecode templates for Emacs/WISENT grammar files. + +;; Copyright (C) 2007, 2008 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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. If not, see . + +set mode "wisent-grammar-mode" +set comment_start ";;" +set comment_prefix ";;" +set comment_end "" + +context file + +template empty :file :user :time +"Insert a skeleton for a grammar file." +---- +{{>:filecomment}} + +;;; Commentary: +;; +;; Parser for {{?TARGETMODE}} mode + +%languagemode {{TARGETMODE}}-mode +%parsetable wisent-{{TARGETMODE}}-parser-tables +%keywordtable wisent-{{TARGETMODE}}-keywords +%tokentable wisent-{{TARGETMODE}}-tokens +%languagemode {{TARGETMODE}}-mode +%setupfunction wisent-{{TARGETMODE}}-default-setup + +%start goal + +;;; KEYWORDS +%type + +%% + +goal + : {{^}} + ; + +%% +(define-lex wisent-{{TARGETMODE}}-lexer + "Lexical analzer to handle {{TARGETMODE}} buffers." + ;; semantic-lex-newline + semantic-lex-ignore-whitespace + semantic-lex-ignore-newline + semantic-lex-ignore-comments + + semantic-lex-default-action + ) + +;; {{FILENAME}} ends here +---- + +context declaration + +template function +---- +{{?NAME}} + : {{^}} + ; +---- +bind "f" + +template keyword +---- +%keyword {{?NAME:upcase}} "{{NAME:downcase}}" +%put {{NAME:upcase}} summary "{{NAME}} {{^}}" +---- +bind "k" + +template token +---- +%type <{{?LEXTOKEN}}> +%token <{{LEXTOKEN}}> {{LEXTOKEN}} +---- +bind "t" + +;; end \ No newline at end of file -- 2.20.1