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