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