summaryrefslogtreecommitdiff
blob: 15624cc690c96242eb52af685d217cd80e31ab62 (plain)
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
;; Copyright (C) 2000,2001,2002,2003 Peter Milliken
;;
;; Author: Peter Milliken <peterm@resmed.com.au>,
;;                        <peterm@unwired.com.au>
;; Version: 1.1
;; Keywords: language sensitive abbreviation template placeholder token
;;
;; 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 2, 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; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.

;;******************************************************************************
;; These definitions are my personal customisations for the language. This is
;; where you should place YOUR customisations.
;;
;; Sometimes there is a definition(s) in here that override definitions in the
;; main language template file that are here to make that definition more
;; "usable" - this is because I (primarily) try and generate/maintain the main
;; .lse files from EBNF definitions of the language. Sometimes I just can't
;; express the appropriate customisation in the EBNF and so I am forced to
;; override the placeholder definition in this file.
;;
;; This entries in this file should be used as an example of how to create your
;; own customisations. I would caution that you don't delete any definitions
;; though until you are sure that your edit sessions will not be adversely
;; affected. The best way to check out the effects of a delete is to "compile"
;; (else-compile-buffer) the "delete" command for that definition (this will
;; remove it from your edit session and you can nolonger access the definition
;; until next you load language template files) and then see whether anything
;; has been "lost" in your code generation ability i.e. say you think you don't
;; need the definition for placeholder XXX, just place the following lines at
;; the end of one of your source files (when ELSE is enabled for that buffer)
;; and perform a compile (M-x else-compile-buffer) with the cursor positioned at
;; the beginning of the line:
;;
;; DELETE PLACEHOLDER XXX -
;;    /LANGUAGE = "Python" -         
;;
;; This will delete definition XXX from memory.
;;
;;****************************************************************************** 


DEFINE LANGUAGE Python -
    /VALID_IDENTIFIER_CHARACTERS="#abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789"
    /INDENT_SIZE=2

END DEFINE

DELETE PLACEHOLDER ", IDENTIFIER" - 
  /LANGUAGE="Python" -
DEFINE PLACEHOLDER ", IDENTIFIER" - 
  /LANGUAGE="Python" -
  /NOAUTO_SUBSTITUTE -
  /DESCRIPTION="" -
  /DUPLICATION=CONTEXT_DEPENDENT -
  /SEPARATOR="" -
  /TYPE=NONTERMINAL

  ", {identifier}"

END DEFINE


DELETE PLACEHOLDER CALL_STMT -
    /LANGUAGE="Python" -
DEFINE PLACEHOLDER CALL_STMT -
    /LANGUAGE="Python" -
    /NOAUTO_SUBSTITUTE -
    /DESCRIPTION=""
    /DUPLICATION=CONTEXT_DEPENDENT -
    /SEPARATOR="" -
    /TYPE=NONTERMINAL -
    
    "{primary} ([parameter_association]...);"

END DEFINE

DELETE PLACEHOLDER FUNCDEF -
    /LANGUAGE="Python" -
DEFINE PLACEHOLDER FUNCDEF -
    /LANGUAGE="Python" -
    /NOAUTO_SUBSTITUTE -
    /DESCRIPTION=""
    /DUPLICATION=CONTEXT_DEPENDENT -
    /SEPARATOR="" -
    /TYPE=NONTERMINAL -
    
    "def {identifier} ([defparameter]...):"
    "  [document_string]"
    "  {statement}..."
    ""

END DEFINE

DELETE PLACEHOLDER CLASSDEF -              
    /LANGUAGE="Python" -
DEFINE PLACEHOLDER CLASSDEF -
    /LANGUAGE="Python" -
    /NOAUTO_SUBSTITUTE -
    /DESCRIPTION=""
    /DUPLICATION=CONTEXT_DEPENDENT -
    /SEPARATOR="" -
    /TYPE=NONTERMINAL -

    "class {classname} [inheritance]:"
    "  [init_def]"
    " "
    "  [class_funcdef]..."
    " "

END DEFINE                             

DELETE PLACEHOLDER INIT_DEF -
    /LANGUAGE="Python" -
DEFINE PLACEHOLDER INIT_DEF -
    /LANGUAGE="Python" -
    /NOAUTO_SUBSTITUTE -
    /DESCRIPTION="Provides an __init__ def." -
    /DUPLICATION=CONTEXT_DEPENDENT -
    /SEPARATOR="" -
    /TYPE=NONTERMINAL

    "def __init__ (self, [defparameter]...):"
    "  [document_string]"
    "  {statement}..."
    ""

END DEFINE

DELETE PLACEHOLDER CLASS_FUNCDEF -
    /LANGUAGE="Python" -
DEFINE PLACEHOLDER CLASS_FUNCDEF -
    /LANGUAGE="Python" -
    /NOAUTO_SUBSTITUTE -
    /DESCRIPTION="Function definition when within a class" -
    /DUPLICATION=CONTEXT_DEPENDENT -
    /SEPARATOR="" -
    /TYPE=NONTERMINAL

    "def {identifier} (self, [defparameter]...):"
    "  [document_string]"
    "  {statement}..."
    " "

END DEFINE


DELETE PLACEHOLDER MY_CLASSDEF -
    /LANGUAGE="Python" -
DEFINE PLACEHOLDER MY_CLASSDEF -
    /LANGUAGE="Python" -
    /NOAUTO_SUBSTITUTE -
    /DESCRIPTION=""
    /DUPLICATION=CONTEXT_DEPENDENT -
    /SEPARATOR="" -
    /TYPE=NONTERMINAL -
    
    "class {classname} ({superclass}...):"
    ""
    "   def __init__(self):"
    "      {superclass}._init_(self)"
    "  [class_funcdef]..."
    " "

END DEFINE

DELETE PLACEHOLDER SUPERCLASS -
    /LANGUAGE="Python" -
DEFINE PLACEHOLDER SUPERCLASS -
    /LANGUAGE="Python" -
    /AUTO_SUBSTITUTE -
    /DESCRIPTION="" -
    /DUPLICATION=CONTEXT_DEPENDENT -
    /SEPARATOR="" -
    /TYPE=TERMINAL -

    "Type in the name of the superclass."

END DEFINE

DELETE PLACEHOLDER COMPILATION_UNIT -
    /LANGUAGE="Python" -
DEFINE PLACEHOLDER COMPILATION_UNIT -
    /LANGUAGE="Python" -
    /NOAUTO_SUBSTITUTE -
    /DESCRIPTION=""
    /DUPLICATION=CONTEXT_DEPENDENT -
    /SEPARATOR="" -
    /TYPE=NONTERMINAL -

    """"[text]...""""   
    "[import_stmt]..."
    "{statement}..."
    "[test_statement]"

END DEFINE

DELETE TOKEN CD -
    /LANGUAGE="Python" -
DEFINE TOKEN CD -
    /LANGUAGE="Python" -
    /DESCRIPTION="" -

    "def {member_name} (self, value = None):"
    "  [document_string]"
    "  if value == {member_name}:"
    "    return self.{member_name}"
    "  else:"
    "    self.{member_name} = value"
    "    self.Dump()"

END DEFINE

DELETE PLACEHOLDER MEMBER_NAME -
    /LANGUAGE="Python" -
DEFINE PLACEHOLDER MEMBER_NAME -
    /LANGUAGE="Python" -
    /AUTO_SUBSTITUTE -
    /SUBSTITUTE_COUNT=4
    /DESCRIPTION=""
    /DUPLICATION=CONTEXT_DEPENDENT -
    /SEPARATOR="" -
    /TYPE=TERMINAL

    "Enter the member name of the class"

END DEFINE

DELETE PLACEHOLDER TEST_STATEMENT -
    /LANGUAGE="Python" -
DEFINE PLACEHOLDER TEST_STATEMENT -
    /LANGUAGE="Python" -
    /NOAUTO_SUBSTITUTE -
    /DESCRIPTION="" -
    /DUPLICATION=CONTEXT_DEPENDENT -
    /SEPARATOR="" -
    /TYPE=NONTERMINAL

    "if __name__ == '__main__':"
    "    {statement}..."

END DEFINE