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