author | Stefan Vogel <sv@exept.de> |
Tue, 20 Aug 2013 15:46:36 +0200 | |
changeset 15656 | 82aca5063e96 |
parent 15537 | 550b68e18f96 |
child 15663 | 60a2fefee8a4 |
child 18077 | 5844a3bcdd52 |
permissions | -rw-r--r-- |
13425 | 1 |
" |
2 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
11964 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
14 |
Object subclass:#ProgrammingLanguage |
|
15 |
instanceVariableNames:'' |
|
16 |
classVariableNames:'LanguageQuerySignal' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Kernel-Languages' |
|
19 |
! |
|
20 |
||
21 |
ProgrammingLanguage class instanceVariableNames:'Instance' |
|
22 |
||
23 |
" |
|
24 |
No other class instance variables are inherited by this class. |
|
25 |
" |
|
26 |
! |
|
27 |
||
12101 | 28 |
!ProgrammingLanguage class methodsFor:'documentation'! |
29 |
||
13425 | 30 |
copyright |
31 |
" |
|
32 |
COPYRIGHT (c) 2006 by eXept Software AG |
|
33 |
All Rights Reserved |
|
34 |
||
35 |
This software is furnished under a license and may be used |
|
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
42 |
! |
|
43 |
||
12101 | 44 |
documentation |
45 |
" |
|
46 |
provide info about which tools are to be used for code in |
|
47 |
a programming language |
|
48 |
" |
|
49 |
! ! |
|
11964 | 50 |
|
51 |
!ProgrammingLanguage class methodsFor:'initialization'! |
|
52 |
||
53 |
initialize |
|
54 |
||
55 |
LanguageQuerySignal := |
|
56 |
QuerySignal new |
|
57 |
nameClass:self message:#languageQuerySignal; |
|
58 |
notifierString:'asking for current language'; |
|
59 |
handlerBlock:[:ex | ex proceedWith:SmalltalkLanguage instance]. |
|
60 |
||
61 |
"Created: / 12-08-2009 / 14:56:11 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
62 |
"Modified: / 16-08-2009 / 10:36:11 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
63 |
! ! |
|
64 |
||
65 |
!ProgrammingLanguage class methodsFor:'instance creation'! |
|
66 |
||
67 |
forFile: aFilename |
|
12099 | 68 |
"Answers a language for given source file. If none is found, |
11964 | 69 |
SmalltalkLanguage is returned (to provide backward compatibility)" |
70 |
||
71 |
^ self instancesDetect: [:each | each canReadSourceFile: aFilename ] |
|
72 |
ifNone: [ SmalltalkLanguage instance ] |
|
73 |
||
74 |
"Created: / 16-08-2009 / 10:08:44 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
75 |
! |
|
76 |
||
77 |
forStream: aStream |
|
12099 | 78 |
"Answers a language for given source stream. If none is found, |
11964 | 79 |
SmalltalkLanguage is returned (to provide backward compatibility)" |
80 |
||
81 |
aStream isFileStream ifFalse: [ ^ SmalltalkLanguage instance ]. |
|
82 |
^ self forFile: aStream fileName |
|
83 |
||
84 |
"Created: / 16-08-2009 / 10:56:26 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
85 |
! |
|
86 |
||
87 |
named: aString |
|
12990 | 88 |
^ self named:aString ifNone:[ self error: 'No language named ' , aString ]. |
11964 | 89 |
|
90 |
" |
|
12989 | 91 |
ProgrammingLanguage named: 'Smalltalk' |
92 |
ProgrammingLanguage named: 'JavaScript' |
|
93 |
ProgrammingLanguage named: 'Ruby' |
|
94 |
" |
|
11964 | 95 |
|
96 |
"Created: / 15-08-2009 / 22:40:26 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
97 |
"Modified: / 16-08-2009 / 10:58:01 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
12990 | 98 |
"Modified: / 04-08-2010 / 12:06:38 / cg" |
11964 | 99 |
! |
100 |
||
101 |
named: aString ifNone: aBlock |
|
102 |
^ self |
|
103 |
instancesDetect:[:each | each name = aString ] |
|
104 |
ifNone: aBlock |
|
105 |
||
106 |
"Created: / 21-08-2009 / 13:07:10 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
107 |
! ! |
|
108 |
||
109 |
!ProgrammingLanguage class methodsFor:'Signal constants'! |
|
110 |
||
111 |
languageQuerySignal |
|
112 |
||
113 |
^LanguageQuerySignal |
|
114 |
||
115 |
"Created: / 12-08-2009 / 14:57:07 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
116 |
! ! |
|
117 |
||
118 |
!ProgrammingLanguage class methodsFor:'accessing'! |
|
119 |
||
120 |
all |
|
121 |
" |
|
122 |
Anwers a collection of all available languages |
|
123 |
" |
|
124 |
||
125 |
^self allSubclasses collect:[:each|each instance] |
|
126 |
||
127 |
||
128 |
" |
|
12099 | 129 |
ProgrammingLanguage all |
11964 | 130 |
" |
131 |
||
132 |
"Created: / 16-08-2009 / 13:43:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
133 |
! |
|
134 |
||
135 |
current |
|
136 |
||
137 |
" |
|
12099 | 138 |
ProgrammingLanguage current |
11964 | 139 |
" |
140 |
||
141 |
||
142 |
^LanguageQuerySignal query |
|
143 |
||
144 |
"Created: / 12-08-2009 / 15:02:59 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
145 |
! |
|
146 |
||
147 |
instance |
|
12099 | 148 |
"return this languages singleton" |
11964 | 149 |
|
13819 | 150 |
Instance isNil ifTrue:[Instance := self new]. |
11964 | 151 |
^Instance |
152 |
||
153 |
"Created: / 16-08-2009 / 10:36:37 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
13819 | 154 |
"Modified: / 18-11-2011 / 14:51:59 / cg" |
11964 | 155 |
! ! |
156 |
||
157 |
!ProgrammingLanguage class methodsFor:'enumerating'! |
|
158 |
||
12590 | 159 |
allDetect:aBlock ifNone:exceptionValue |
160 |
self allDo:[:each | (aBlock value:each) ifTrue:[^ each]]. |
|
161 |
^ exceptionValue value |
|
162 |
! |
|
11964 | 163 |
|
12590 | 164 |
allDo: aBlock |
165 |
^ self allSubclassesDo: [:each | aBlock value: each instance] |
|
11964 | 166 |
|
167 |
"Created: / 16-08-2009 / 14:07:40 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
168 |
! ! |
|
169 |
||
170 |
!ProgrammingLanguage class methodsFor:'private'! |
|
171 |
||
172 |
instancesDetect: detectBlock ifNone: failBlock |
|
173 |
||
174 |
||
175 |
self allSubclasses |
|
176 |
do:[:cls|(detectBlock value: cls instance) ifTrue:[^cls instance]]. |
|
177 |
^failBlock value |
|
178 |
||
179 |
"Created: / 16-08-2009 / 10:57:32 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
180 |
! ! |
|
181 |
||
182 |
!ProgrammingLanguage class methodsFor:'testing'! |
|
183 |
||
184 |
isAvailable: langName |
|
185 |
||
186 |
self instancesDetect: [:lang|lang name = langName] ifNone: [^false]. |
|
187 |
^true |
|
188 |
||
189 |
" |
|
190 |
ProgrammingLanguage isAvailable: 'Smalltalk' |
|
191 |
ProgrammingLanguage isAvailable: 'Ruby' |
|
192 |
ProgrammingLanguage isAvailable: 'Haskell' |
|
193 |
" |
|
194 |
||
195 |
"Created: / 21-08-2009 / 12:56:32 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
196 |
! ! |
|
197 |
||
198 |
!ProgrammingLanguage methodsFor:'accessing'! |
|
199 |
||
13425 | 200 |
id |
201 |
||
202 |
"Return an unique integer id of this language. |
|
203 |
id must be < 32. |
|
204 |
This id is used as index to various structures used by runtime" |
|
205 |
||
206 |
^self subclassResponsibility |
|
207 |
||
208 |
"Created: / 17-03-2011 / 10:51:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
209 |
! |
|
210 |
||
211 |
imports |
|
212 |
||
213 |
"To make it polymorph with NameSpace for |
|
214 |
selector-namespace enabled systems" |
|
215 |
||
216 |
^self class all reject:[:lang|lang == self] |
|
217 |
||
218 |
"Created: / 20-05-2010 / 14:17:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
219 |
"Modified: / 19-07-2010 / 12:14:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
220 |
! |
|
221 |
||
222 |
lookup |
|
223 |
||
224 |
^self lookupClass instance |
|
225 |
||
226 |
"Created: / 17-03-2011 / 10:57:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
227 |
! |
|
228 |
||
11964 | 229 |
name |
12099 | 230 |
"Answers a human-readable name of myself: |
11964 | 231 |
'Smalltalk' for SmalltalkLanguage, |
12099 | 232 |
'Ruby' for RubyLanguage |
233 |
... |
|
11964 | 234 |
" |
235 |
||
236 |
^ self subclassResponsibility |
|
237 |
||
238 |
"Created: / 15-08-2009 / 22:38:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
239 |
"Modified: / 16-08-2009 / 10:47:21 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
240 |
! |
|
241 |
||
242 |
sourceFileSuffix |
|
12099 | 243 |
"Answers a default suffix for source files, i.e. 'st' for Smalltalk, |
244 |
'js' for JavaScript or 'rb' for Ruby', etc." |
|
11964 | 245 |
|
246 |
^self subclassResponsibility |
|
247 |
||
248 |
"Created: / 16-08-2009 / 10:42:40 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
249 |
! ! |
|
250 |
||
251 |
!ProgrammingLanguage methodsFor:'accessing - classes'! |
|
252 |
||
13250 | 253 |
codeGeneratorClass |
254 |
"Answer a class suitable for generating code (such as getters, setters, etc.) |
|
255 |
It is ok to return nil, which means that no code can be generated automagically" |
|
256 |
||
257 |
^ nil |
|
258 |
! |
|
259 |
||
11964 | 260 |
compilerClass |
12099 | 261 |
"Answer a class suitable for compiling a source code in 'my' language" |
11964 | 262 |
|
263 |
^self subclassResponsibility |
|
264 |
||
265 |
"Created: / 21-08-2009 / 13:00:50 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
266 |
! |
|
267 |
||
15537 | 268 |
compilerWithBreakpointSupportClass |
269 |
"Answer a class suitable for compiling a source code with breakpoints |
|
270 |
in 'my' language. If there is non, return nil." |
|
271 |
||
272 |
^ nil |
|
273 |
||
274 |
"Created: / 22-07-2013 / 15:45:00 / cg" |
|
275 |
! |
|
276 |
||
12099 | 277 |
evaluatorClass |
278 |
"Answer a class suitable for evaluating a doIt in 'my' language" |
|
279 |
||
280 |
^ self compilerClass |
|
281 |
! |
|
11964 | 282 |
|
12099 | 283 |
explainerClass |
284 |
"Answers a class used by browser and debugger to |
|
285 |
show some hints about the code. It is OK to return |
|
286 |
nil, which means that there is no explainer for given |
|
287 |
language." |
|
11964 | 288 |
|
289 |
"return nil by default" |
|
290 |
^nil |
|
291 |
||
292 |
"Created: / 21-08-2009 / 08:49:13 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
293 |
! |
|
294 |
||
12099 | 295 |
formatterClass |
296 |
"Answer a class suitable for prettyPrinting (indenting) code in 'my' language. |
|
297 |
It is ok to return nil, which means that the browser will not be able to prettyprint." |
|
298 |
||
299 |
^ nil |
|
300 |
! |
|
301 |
||
13425 | 302 |
lookupClass |
303 |
||
304 |
^BuiltinLookup |
|
305 |
||
306 |
"Created: / 17-03-2011 / 10:56:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
307 |
! |
|
308 |
||
13256 | 309 |
metaClass |
310 |
"will be used for new classes (in the class wizard); |
|
311 |
a fallback here" |
|
312 |
||
313 |
^ Metaclass |
|
314 |
||
315 |
"Created: / 30-01-2011 / 10:05:03 / cg" |
|
316 |
! |
|
317 |
||
11964 | 318 |
parserClass |
12099 | 319 |
"Answer a class suitable for parsing a source code in 'my' language" |
11964 | 320 |
|
321 |
^self subclassResponsibility |
|
322 |
||
323 |
"Created: / 21-08-2009 / 13:00:30 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
324 |
! |
|
325 |
||
326 |
sourceFileReaderClass |
|
12099 | 327 |
"Answers a class that can be used for reading & compiling source files" |
11964 | 328 |
|
329 |
^self subclassResponsibility |
|
330 |
||
331 |
"Created: / 16-08-2009 / 09:00:23 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
332 |
! |
|
333 |
||
334 |
sourceFileWriterClass |
|
12099 | 335 |
"Answers a class is used for source file writing (i.e. file-out)" |
11964 | 336 |
|
337 |
^self subclassResponsibility |
|
338 |
||
339 |
"Created: / 16-08-2009 / 09:40:19 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
12099 | 340 |
! |
341 |
||
342 |
syntaxHighlighterClass |
|
343 |
"Answers a class used by browser and debugger to colorze code. |
|
344 |
It is OK to return nil, which means that the code is shown as-is" |
|
345 |
||
346 |
"return nil by default" |
|
347 |
^nil |
|
11964 | 348 |
! ! |
349 |
||
350 |
!ProgrammingLanguage methodsFor:'printing & storing'! |
|
351 |
||
13425 | 352 |
printOn:aStream |
353 |
"append a printed representation if the receiver to the argument, aStream" |
|
354 |
||
355 |
self class printOn: aStream. |
|
356 |
aStream nextPutAll: ' instance' |
|
357 |
||
358 |
"Modified: / 19-06-2010 / 09:54:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
359 |
! |
|
360 |
||
11964 | 361 |
storeOn:aStream |
362 |
||
363 |
self class == ProgrammingLanguage |
|
364 |
ifTrue: |
|
365 |
[super storeOn:aStream] |
|
366 |
ifFalse: |
|
367 |
[aStream |
|
368 |
nextPutAll:'ProgrammingLanguage'; |
|
369 |
nextPutAll:' named: '; |
|
370 |
nextPutAll:self name storeString]. |
|
371 |
||
372 |
" |
|
373 |
ProgrammingLanguage instance storeString |
|
374 |
||
375 |
SmalltalkLanguage instance storeString |
|
376 |
" |
|
377 |
||
378 |
"Created: / 16-08-2009 / 10:52:28 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
379 |
! ! |
|
380 |
||
381 |
!ProgrammingLanguage methodsFor:'queries'! |
|
382 |
||
383 |
canReadSourceFile: aFilename |
|
12099 | 384 |
"Answers true iff file contains source code in 'my' language" |
11964 | 385 |
|
12099 | 386 |
"Trivial implementation here, to be overriden by subclasses" |
11964 | 387 |
|
388 |
^aFilename suffix = self sourceFileSuffix |
|
389 |
||
390 |
"Created: / 16-08-2009 / 10:10:33 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
13425 | 391 |
! |
392 |
||
14553 | 393 |
defaultSelectorNameSpacePrefix |
14549 | 394 |
^ nil "/no namespace by default" |
395 |
! |
|
396 |
||
13425 | 397 |
supportsExtensionMethods |
398 |
||
399 |
"Answer true iff this language supports extension methods" |
|
400 |
||
401 |
^true |
|
402 |
||
403 |
"Created: / 19-03-2011 / 10:02:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11964 | 404 |
! ! |
405 |
||
14372 | 406 |
!ProgrammingLanguage methodsFor:'source queries'! |
407 |
||
14373
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
408 |
methodDefinitionTemplateForSelector:aSelector |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
409 |
"given a selector, return a prototype definition string" |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
410 |
|
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
411 |
|nA argNames| |
14372 | 412 |
|
14373
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
413 |
(nA := aSelector numArgs) == 1 ifTrue:[ |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
414 |
argNames := #('arg') |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
415 |
] ifFalse:[ |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
416 |
argNames := (1 to:nA) collect:[:i | 'arg' , i printString]. |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
417 |
]. |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
418 |
^ self |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
419 |
methodDefinitionTemplateForSelector:aSelector |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
420 |
andArgumentNames:argNames. |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
421 |
|
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
422 |
" |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
423 |
SmalltalkLanguage instance methodDefinitionTemplateForSelector:#foo |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
424 |
SmalltalkLanguage instance methodDefinitionTemplateForSelector:#+ |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
425 |
SmalltalkLanguage instance methodDefinitionTemplateForSelector:#foo:bar:baz: |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
426 |
" |
14372 | 427 |
! |
428 |
||
429 |
methodDefinitionTemplateForSelector:arg1 andArgumentNames:arg2 |
|
430 |
"raise an error: must be redefined in concrete subclass(es)" |
|
431 |
||
432 |
^ self subclassResponsibility |
|
433 |
! ! |
|
434 |
||
11964 | 435 |
!ProgrammingLanguage methodsFor:'testing'! |
436 |
||
13425 | 437 |
isJava |
438 |
"true iff this is the Java language" |
|
439 |
||
440 |
^ false |
|
441 |
||
442 |
"Created: / 17-03-2011 / 10:16:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
443 |
! |
|
444 |
||
445 |
isProgrammingLanguage |
|
446 |
||
447 |
^true |
|
448 |
||
449 |
"Created: / 21-07-2010 / 15:14:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
450 |
! |
|
451 |
||
12151
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
452 |
isRuby |
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
453 |
"true iff this is the ruby language" |
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
454 |
|
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
455 |
^ false |
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
456 |
! |
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
457 |
|
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
458 |
isSTXJavaScript |
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
459 |
"true iff this is the ST/X-javascript language" |
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
460 |
|
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
461 |
^ false |
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
462 |
! |
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
463 |
|
11964 | 464 |
isSmalltalk |
12106 | 465 |
"true iff this is the smalltalk language" |
11964 | 466 |
|
12106 | 467 |
^ false |
11964 | 468 |
|
469 |
"Created: / 16-08-2009 / 09:01:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
470 |
! ! |
|
471 |
||
472 |
!ProgrammingLanguage methodsFor:'utilities - file in/file out'! |
|
473 |
||
474 |
fileIn: aFilename |
|
475 |
||
476 |
^self sourceFileReaderClass fileIn: aFilename |
|
477 |
||
478 |
"Created: / 16-08-2009 / 13:28:17 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
479 |
! |
|
480 |
||
481 |
fileInStream: aStream |
|
482 |
||
483 |
^self sourceFileReaderClass fileInStream: aStream |
|
484 |
||
485 |
"Created: / 16-08-2009 / 11:05:46 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
486 |
! ! |
|
487 |
||
488 |
!ProgrammingLanguage methodsFor:'utilities - source code'! |
|
489 |
||
12151
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
490 |
methodTemplate |
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
491 |
"return a method definition template string (or nil)" |
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
492 |
|
14422 | 493 |
|writerClass| |
14327 | 494 |
|
14422 | 495 |
(writerClass := self sourceFileWriterClass) isNil ifTrue:[^ nil]. |
496 |
^ writerClass methodTemplate |
|
14327 | 497 |
|
498 |
"Modified: / 21-08-2012 / 19:44:41 / cg" |
|
12151
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
499 |
! |
6f4f339cfa56
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12106
diff
changeset
|
500 |
|
14151
34a9e574c152
added: #parenthesisSpecificationForEditor
Claus Gittinger <cg@exept.de>
parents:
13819
diff
changeset
|
501 |
parenthesisSpecificationForEditor |
34a9e574c152
added: #parenthesisSpecificationForEditor
Claus Gittinger <cg@exept.de>
parents:
13819
diff
changeset
|
502 |
^ TextView defaultParenthesisSpecification |
34a9e574c152
added: #parenthesisSpecificationForEditor
Claus Gittinger <cg@exept.de>
parents:
13819
diff
changeset
|
503 |
|
34a9e574c152
added: #parenthesisSpecificationForEditor
Claus Gittinger <cg@exept.de>
parents:
13819
diff
changeset
|
504 |
"Created: / 01-06-2012 / 22:52:25 / cg" |
34a9e574c152
added: #parenthesisSpecificationForEditor
Claus Gittinger <cg@exept.de>
parents:
13819
diff
changeset
|
505 |
! |
34a9e574c152
added: #parenthesisSpecificationForEditor
Claus Gittinger <cg@exept.de>
parents:
13819
diff
changeset
|
506 |
|
14322
174a6ab85c33
added: #versionMethodTemplateForCVS
Claus Gittinger <cg@exept.de>
parents:
14151
diff
changeset
|
507 |
versionMethodTemplateForCVS |
174a6ab85c33
added: #versionMethodTemplateForCVS
Claus Gittinger <cg@exept.de>
parents:
14151
diff
changeset
|
508 |
"raise an error: must be redefined in concrete subclass(es)" |
174a6ab85c33
added: #versionMethodTemplateForCVS
Claus Gittinger <cg@exept.de>
parents:
14151
diff
changeset
|
509 |
|
14422 | 510 |
|writerClass| |
14327 | 511 |
|
14422 | 512 |
(writerClass := self sourceFileWriterClass) isNil ifTrue:[^ nil]. |
513 |
^ writerClass versionMethodTemplateForCVS |
|
14327 | 514 |
|
515 |
"Modified: / 21-08-2012 / 19:44:51 / cg" |
|
14322
174a6ab85c33
added: #versionMethodTemplateForCVS
Claus Gittinger <cg@exept.de>
parents:
14151
diff
changeset
|
516 |
! |
174a6ab85c33
added: #versionMethodTemplateForCVS
Claus Gittinger <cg@exept.de>
parents:
14151
diff
changeset
|
517 |
|
12106 | 518 |
writeComment:aStringOrStringCollection on:aStream |
12099 | 519 |
"Utility method - writes a comment to a stream, |
520 |
using proper syntax" |
|
14421 | 521 |
|
522 |
|writerClass| |
|
523 |
||
524 |
(writerClass := self sourceFileWriterClass) notNil ifTrue:[ |
|
525 |
writerClass new |
|
526 |
fileOutComment: aStringOrStringCollection |
|
527 |
on: aStream. |
|
528 |
]. |
|
11964 | 529 |
|
530 |
"Created: / 21-08-2009 / 09:35:07 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
531 |
! ! |
|
532 |
||
533 |
!ProgrammingLanguage class methodsFor:'documentation'! |
|
534 |
||
14373
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
535 |
version |
15537 | 536 |
^ '$Header: /cvs/stx/stx/libbasic/ProgrammingLanguage.st,v 1.26 2013-07-22 13:45:07 cg Exp $' |
14373
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
537 |
! |
ec1031c38f9b
changed: #methodDefinitionTemplateForSelector:
Claus Gittinger <cg@exept.de>
parents:
14372
diff
changeset
|
538 |
|
12048 | 539 |
version_CVS |
15537 | 540 |
^ '$Header: /cvs/stx/stx/libbasic/ProgrammingLanguage.st,v 1.26 2013-07-22 13:45:07 cg Exp $' |
12048 | 541 |
! |
542 |
||
543 |
version_SVN |
|
15537 | 544 |
^ '$ Id: ProgrammingLanguage.st 10643 2011-06-08 21:53:07Z vranyj1 $' |
11964 | 545 |
! ! |
546 |
||
15537 | 547 |
|
11964 | 548 |
ProgrammingLanguage initialize! |