author | Claus Gittinger <cg@exept.de> |
Fri, 28 Jan 2011 09:40:43 +0100 | |
changeset 13249 | 076097e9faab |
parent 12524 | ed8630645e13 |
child 13253 | 4112eccb68e0 |
permissions | -rw-r--r-- |
11965 | 1 |
"{ Package: 'stx:libbasic' }" |
2 |
||
3 |
ProgrammingLanguage subclass:#SmalltalkLanguage |
|
4 |
instanceVariableNames:'' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
7 |
category:'Kernel-Languages' |
|
8 |
! |
|
9 |
||
12100 | 10 |
!SmalltalkLanguage class methodsFor:'documentation'! |
11 |
||
12 |
documentation |
|
13 |
" |
|
14 |
provide info about which tools are to be used for smalltalk code |
|
15 |
" |
|
16 |
! ! |
|
11965 | 17 |
|
18 |
!SmalltalkLanguage methodsFor:'accessing'! |
|
19 |
||
20 |
name |
|
12098 | 21 |
"Answers a human-readable name of myself: |
22 |
'Smalltalk' for SmalltalkLanguage, |
|
23 |
'Ruby' for RubyLanguage |
|
24 |
..." |
|
11965 | 25 |
|
12502 | 26 |
^ 'Smalltalk' |
11965 | 27 |
|
28 |
"Modified: / 16-08-2009 / 10:53:35 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
29 |
! |
|
30 |
||
31 |
sourceFileSuffix |
|
12098 | 32 |
" |
33 |
Answers a default suffix for source files, i.e. |
|
34 |
'st' for Smalltalk, 'js' for JavaScript or 'rb' for Ruby' |
|
35 |
" |
|
11965 | 36 |
|
37 |
^'st' |
|
38 |
||
39 |
"Modified: / 16-08-2009 / 10:53:52 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
40 |
! ! |
|
41 |
||
42 |
!SmalltalkLanguage methodsFor:'accessing - classes'! |
|
43 |
||
13249
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
44 |
codeGeneratorToolClass |
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
45 |
"Answers a class that can nerate smalltalk code" |
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
46 |
|
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
47 |
^ CodeGeneratorTool |
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
48 |
! |
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
49 |
|
11965 | 50 |
compilerClass |
12098 | 51 |
"Answer a class suitable for compiling a source code in 'my' language" |
11965 | 52 |
|
12098 | 53 |
^ Smalltalk::Compiler |
11965 | 54 |
|
55 |
"Modified: / 21-08-2009 / 13:02:27 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
56 |
! |
|
57 |
||
58 |
explainerClass |
|
12098 | 59 |
"Answers a class used by browser and debugger to |
60 |
show some hints about the code. It is OK to return |
|
61 |
nil, which means that there is no explainer for given language." |
|
11965 | 62 |
|
63 |
"return nil by default" |
|
12098 | 64 |
^ Smalltalk::Explainer |
11965 | 65 |
|
66 |
"Created: / 21-08-2009 / 08:49:29 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
67 |
! |
|
68 |
||
12098 | 69 |
formatterClass |
70 |
"Answer a class suitable for prettyPrinting (indenting) code in 'my' language. |
|
71 |
It is ok to return nil, which means that the browser will not be able to prettyprint." |
|
72 |
||
73 |
^ Smalltalk::Parser |
|
74 |
! |
|
75 |
||
11965 | 76 |
parserClass |
12098 | 77 |
"Answer a class suitable for parsing a source codein 'my' language" |
11965 | 78 |
|
12098 | 79 |
^ Smalltalk::Parser |
11965 | 80 |
|
81 |
"Modified: / 21-08-2009 / 13:02:21 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
82 |
! |
|
83 |
||
84 |
sourceFileReaderClass |
|
12098 | 85 |
"Answers a class that can be used for reading & compiling source files" |
11965 | 86 |
|
87 |
^SmalltalkChunkFileSourceReader |
|
88 |
||
89 |
"Modified: / 16-08-2009 / 12:29:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
90 |
! |
|
91 |
||
92 |
sourceFileWriterClass |
|
12098 | 93 |
"Answers a class is used for source file writing (i.e. file-out)" |
11965 | 94 |
|
12107 | 95 |
^ SmalltalkChunkFileSourceWriter |
11965 | 96 |
|
97 |
"Modified: / 16-08-2009 / 09:51:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
12098 | 98 |
! |
99 |
||
100 |
syntaxHighlighterClass |
|
101 |
"return the class to use for syntaxHighlighting (prettyPrinting) this class - |
|
102 |
this can be redefined in special classes, to highlight classes with |
|
103 |
Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
|
104 |
||
105 |
^ Smalltalk::SyntaxHighlighter |
|
11965 | 106 |
! ! |
107 |
||
108 |
!SmalltalkLanguage methodsFor:'mimicry'! |
|
109 |
||
110 |
, anObject |
|
12098 | 111 |
"Emulates symbol behavior. This is sometimes required |
112 |
as Smalltalk language is used by legacy code to access |
|
113 |
current language. Future versions should contain class |
|
114 |
Locale. |
|
11965 | 115 |
" |
12524 | 116 |
<resource: #obsolete> |
11965 | 117 |
|
12098 | 118 |
self breakPoint:#cg info:'should not be invoked'. |
12524 | 119 |
^ Language , anObject |
11965 | 120 |
|
121 |
"Created: / 22-08-2009 / 09:33:44 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
122 |
! |
|
123 |
||
124 |
asSymbol |
|
12098 | 125 |
"Returns a language symbol. This is sometimes required |
126 |
as Smalltalk language is used by legacy code to access |
|
127 |
current language. Future versions should contain class |
|
128 |
Locale. |
|
11965 | 129 |
" |
12524 | 130 |
<resource: #obsolete> |
11965 | 131 |
|
12098 | 132 |
self breakPoint:#cg info:'should not be invoked'. |
12524 | 133 |
^ Language |
11965 | 134 |
|
135 |
"Created: / 22-08-2009 / 09:33:16 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
136 |
! ! |
|
137 |
||
138 |
!SmalltalkLanguage methodsFor:'testing'! |
|
139 |
||
140 |
isSmalltalk |
|
12325 | 141 |
"true iff I represent the smalltalk language" |
11965 | 142 |
|
12325 | 143 |
^ true |
11965 | 144 |
|
145 |
"Created: / 16-08-2009 / 09:01:38 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
146 |
! ! |
|
147 |
||
12150
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
148 |
!SmalltalkLanguage methodsFor:'utilities - source code'! |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
149 |
|
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
150 |
methodTemplate |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
151 |
"return a method definition template string" |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
152 |
|
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
153 |
|s| |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
154 |
|
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
155 |
s := TextStream on:''. |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
156 |
s nextPutAll: |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
157 |
'message selector and argument names |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
158 |
"comment stating purpose of this message" |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
159 |
|
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
160 |
|temporaries| |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
161 |
|
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
162 |
statement. |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
163 |
statement. |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
164 |
|
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
165 |
" |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
166 |
optional: comment giving example use |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
167 |
" |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
168 |
'. |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
169 |
s cr. |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
170 |
s emphasis:(UserPreferences current commentEmphasisAndColor). |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
171 |
s nextPutAll: |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
172 |
'" |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
173 |
change the above template into real code; |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
174 |
remove this comment. |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
175 |
Then `accept'' either via the menu |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
176 |
or via the keyboard (usually CMD-A). |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
177 |
|
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
178 |
You do not need this template; you can also |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
179 |
select any existing methods code, change it, |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
180 |
and finally `accept''. The method will then be |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
181 |
installed under the selector as defined in the |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
182 |
actual text - no matter which method is selected |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
183 |
in the browser. |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
184 |
|
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
185 |
Or clear this text, type in the method from scratch |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
186 |
and install it with `accept''. |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
187 |
" |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
188 |
'. |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
189 |
^ s contents |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
190 |
! ! |
fa89d3e7862d
more stuff via programmingLanguage
Claus Gittinger <cg@exept.de>
parents:
12107
diff
changeset
|
191 |
|
11965 | 192 |
!SmalltalkLanguage class methodsFor:'documentation'! |
193 |
||
194 |
version |
|
13249
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
195 |
^ '$Header: /cvs/stx/stx/libbasic/SmalltalkLanguage.st,v 1.13 2011-01-28 08:40:43 cg Exp $' |
12047 | 196 |
! |
197 |
||
198 |
version_CVS |
|
13249
076097e9faab
added: #codeGeneratorToolClass
Claus Gittinger <cg@exept.de>
parents:
12524
diff
changeset
|
199 |
^ '$Header: /cvs/stx/stx/libbasic/SmalltalkLanguage.st,v 1.13 2011-01-28 08:40:43 cg Exp $' |
12047 | 200 |
! |
201 |
||
202 |
version_SVN |
|
12180
e612aeccc282
update #version_SVN with § as keyword expansion character
fm
parents:
12150
diff
changeset
|
203 |
^'§Id: SmalltalkLanguage.st 10468 2009-08-22 08:34:50Z vranyj1 §' |
11965 | 204 |
! ! |