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