author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 16 Dec 2012 21:04:02 +0100 | |
branch | directory_structure_refactoring |
changeset 1899 | 800c0f76adce |
parent 1818 | 2e5ed72e7dfd |
child 1853 | 0adc17571595 |
permissions | -rw-r--r-- |
877 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 3 |
|
1155 | 4 |
New code and modifications done at SWING Research Group [1]: |
1152 | 5 |
|
877 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
1155 | 16 |
[1] Code written at SWING Research Group contains a signature |
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
1152 | 19 |
as of 1.9.2010 |
877 | 20 |
" |
752 | 21 |
"{ Package: 'stx:libjava' }" |
22 |
||
23 |
ProgrammingLanguage subclass:#JavaLanguage |
|
24 |
instanceVariableNames:'' |
|
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Support' |
|
28 |
! |
|
29 |
||
877 | 30 |
!JavaLanguage class methodsFor:'documentation'! |
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 35 |
|
1155 | 36 |
New code and modifications done at SWING Research Group [1]: |
1152 | 37 |
|
877 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
1155 | 48 |
[1] Code written at SWING Research Group contains a signature |
49 |
of one of the above copright owners. For exact set of such code, |
|
50 |
see the differences between this version and version stx:libjava |
|
1152 | 51 |
as of 1.9.2010 |
877 | 52 |
|
53 |
" |
|
54 |
! ! |
|
752 | 55 |
|
56 |
!JavaLanguage methodsFor:'accessing'! |
|
57 |
||
58 |
lookup |
|
59 |
||
60 |
^Lookup builtin |
|
61 |
||
62 |
"Created: / 17-03-2011 / 14:23:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
63 |
! |
|
64 |
||
65 |
name |
|
66 |
"Answers a human-readable name of myself: |
|
67 |
'Smalltalk' for SmalltalkLanguage, |
|
68 |
'Ruby' for RubyLanguage |
|
69 |
..." |
|
70 |
||
71 |
^ 'Java' |
|
72 |
||
73 |
"Modified: / 26-10-2010 / 23:40:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
74 |
! |
|
75 |
||
76 |
sourceFileSuffix |
|
77 |
"Answers a default suffix for source files, i.e. 'st' for Smalltalk, |
|
78 |
'js' for JavaScript or 'rb' for Ruby', etc." |
|
79 |
||
80 |
^ 'java' |
|
81 |
||
82 |
"Modified: / 26-10-2010 / 23:40:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
83 |
! ! |
|
84 |
||
85 |
!JavaLanguage methodsFor:'accessing - classes'! |
|
86 |
||
87 |
compilerClass |
|
88 |
"Answer a class suitable for compiling a source code in 'my' language" |
|
89 |
||
1455 | 90 |
^ GroovyCompiler "No Java compiler yet :-(" |
752 | 91 |
|
1455 | 92 |
"Modified (comment): / 04-04-2012 / 22:45:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 93 |
! |
94 |
||
917 | 95 |
evaluatorClass |
96 |
||
1368 | 97 |
"There is no evaluator for Java. If you would like to |
98 |
evaluate Java code, use GroovyEvaluator instead" |
|
1612 | 99 |
^GroovyEvaluator |
917 | 100 |
|
101 |
"Created: / 16-08-2011 / 10:03:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
102 |
! |
|
103 |
||
752 | 104 |
lookupClass |
105 |
||
106 |
^JavaLookup |
|
107 |
||
108 |
"Created: / 17-03-2011 / 14:08:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
109 |
! |
|
110 |
||
111 |
parserClass |
|
112 |
"Answer a class suitable for parsing a source code in 'my' language" |
|
113 |
||
114 |
^ nil "No Java parser yet" |
|
115 |
||
116 |
"Modified: / 26-10-2010 / 23:41:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
117 |
! |
|
118 |
||
119 |
sourceFileReaderClass |
|
120 |
"Answers a class that can be used for reading & compiling source files" |
|
121 |
||
122 |
^ nil "No Java compiler yet" |
|
123 |
||
124 |
"Modified: / 26-10-2010 / 23:41:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
125 |
! |
|
126 |
||
127 |
sourceFileWriterClass |
|
128 |
"Answers a class is used for source file writing (i.e. file-out)" |
|
129 |
||
130 |
^ JavaSourceFileWriter |
|
131 |
||
132 |
"Modified: / 27-10-2010 / 18:42:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1356
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
133 |
! |
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
134 |
|
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
135 |
syntaxHighlighterClass |
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
136 |
"Answers a class used by browser and debugger to colorze code. |
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
137 |
It is OK to return nil, which means that the code is shown as-is" |
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
138 |
|
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
139 |
"return nil by default" |
1400 | 140 |
"/ ^nil |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1405
diff
changeset
|
141 |
^JavaSyntaxHighlighter |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1405
diff
changeset
|
142 |
"/ ^ JavaSyntaxHighlighter_Old |
1356
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
143 |
|
0dd28400803e
Proxy methods from libjava/experiments moved to libjava
vranyj1
parents:
1288
diff
changeset
|
144 |
"Created: / 11-02-2012 / 18:11:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 145 |
! ! |
146 |
||
147 |
!JavaLanguage methodsFor:'queries'! |
|
148 |
||
149 |
supportsExtensionMethods |
|
1698
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1612
diff
changeset
|
150 |
" |
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1612
diff
changeset
|
151 |
Answer true iff this language supports extension methods, i.e., if the language |
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1612
diff
changeset
|
152 |
can provide extension methods for another class (not necessarily of the same language |
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1612
diff
changeset
|
153 |
" |
752 | 154 |
|
155 |
^false |
|
156 |
||
1698
d32a2a3dce36
- Some more support for non-Java extension methods.
vranyj1
parents:
1612
diff
changeset
|
157 |
"Created: / 06-09-2012 / 12:09:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 158 |
! ! |
159 |
||
1288 | 160 |
!JavaLanguage methodsFor:'testing'! |
161 |
||
162 |
isJava |
|
163 |
"true iff this is the Java language" |
|
164 |
||
165 |
^ true |
|
166 |
||
167 |
"Created: / 15-12-2011 / 23:10:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1478 | 168 |
! |
169 |
||
170 |
isJavaLike |
|
171 |
"true if receiver is kind of Java language (based on Java)" |
|
172 |
||
173 |
^ true |
|
174 |
||
175 |
"Created: / 13-04-2012 / 17:48:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1288 | 176 |
! ! |
177 |
||
1453 | 178 |
!JavaLanguage methodsFor:'utilities - source code'! |
179 |
||
180 |
classTemplateFor: superClass in: category asNamespace: isNamespace private: isPrivate |
|
181 |
| sclass | |
|
182 |
||
183 |
self assert: isNamespace not. |
|
184 |
self assert: ((superClass == Object) or:[superClass isJavaClass]). |
|
185 |
||
186 |
sclass := superClass == Object ifTrue:[Java classForName:'java.lang.Object'] ifFalse:[superClass]. |
|
187 |
||
188 |
^'//import stx.libjava.annotations.Category; |
|
189 |
//@Category("%(CATEGORY)") |
|
190 |
%(ACCESS) class %(NAME) extends %(SNAME) { |
|
191 |
/* fields and methods here... */ |
|
192 |
} |
|
193 |
' expandPlaceholdersWith: |
|
194 |
(Dictionary new |
|
195 |
at: 'CATEGORY' put: category; |
|
196 |
at: 'ACCESS' put: (isPrivate ifTrue:['protected'] ifFalse:['public']); |
|
197 |
at: 'NAME' put: 'NewClass'; |
|
198 |
at: 'SNAME' put: sclass javaName; |
|
199 |
yourself) |
|
200 |
||
201 |
"Created: / 18-02-2012 / 18:27:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
202 |
! ! |
|
203 |
||
752 | 204 |
!JavaLanguage class methodsFor:'documentation'! |
205 |
||
206 |
version_SVN |
|
207 |
^ '$Id$' |
|
208 |
! ! |