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