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