author | Stefan Vogel <sv@exept.de> |
Mon, 15 Apr 2019 12:14:41 +0200 | |
changeset 24079 | 8e09e33e97b8 |
parent 22678 | 1f7fff8b32a9 |
child 24370 | 0ac45b7f595e |
permissions | -rw-r--r-- |
22668 | 1 |
"{ Encoding: utf8 }" |
2 |
||
21295 | 3 |
" |
21371 | 4 |
COPYRIGHT (c) 2009 by Jan Vrany |
21295 | 5 |
COPYRIGHT (c) 2009 by eXept Software AG |
6 |
All Rights Reserved |
|
7 |
||
8 |
This software is furnished under a license and may be used |
|
9 |
only in accordance with the terms of that license and with the |
|
10 |
inclusion of the above copyright notice. This software may not |
|
11 |
be provided or otherwise made available to, or used by, any |
|
12 |
other person. No title to or ownership of the software is |
|
13 |
hereby transferred. |
|
14 |
" |
|
11965 | 15 |
"{ Package: 'stx:libbasic' }" |
16 |
||
17449 | 17 |
"{ NameSpace: Smalltalk }" |
18 |
||
11965 | 19 |
ProgrammingLanguage subclass:#SmalltalkLanguage |
20 |
instanceVariableNames:'' |
|
21 |
classVariableNames:'' |
|
22 |
poolDictionaries:'' |
|
23 |
category:'Kernel-Languages' |
|
24 |
! |
|
25 |
||
12100 | 26 |
!SmalltalkLanguage class methodsFor:'documentation'! |
27 |
||
21295 | 28 |
copyright |
29 |
" |
|
21371 | 30 |
COPYRIGHT (c) 2009 by Jan Vrany |
21295 | 31 |
COPYRIGHT (c) 2009 by eXept Software AG |
32 |
All Rights Reserved |
|
33 |
||
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
! |
|
42 |
||
12100 | 43 |
documentation |
44 |
" |
|
45 |
provide info about which tools are to be used for smalltalk code |
|
46 |
" |
|
47 |
! ! |
|
11965 | 48 |
|
49 |
!SmalltalkLanguage methodsFor:'accessing'! |
|
50 |
||
22668 | 51 |
id |
52 |
"Return a unique integer id of this language. |
|
22678 | 53 |
For languages built into the VM, it must be < 32. |
54 |
This id is used as index to various structures used by runtime |
|
55 |
(bytecode set ?). |
|
56 |
cg: this ought to be better documented - I have no idea, where it is used" |
|
22668 | 57 |
|
58 |
^ 1 |
|
59 |
||
60 |
"Created: / 12-04-2018 / 09:16:27 / stefan" |
|
61 |
! |
|
62 |
||
11965 | 63 |
name |
12098 | 64 |
"Answers a human-readable name of myself: |
65 |
'Smalltalk' for SmalltalkLanguage, |
|
66 |
'Ruby' for RubyLanguage |
|
67 |
..." |
|
11965 | 68 |
|
12502 | 69 |
^ 'Smalltalk' |
11965 | 70 |
|
71 |
"Modified: / 16-08-2009 / 10:53:35 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
72 |
! |
|
73 |
||
74 |
sourceFileSuffix |
|
12098 | 75 |
" |
76 |
Answers a default suffix for source files, i.e. |
|
77 |
'st' for Smalltalk, 'js' for JavaScript or 'rb' for Ruby' |
|
78 |
" |
|
11965 | 79 |
|
80 |
^'st' |
|
81 |
||
82 |
"Modified: / 16-08-2009 / 10:53:52 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
83 |
! ! |
|
84 |
||
17449 | 85 |
!SmalltalkLanguage methodsFor:'accessing-classes'! |
11965 | 86 |
|
13259 | 87 |
codeGeneratorClass |
14324
8cb871b96134
added: #versionMethodTemplateForCVS
Claus Gittinger <cg@exept.de>
parents:
14323
diff
changeset
|
88 |
"Answers a class that can generate code" |
13249
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
89 |
|
13253
4112eccb68e0
changed: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
13249
diff
changeset
|
90 |
^ SmalltalkCodeGeneratorTool |
4112eccb68e0
changed: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
13249
diff
changeset
|
91 |
|
13259 | 92 |
"Created: / 30-01-2011 / 15:19:52 / cg" |
13249
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
93 |
! |
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
94 |
|
11965 | 95 |
compilerClass |
12098 | 96 |
"Answer a class suitable for compiling a source code in 'my' language" |
11965 | 97 |
|
18874 | 98 |
^ Smalltalk at:#Compiler |
11965 | 99 |
|
100 |
"Modified: / 21-08-2009 / 13:02:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
101 |
! |
|
102 |
||
15538 | 103 |
compilerWithBreakpointSupportClass |
104 |
"Answer a class suitable for compiling a source code with breakpoints |
|
105 |
in 'my' language" |
|
106 |
||
18874 | 107 |
^ ByteCodeCompilerWithBreakpointSupport |
15538 | 108 |
|
109 |
"Created: / 22-07-2013 / 15:46:12 / cg" |
|
110 |
! |
|
111 |
||
11965 | 112 |
explainerClass |
12098 | 113 |
"Answers a class used by browser and debugger to |
114 |
show some hints about the code. It is OK to return |
|
115 |
nil, which means that there is no explainer for given language." |
|
11965 | 116 |
|
117 |
"return nil by default" |
|
18874 | 118 |
^ Explainer |
11965 | 119 |
|
120 |
"Created: / 21-08-2009 / 08:49:29 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
121 |
! |
|
122 |
||
12098 | 123 |
formatterClass |
124 |
"Answer a class suitable for prettyPrinting (indenting) code in 'my' language. |
|
125 |
It is ok to return nil, which means that the browser will not be able to prettyprint." |
|
126 |
||
18874 | 127 |
^ Parser |
12098 | 128 |
! |
129 |
||
11965 | 130 |
parserClass |
19985 | 131 |
"Answer a class suitable for parsing a source code in 'my' language" |
11965 | 132 |
|
18874 | 133 |
^ Parser |
11965 | 134 |
|
135 |
"Modified: / 21-08-2009 / 13:02:21 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
136 |
! |
|
137 |
||
138 |
sourceFileReaderClass |
|
12098 | 139 |
"Answers a class that can be used for reading & compiling source files" |
11965 | 140 |
|
141 |
^SmalltalkChunkFileSourceReader |
|
142 |
||
143 |
"Modified: / 16-08-2009 / 12:29:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
144 |
! |
|
145 |
||
146 |
sourceFileWriterClass |
|
12098 | 147 |
"Answers a class is used for source file writing (i.e. file-out)" |
11965 | 148 |
|
12107 | 149 |
^ SmalltalkChunkFileSourceWriter |
11965 | 150 |
|
151 |
"Modified: / 16-08-2009 / 09:51:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
12098 | 152 |
! |
153 |
||
154 |
syntaxHighlighterClass |
|
155 |
"return the class to use for syntaxHighlighting (prettyPrinting) this class - |
|
156 |
this can be redefined in special classes, to highlight classes with |
|
157 |
Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
|
158 |
||
18874 | 159 |
^ SyntaxHighlighter |
11965 | 160 |
! ! |
161 |
||
162 |
!SmalltalkLanguage methodsFor:'mimicry'! |
|
163 |
||
164 |
, anObject |
|
12098 | 165 |
"Emulates symbol behavior. This is sometimes required |
14069 | 166 |
as 'Smalltalk language' is used by legacy code to access |
167 |
the current language setting. |
|
168 |
Future versions should contain class Locale. |
|
18925 | 169 |
cg: this is crab, who needs this? |
11965 | 170 |
" |
12524 | 171 |
<resource: #obsolete> |
11965 | 172 |
|
15898 | 173 |
self obsoleteMethodWarning. |
18925 | 174 |
^ Smalltalk language , anObject |
11965 | 175 |
|
176 |
"Created: / 22-08-2009 / 09:33:44 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
14069 | 177 |
"Modified (comment): / 01-04-2012 / 13:19:28 / cg" |
11965 | 178 |
! |
179 |
||
180 |
asSymbol |
|
12098 | 181 |
"Returns a language symbol. This is sometimes required |
182 |
as Smalltalk language is used by legacy code to access |
|
183 |
current language. Future versions should contain class |
|
184 |
Locale. |
|
18925 | 185 |
cg: this is crab, who needs this? |
11965 | 186 |
" |
12524 | 187 |
<resource: #obsolete> |
11965 | 188 |
|
15898 | 189 |
self obsoleteMethodWarning. |
18925 | 190 |
^ Smalltalk language |
11965 | 191 |
|
192 |
"Created: / 22-08-2009 / 09:33:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
193 |
! ! |
|
194 |
||
14374 | 195 |
!SmalltalkLanguage methodsFor:'source queries'! |
196 |
||
16420 | 197 |
commentStrings |
198 |
^ #( |
|
199 |
'"/' "/ EOL comment |
|
200 |
('"' '"') "/ normal comment |
|
201 |
) |
|
202 |
! |
|
203 |
||
14374 | 204 |
methodDefinitionTemplateForSelector:aSelector andArgumentNames:argNames |
205 |
"given a selector, return a prototype definition string" |
|
206 |
||
22668 | 207 |
(aSelector argumentCount > 0 and:[aSelector argumentCount = argNames size]) ifTrue:[ |
19893 | 208 |
aSelector isKeywordSelector ifTrue:[ |
19855 | 209 |
^ Text streamContents:[:stream | |
14374 | 210 |
aSelector keywords with:argNames do:[:eachKeyword :eachArgName| |
19855 | 211 |
stream bold; nextPutAll:eachKeyword; normal; nextPutAll:eachArgName; space. |
14374 | 212 |
]. |
213 |
stream backStep. "remove the last space" |
|
214 |
]. |
|
215 |
]. |
|
19855 | 216 |
^ aSelector allBold , ' ' , (argNames at:1) |
14374 | 217 |
]. |
19855 | 218 |
^ aSelector allBold |
14374 | 219 |
|
220 |
" |
|
221 |
SmalltalkLanguage instance |
|
222 |
methodDefinitionTemplateForSelector:#foo andArgumentNames:#() |
|
223 |
SmalltalkLanguage instance |
|
224 |
methodDefinitionTemplateForSelector:#+ andArgumentNames:#('aNumber') |
|
225 |
SmalltalkLanguage instance |
|
226 |
methodDefinitionTemplateForSelector:#foo:bar:baz: andArgumentNames:#('fooArg' 'barArg' 'bazArg') |
|
227 |
" |
|
22668 | 228 |
|
229 |
"Modified: / 12-04-2018 / 08:39:15 / stefan" |
|
14374 | 230 |
! ! |
231 |
||
11965 | 232 |
!SmalltalkLanguage methodsFor:'testing'! |
233 |
||
234 |
isSmalltalk |
|
12325 | 235 |
"true iff I represent the smalltalk language" |
11965 | 236 |
|
12325 | 237 |
^ true |
11965 | 238 |
|
239 |
"Created: / 16-08-2009 / 09:01:38 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
240 |
! ! |
|
241 |
||
242 |
!SmalltalkLanguage class methodsFor:'documentation'! |
|
243 |
||
244 |
version |
|
18874 | 245 |
^ '$Header$' |
12047 | 246 |
! |
247 |
||
248 |
version_CVS |
|
18874 | 249 |
^ '$Header$' |
12047 | 250 |
! |
251 |
||
252 |
version_SVN |
|
18874 | 253 |
^'$Id$' |
11965 | 254 |
! ! |
15538 | 255 |