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