author | Claus Gittinger <cg@exept.de> |
Thu, 27 Jun 2019 16:34:40 +0200 | |
changeset 24379 | 852be153b0ec |
parent 24373 | 1d21ad0521d9 |
child 24748 | 40b383b322f5 |
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 |
|
24373 | 75 |
"Answers a default suffix for source files, i.e. |
76 |
'st' for Smalltalk, 'js' for JavaScript or 'rb' for Ruby', etc." |
|
11965 | 77 |
|
78 |
^'st' |
|
79 |
||
80 |
"Modified: / 16-08-2009 / 10:53:52 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
24373 | 81 |
"Modified (comment): / 27-06-2019 / 12:33:29 / Claus Gittinger" |
11965 | 82 |
! ! |
83 |
||
17449 | 84 |
!SmalltalkLanguage methodsFor:'accessing-classes'! |
11965 | 85 |
|
13259 | 86 |
codeGeneratorClass |
14324
8cb871b96134
added: #versionMethodTemplateForCVS
Claus Gittinger <cg@exept.de>
parents:
14323
diff
changeset
|
87 |
"Answers a class that can generate code" |
13249
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
88 |
|
13253
4112eccb68e0
changed: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
13249
diff
changeset
|
89 |
^ SmalltalkCodeGeneratorTool |
4112eccb68e0
changed: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
13249
diff
changeset
|
90 |
|
13259 | 91 |
"Created: / 30-01-2011 / 15:19:52 / cg" |
13249
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
92 |
! |
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
93 |
|
11965 | 94 |
compilerClass |
12098 | 95 |
"Answer a class suitable for compiling a source code in 'my' language" |
11965 | 96 |
|
18874 | 97 |
^ Smalltalk at:#Compiler |
11965 | 98 |
|
99 |
"Modified: / 21-08-2009 / 13:02:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
100 |
! |
|
101 |
||
15538 | 102 |
compilerWithBreakpointSupportClass |
103 |
"Answer a class suitable for compiling a source code with breakpoints |
|
104 |
in 'my' language" |
|
105 |
||
18874 | 106 |
^ ByteCodeCompilerWithBreakpointSupport |
15538 | 107 |
|
108 |
"Created: / 22-07-2013 / 15:46:12 / cg" |
|
109 |
! |
|
110 |
||
11965 | 111 |
explainerClass |
12098 | 112 |
"Answers a class used by browser and debugger to |
113 |
show some hints about the code. It is OK to return |
|
114 |
nil, which means that there is no explainer for given language." |
|
11965 | 115 |
|
116 |
"return nil by default" |
|
18874 | 117 |
^ Explainer |
11965 | 118 |
|
119 |
"Created: / 21-08-2009 / 08:49:29 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
120 |
! |
|
121 |
||
12098 | 122 |
formatterClass |
123 |
"Answer a class suitable for prettyPrinting (indenting) code in 'my' language. |
|
124 |
It is ok to return nil, which means that the browser will not be able to prettyprint." |
|
125 |
||
18874 | 126 |
^ Parser |
12098 | 127 |
! |
128 |
||
11965 | 129 |
parserClass |
19985 | 130 |
"Answer a class suitable for parsing a source code in 'my' language" |
11965 | 131 |
|
18874 | 132 |
^ Parser |
11965 | 133 |
|
134 |
"Modified: / 21-08-2009 / 13:02:21 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
135 |
! |
|
136 |
||
137 |
sourceFileReaderClass |
|
12098 | 138 |
"Answers a class that can be used for reading & compiling source files" |
11965 | 139 |
|
140 |
^SmalltalkChunkFileSourceReader |
|
141 |
||
142 |
"Modified: / 16-08-2009 / 12:29:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
143 |
! |
|
144 |
||
145 |
sourceFileWriterClass |
|
12098 | 146 |
"Answers a class is used for source file writing (i.e. file-out)" |
11965 | 147 |
|
12107 | 148 |
^ SmalltalkChunkFileSourceWriter |
11965 | 149 |
|
150 |
"Modified: / 16-08-2009 / 09:51:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
12098 | 151 |
! |
152 |
||
153 |
syntaxHighlighterClass |
|
154 |
"return the class to use for syntaxHighlighting (prettyPrinting) this class - |
|
155 |
this can be redefined in special classes, to highlight classes with |
|
156 |
Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
|
157 |
||
18874 | 158 |
^ SyntaxHighlighter |
11965 | 159 |
! ! |
160 |
||
161 |
!SmalltalkLanguage methodsFor:'mimicry'! |
|
162 |
||
163 |
, anObject |
|
12098 | 164 |
"Emulates symbol behavior. This is sometimes required |
14069 | 165 |
as 'Smalltalk language' is used by legacy code to access |
166 |
the current language setting. |
|
167 |
Future versions should contain class Locale. |
|
18925 | 168 |
cg: this is crab, who needs this? |
11965 | 169 |
" |
12524 | 170 |
<resource: #obsolete> |
11965 | 171 |
|
15898 | 172 |
self obsoleteMethodWarning. |
18925 | 173 |
^ Smalltalk language , anObject |
11965 | 174 |
|
175 |
"Created: / 22-08-2009 / 09:33:44 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
14069 | 176 |
"Modified (comment): / 01-04-2012 / 13:19:28 / cg" |
11965 | 177 |
! |
178 |
||
179 |
asSymbol |
|
12098 | 180 |
"Returns a language symbol. This is sometimes required |
181 |
as Smalltalk language is used by legacy code to access |
|
182 |
current language. Future versions should contain class |
|
183 |
Locale. |
|
18925 | 184 |
cg: this is crab, who needs this? |
11965 | 185 |
" |
12524 | 186 |
<resource: #obsolete> |
11965 | 187 |
|
15898 | 188 |
self obsoleteMethodWarning. |
18925 | 189 |
^ Smalltalk language |
11965 | 190 |
|
191 |
"Created: / 22-08-2009 / 09:33:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
192 |
! ! |
|
193 |
||
14374 | 194 |
!SmalltalkLanguage methodsFor:'source queries'! |
195 |
||
24370 | 196 |
bracketStrings |
197 |
"used for autoindent" |
|
198 |
||
199 |
^ #( |
|
200 |
('[' ']') "/ blocks |
|
201 |
) |
|
202 |
||
203 |
"Created: / 26-06-2019 / 22:03:42 / Claus Gittinger" |
|
204 |
! |
|
205 |
||
16420 | 206 |
commentStrings |
207 |
^ #( |
|
208 |
'"/' "/ EOL comment |
|
209 |
('"' '"') "/ normal comment |
|
210 |
) |
|
211 |
! |
|
212 |
||
14374 | 213 |
methodDefinitionTemplateForSelector:aSelector andArgumentNames:argNames |
214 |
"given a selector, return a prototype definition string" |
|
215 |
||
22668 | 216 |
(aSelector argumentCount > 0 and:[aSelector argumentCount = argNames size]) ifTrue:[ |
19893 | 217 |
aSelector isKeywordSelector ifTrue:[ |
19855 | 218 |
^ Text streamContents:[:stream | |
14374 | 219 |
aSelector keywords with:argNames do:[:eachKeyword :eachArgName| |
19855 | 220 |
stream bold; nextPutAll:eachKeyword; normal; nextPutAll:eachArgName; space. |
14374 | 221 |
]. |
222 |
stream backStep. "remove the last space" |
|
223 |
]. |
|
224 |
]. |
|
19855 | 225 |
^ aSelector allBold , ' ' , (argNames at:1) |
14374 | 226 |
]. |
19855 | 227 |
^ aSelector allBold |
14374 | 228 |
|
229 |
" |
|
230 |
SmalltalkLanguage instance |
|
231 |
methodDefinitionTemplateForSelector:#foo andArgumentNames:#() |
|
232 |
SmalltalkLanguage instance |
|
233 |
methodDefinitionTemplateForSelector:#+ andArgumentNames:#('aNumber') |
|
234 |
SmalltalkLanguage instance |
|
235 |
methodDefinitionTemplateForSelector:#foo:bar:baz: andArgumentNames:#('fooArg' 'barArg' 'bazArg') |
|
236 |
" |
|
22668 | 237 |
|
238 |
"Modified: / 12-04-2018 / 08:39:15 / stefan" |
|
14374 | 239 |
! ! |
240 |
||
11965 | 241 |
!SmalltalkLanguage methodsFor:'testing'! |
242 |
||
243 |
isSmalltalk |
|
12325 | 244 |
"true iff I represent the smalltalk language" |
11965 | 245 |
|
12325 | 246 |
^ true |
11965 | 247 |
|
248 |
"Created: / 16-08-2009 / 09:01:38 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
249 |
! ! |
|
250 |
||
251 |
!SmalltalkLanguage class methodsFor:'documentation'! |
|
252 |
||
253 |
version |
|
18874 | 254 |
^ '$Header$' |
12047 | 255 |
! |
256 |
||
257 |
version_CVS |
|
18874 | 258 |
^ '$Header$' |
12047 | 259 |
! |
260 |
||
261 |
version_SVN |
|
18874 | 262 |
^'$Id$' |
11965 | 263 |
! ! |
15538 | 264 |