author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 08 Aug 2013 11:09:31 +0100 | |
branch | jv |
changeset 18080 | 9ae1db7ef04a |
parent 18079 | 7b5afc0ad3d5 |
parent 15593 | 02cfcd9b9737 |
child 18084 | ab5b38bd8f81 |
permissions | -rw-r--r-- |
8148 | 1 |
" |
2 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
8047 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
8447
9bdea3431846
EncodedStream inherts from PeekableStream
Stefan Vogel <sv@exept.de>
parents:
8444
diff
changeset
|
14 |
PeekableStream subclass:#EncodedStream |
8047 | 15 |
instanceVariableNames:'encoder stream' |
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Collections-Text-Encodings' |
|
19 |
! |
|
20 |
||
8148 | 21 |
!EncodedStream class methodsFor:'documentation'! |
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
15049 | 35 |
! |
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
a stream which transparently decodes from an external decoding, |
|
40 |
looking for '---- Encoding: xxx' near the beginning of the file. |
|
41 |
||
42 |
especially targeted towards reading ST/X source files. |
|
43 |
" |
|
8148 | 44 |
! ! |
8047 | 45 |
|
46 |
!EncodedStream class methodsFor:'instance creation'! |
|
47 |
||
48 |
stream:streamArg encoder:encoder |
|
49 |
^ (self basicNew) stream:streamArg; encoder:encoder |
|
50 |
! ! |
|
51 |
||
12610 | 52 |
!EncodedStream class methodsFor:'utilities'! |
53 |
||
54 |
decodedStreamFor:aStream |
|
15345 | 55 |
"given a positionable stream, guess its encoding (by reading the |
56 |
first few lines, looking for a string with an encoding hint, |
|
57 |
and return an appropriate encoded string, which does the decoding |
|
58 |
on the fly. Used mostly to read UTF8 files (source code)" |
|
59 |
||
15049 | 60 |
|encodingSymbol decoder decodedStream| |
12610 | 61 |
|
62 |
aStream isPositionable ifTrue:[ |
|
15049 | 63 |
encodingSymbol := CharacterEncoder guessEncodingOfStream:aStream. |
18066
89d51443ba6f
Merged 1d9323e0a535 and 5fcd709c7fd2 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
64 |
decoder := CharacterEncoder encoderFor:encodingSymbol. |
15049 | 65 |
decoder isNil ifTrue:[ |
66 |
"/ ascii or iso8895-1 |
|
67 |
^ aStream |
|
12610 | 68 |
]. |
15049 | 69 |
] ifFalse:[ |
70 |
"/ setup for no-encoding; |
|
71 |
"/ switch to a real encoder later, |
|
14095 | 72 |
"/ whenever an encoding pragma is encountered later. |
73 |
decoder := CharacterEncoder nullEncoderInstance. |
|
74 |
]. |
|
75 |
decodedStream := self stream:aStream encoder:decoder. |
|
18041
d17dbf11e306
Fix for file in of UTF8 files (part 2).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18039
diff
changeset
|
76 |
"JV@2012-03-27: NO, DO NOT CHANGE POSITION!! Caller might be interested |
d17dbf11e306
Fix for file in of UTF8 files (part 2).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18039
diff
changeset
|
77 |
in all data!!!!!!" |
d17dbf11e306
Fix for file in of UTF8 files (part 2).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18039
diff
changeset
|
78 |
"/decodedStream skipEncodingChunk. |
12610 | 79 |
^ decodedStream |
15049 | 80 |
|
18041
d17dbf11e306
Fix for file in of UTF8 files (part 2).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18039
diff
changeset
|
81 |
"Modified: / 27-03-2013 / 17:08:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
15049 | 82 |
! |
83 |
||
18066
89d51443ba6f
Merged 1d9323e0a535 and 5fcd709c7fd2 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
84 |
! |
12610 | 85 |
|
8047 | 86 |
!EncodedStream methodsFor:'accessing'! |
87 |
||
11992 | 88 |
contentsSpecies |
89 |
||
90 |
"Not sure if this is ok" |
|
91 |
||
92 |
^ stream contentsSpecies. |
|
93 |
||
94 |
"/ ^UnicodeString |
|
95 |
||
96 |
"Created: / 14-06-2005 / 17:11:01 / janfrog" |
|
97 |
! |
|
98 |
||
8047 | 99 |
encoder |
100 |
^ encoder |
|
101 |
! |
|
102 |
||
103 |
encoder:something |
|
104 |
encoder := something. |
|
105 |
! |
|
106 |
||
15593 | 107 |
inputStream |
108 |
^ stream inputStream |
|
109 |
! |
|
110 |
||
111 |
lineNumber |
|
112 |
^ stream lineNumber |
|
113 |
! |
|
114 |
||
12646 | 115 |
pathName |
116 |
"if our base stream hat a pathname, delegate..." |
|
117 |
||
118 |
stream isNil ifTrue:[ |
|
119 |
^ nil. |
|
120 |
]. |
|
121 |
^ stream pathName. |
|
122 |
! |
|
123 |
||
11766 | 124 |
readStream |
125 |
^ self |
|
126 |
! |
|
127 |
||
8047 | 128 |
stream |
129 |
^ stream |
|
130 |
! |
|
131 |
||
132 |
stream:something |
|
133 |
stream := something. |
|
134 |
! ! |
|
135 |
||
18039
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
136 |
!EncodedStream methodsFor:'private fileIn'! |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
137 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
138 |
basicFileInNotifying:someone passChunk:passChunk |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
139 |
"central method to file in from the receiver, i.e. read chunks and evaluate them - |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
140 |
return the value of the last chunk. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
141 |
Someone (which is usually some codeView) is notified of errors." |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
142 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
143 |
|lastValue pkg nameSpace usedNameSpaces |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
144 |
packageQuerySignal nameSpaceQuerySignal usedNameSpaceQuerySignal |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
145 |
changeDefaultApplicationNotificationSignal |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
146 |
defaultApplicationQuerySignal defaultApplication |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
147 |
confirmationQuerySignal handledSignals passedSignals askSomeoneForPackage outerContext askForVariableTypeOfUndeclaredQuery| |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
148 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
149 |
self skipSeparators. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
150 |
lastValue := self peek. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
151 |
lastValue == $< ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
152 |
"/ assume, it's an xml file |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
153 |
^ self fileInXMLNotifying:someone passChunk:passChunk. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
154 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
155 |
lastValue == $# ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
156 |
"assume unix interpreter name: |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
157 |
'#!!stx -e' or something like this" |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
158 |
self nextPeek == $!! ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
159 |
"skip the unix command line" |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
160 |
self nextLine |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
161 |
] ifFalse:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
162 |
self error:'Invalid chunk start' |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
163 |
] |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
164 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
165 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
166 |
Smalltalk::Compiler isNil ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
167 |
self isFileStream ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
168 |
Transcript show:('[' , self pathName , '] '). |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
169 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
170 |
Transcript showCR:'cannot fileIn (no compiler).'. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
171 |
^ nil. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
172 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
173 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
174 |
"/ support for V'Age applications |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
175 |
defaultApplicationQuerySignal := Class defaultApplicationQuerySignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
176 |
changeDefaultApplicationNotificationSignal := Class changeDefaultApplicationNotificationSignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
177 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
178 |
"/ support for ST/X's nameSpaces & packages |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
179 |
packageQuerySignal := Class packageQuerySignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
180 |
nameSpaceQuerySignal := Class nameSpaceQuerySignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
181 |
usedNameSpaceQuerySignal := Class usedNameSpaceQuerySignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
182 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
183 |
(someone respondsTo:#packageToInstall) ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
184 |
pkg := someone packageToInstall. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
185 |
askSomeoneForPackage := true. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
186 |
] ifFalse:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
187 |
pkg := packageQuerySignal query. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
188 |
askSomeoneForPackage := false. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
189 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
190 |
(someone respondsTo:#currentNameSpace) ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
191 |
nameSpace := someone currentNameSpace |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
192 |
] ifFalse:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
193 |
nameSpace := nameSpaceQuerySignal query. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
194 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
195 |
(someone respondsTo:#usedNameSpaces) ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
196 |
usedNameSpaces := someone usedNameSpaces |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
197 |
] ifFalse:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
198 |
usedNameSpaces := usedNameSpaceQuerySignal query. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
199 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
200 |
(someone respondsTo:#defaultApplication) ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
201 |
defaultApplication := someone defaultApplication |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
202 |
] ifFalse:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
203 |
defaultApplication := defaultApplicationQuerySignal query. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
204 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
205 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
206 |
confirmationQuerySignal := Metaclass confirmationQuerySignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
207 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
208 |
handledSignals := SignalSet new. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
209 |
passedSignals := IdentitySet new. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
210 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
211 |
handledSignals add:changeDefaultApplicationNotificationSignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
212 |
passedSignals add:changeDefaultApplicationNotificationSignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
213 |
handledSignals add:defaultApplicationQuerySignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
214 |
passedSignals add:defaultApplicationQuerySignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
215 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
216 |
handledSignals add:packageQuerySignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
217 |
handledSignals add:usedNameSpaceQuerySignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
218 |
handledSignals add:nameSpaceQuerySignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
219 |
handledSignals add:confirmationQuerySignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
220 |
passedSignals add:confirmationQuerySignal. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
221 |
Parser notNil ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
222 |
"only if libcomp is present" |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
223 |
"Also catch a 'Parser askForVariableTypeOfUndeclaredQuery' and proceed with nil. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
224 |
Imagine somebody has autodefine workspace variables on and then |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
225 |
evaluate Smalltalk loadPackage:'xyz' that loads code from source (using file-in), |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
226 |
certainly we don't want to compile workspace variable access for every |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
227 |
not-yet-loaded class in some namespace. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
228 |
This is demonstrated by Regression::CompilerTests2>>test_01 |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
229 |
and this change actually fixes this test." |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
230 |
askForVariableTypeOfUndeclaredQuery := Parser askForVariableTypeOfUndeclaredQuery. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
231 |
handledSignals add:askForVariableTypeOfUndeclaredQuery. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
232 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
233 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
234 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
235 |
outerContext := thisContext. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
236 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
237 |
handledSignals handle:[:ex | |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
238 |
|sig| |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
239 |
|
18062
014678b4657a
Merged 2643e3012a13 and 395779f18870 (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18045
diff
changeset
|
240 |
sig := ex creator. |
18039
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
241 |
((passedSignals includes:sig) and:[sig isHandledIn:outerContext]) ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
242 |
ex reject |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
243 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
244 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
245 |
sig == changeDefaultApplicationNotificationSignal ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
246 |
"/ invoked via #becomeDefault to set the defaultApp and the package. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
247 |
"/ (only when filing in V'Age code) |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
248 |
defaultApplication := ex parameter. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
249 |
pkg := defaultApplication name asSymbol. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
250 |
ex proceedWith:nil |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
251 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
252 |
sig == defaultApplicationQuerySignal ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
253 |
"/ query for the application to add classes & methods into |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
254 |
"/ (only when filing in V'Age code) |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
255 |
ex proceedWith:defaultApplication |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
256 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
257 |
sig == packageQuerySignal ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
258 |
"answer the package to use for classes & methods" |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
259 |
askSomeoneForPackage ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
260 |
ex proceedWith:someone packageToInstall |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
261 |
] ifFalse:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
262 |
ex proceedWith:pkg |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
263 |
] |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
264 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
265 |
sig == usedNameSpaceQuerySignal ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
266 |
"answer the nameSpaces to be searched when encountering globals" |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
267 |
ex proceedWith:usedNameSpaces |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
268 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
269 |
sig == nameSpaceQuerySignal ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
270 |
"answer the nameSpace to install new classes in" |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
271 |
ex proceedWith:nameSpace |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
272 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
273 |
sig == confirmationQuerySignal ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
274 |
"don't pop up dialogs" |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
275 |
ex proceedWith:false |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
276 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
277 |
sig == askForVariableTypeOfUndeclaredQuery ifTrue:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
278 |
"no autodefined variables or so" |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
279 |
ex proceedWith:nil. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
280 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
281 |
] do:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
282 |
[self atEnd] whileFalse:[ |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
283 |
lastValue := self fileInNextChunkNotifying:someone passChunk:passChunk |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
284 |
] |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
285 |
]. |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
286 |
^ lastValue |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
287 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
288 |
"Modified: / 10.9.1999 / 16:54:01 / stefan" |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
289 |
"Modified: / 16.11.2001 / 16:21:28 / cg" |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
290 |
"Modified: / 18-03-2013 / 17:45:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
291 |
! ! |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
292 |
|
8047 | 293 |
!EncodedStream methodsFor:'stream protocol'! |
294 |
||
8175 | 295 |
atEnd |
296 |
^ stream atEnd |
|
297 |
! |
|
298 |
||
8165 | 299 |
close |
300 |
stream close |
|
301 |
! |
|
302 |
||
13400 | 303 |
contents |
304 |
||
305 |
^String streamContents: |
|
306 |
[:s| |
|
307 |
[ stream atEnd ] whileFalse: |
|
308 |
[s nextPut: stream next] |
|
309 |
] |
|
310 |
||
311 |
"Created: / 25-02-2010 / 23:34:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
312 |
! |
|
313 |
||
8213 | 314 |
cr |
8459 | 315 |
self nextPutAll:(Character cr asString) |
8213 | 316 |
! |
317 |
||
11992 | 318 |
emphasis:anObject |
319 |
||
320 |
stream emphasis:anObject |
|
321 |
||
322 |
"Created: / 15-06-2005 / 11:16:33 / janfrog" |
|
323 |
! |
|
324 |
||
15477 | 325 |
flush |
326 |
stream flush |
|
327 |
! |
|
328 |
||
11946 | 329 |
isOpen |
12690 | 330 |
^ stream notNil and:[stream isOpen] |
11946 | 331 |
! |
332 |
||
11766 | 333 |
next |
11992 | 334 |
|
335 |
^encoder readNextCharacterFrom:stream |
|
336 |
||
337 |
"Created: / 14-06-2005 / 17:01:39 / janfrog" |
|
338 |
! |
|
11766 | 339 |
|
11992 | 340 |
next:charactersToRead |
341 |
||
342 |
^encoder readNext:charactersToRead charactersFrom:stream |
|
343 |
||
344 |
"Created: / 16-06-2005 / 11:43:43 / masca" |
|
11766 | 345 |
! |
346 |
||
8147 | 347 |
nextChunk |
8175 | 348 |
|chunk| |
349 |
||
350 |
chunk := stream nextChunk. |
|
351 |
chunk isNil ifTrue:[^ chunk]. |
|
352 |
^ encoder decodeString:chunk |
|
8147 | 353 |
! |
354 |
||
8213 | 355 |
nextChunkPut:chunk |
356 |
stream nextChunkPut:(encoder encodeString:chunk) |
|
357 |
! |
|
358 |
||
8047 | 359 |
nextPut:aCharacter |
360 |
self nextPutAll:(aCharacter asString). |
|
361 |
! |
|
362 |
||
363 |
nextPutAll:aCollection |
|
364 |
stream nextPutAll:(encoder encodeString:aCollection). |
|
8147 | 365 |
! |
366 |
||
8444 | 367 |
peek |
11992 | 368 |
|
369 |
^stream peek |
|
370 |
||
371 |
"Created: / 20-06-2005 / 10:13:03 / masca" |
|
372 |
"Modified: / 20-06-2005 / 13:06:14 / masca" |
|
8444 | 373 |
! |
374 |
||
8175 | 375 |
peekFor:aCharacter |
376 |
^ stream peekFor:aCharacter |
|
377 |
! |
|
378 |
||
8165 | 379 |
position |
380 |
^ stream position |
|
381 |
! |
|
382 |
||
8197 | 383 |
position0Based |
11947 | 384 |
"to be obsoleted - use position" |
385 |
||
8197 | 386 |
^ stream position0Based |
387 |
! |
|
388 |
||
389 |
position0Based:newPosition |
|
11947 | 390 |
"to be obsoleted - use position" |
391 |
||
8197 | 392 |
stream position0Based:newPosition |
393 |
! |
|
394 |
||
8175 | 395 |
position1Based |
11947 | 396 |
"to be obsoleted - use position" |
397 |
||
8175 | 398 |
^ stream position1Based |
399 |
! |
|
400 |
||
8147 | 401 |
position1Based:newPosition |
11947 | 402 |
"to be obsoleted - use position" |
403 |
||
8147 | 404 |
stream position1Based:newPosition |
8175 | 405 |
! |
406 |
||
8197 | 407 |
position:newPosition |
408 |
stream position:newPosition |
|
409 |
! |
|
410 |
||
13400 | 411 |
reset |
412 |
stream reset |
|
413 |
||
414 |
"Created: / 25-02-2010 / 23:37:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
415 |
! |
|
416 |
||
8213 | 417 |
setToEnd |
418 |
stream setToEnd |
|
419 |
! |
|
420 |
||
14333 | 421 |
size |
422 |
"not correct, but probably better than 0" |
|
423 |
||
15585 | 424 |
"/ is that better? |
425 |
"/ self error:'size of input is unknown (due to decoding)' |
|
14333 | 426 |
^ stream size |
427 |
||
428 |
"Created: / 31-08-2012 / 16:52:40 / cg" |
|
429 |
! |
|
430 |
||
11992 | 431 |
skip: anInteger |
432 |
||
433 |
"/ Should skip on character basis, not on bytes. This works for XML reader |
|
434 |
^stream skip: anInteger |
|
435 |
||
436 |
"Created: / 20-06-2005 / 13:06:06 / masca" |
|
437 |
! |
|
438 |
||
8175 | 439 |
skipSeparators |
440 |
^ stream skipSeparators |
|
15477 | 441 |
! |
442 |
||
443 |
sync |
|
444 |
stream sync |
|
445 |
! |
|
446 |
||
447 |
syncData |
|
448 |
stream syncData |
|
8047 | 449 |
! ! |
450 |
||
15049 | 451 |
!EncodedStream methodsFor:'testing'! |
452 |
||
18080
9ae1db7ef04a
Merged 7b5afc0ad3d5 and 7da6f15bd81c (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
453 |
|
15592 | 454 |
|
455 |
isReadable |
|
456 |
^ stream isReadable |
|
457 |
! |
|
458 |
||
459 |
isWritable |
|
460 |
^ stream isWritable |
|
15049 | 461 |
! ! |
462 |
||
8712
bcef3a0c0a1d
skipEncodingCHunk now in EncodedStream
Claus Gittinger <cg@exept.de>
parents:
8459
diff
changeset
|
463 |
!EncodedStream methodsFor:'utilities'! |
bcef3a0c0a1d
skipEncodingCHunk now in EncodedStream
Claus Gittinger <cg@exept.de>
parents:
8459
diff
changeset
|
464 |
|
bcef3a0c0a1d
skipEncodingCHunk now in EncodedStream
Claus Gittinger <cg@exept.de>
parents:
8459
diff
changeset
|
465 |
skipEncodingChunk |
14091 | 466 |
|pos chunk token| |
8712
bcef3a0c0a1d
skipEncodingCHunk now in EncodedStream
Claus Gittinger <cg@exept.de>
parents:
8459
diff
changeset
|
467 |
|
13525
e17ebc11ca73
changed: #skipEncodingChunk
Claus Gittinger <cg@exept.de>
parents:
13400
diff
changeset
|
468 |
stream isPositionable ifFalse:[ |
e17ebc11ca73
changed: #skipEncodingChunk
Claus Gittinger <cg@exept.de>
parents:
13400
diff
changeset
|
469 |
^ self |
e17ebc11ca73
changed: #skipEncodingChunk
Claus Gittinger <cg@exept.de>
parents:
13400
diff
changeset
|
470 |
]. |
e17ebc11ca73
changed: #skipEncodingChunk
Claus Gittinger <cg@exept.de>
parents:
13400
diff
changeset
|
471 |
|
8712
bcef3a0c0a1d
skipEncodingCHunk now in EncodedStream
Claus Gittinger <cg@exept.de>
parents:
8459
diff
changeset
|
472 |
pos := self position. |
bcef3a0c0a1d
skipEncodingCHunk now in EncodedStream
Claus Gittinger <cg@exept.de>
parents:
8459
diff
changeset
|
473 |
chunk := self nextChunk. |
14084 | 474 |
[ |
475 |
"/ if this is a valid chunk (i.e. not a comment or encoding-directive), |
|
476 |
"/ then position back, so it will be processed as usual. |
|
14091 | 477 |
"/ We could parse here, but this is overkill, since we are only interested in the fact, |
478 |
"/ that there is anything else than a comment in the chunk. |
|
479 |
"/ result := (Parser for:chunk) |
|
480 |
"/ ignoreErrors:true; |
|
481 |
"/ ignoreWarnings:true; |
|
482 |
"/ parseMethodBody. |
|
483 |
||
484 |
token := (Scanner for:chunk) |
|
485 |
ignoreErrors:true; |
|
486 |
ignoreWarnings:true; |
|
487 |
nextToken. |
|
488 |
||
489 |
token ~= #EOF ifTrue:[ |
|
14084 | 490 |
self position:pos |
491 |
]. |
|
14086 | 492 |
] on:Parser parseWarningSignal do:[:ex| |
14084 | 493 |
"really ignore any error. |
494 |
Even setting ignorError will output diagnostics here |
|
495 |
during standalone startup when debugging" |
|
14086 | 496 |
ex proceedWith:#ignore. |
14084 | 497 |
]. |
13525
e17ebc11ca73
changed: #skipEncodingChunk
Claus Gittinger <cg@exept.de>
parents:
13400
diff
changeset
|
498 |
|
e17ebc11ca73
changed: #skipEncodingChunk
Claus Gittinger <cg@exept.de>
parents:
13400
diff
changeset
|
499 |
"Modified: / 29-07-2011 / 17:42:11 / cg" |
8712
bcef3a0c0a1d
skipEncodingCHunk now in EncodedStream
Claus Gittinger <cg@exept.de>
parents:
8459
diff
changeset
|
500 |
! ! |
bcef3a0c0a1d
skipEncodingCHunk now in EncodedStream
Claus Gittinger <cg@exept.de>
parents:
8459
diff
changeset
|
501 |
|
8047 | 502 |
!EncodedStream class methodsFor:'documentation'! |
503 |
||
14086 | 504 |
version |
15593 | 505 |
^ '$Header: /cvs/stx/stx/libbasic/EncodedStream.st,v 1.32 2013-08-01 10:55:14 cg Exp $' |
14086 | 506 |
! |
507 |
||
13400 | 508 |
version_CVS |
15593 | 509 |
^ '$Header: /cvs/stx/stx/libbasic/EncodedStream.st,v 1.32 2013-08-01 10:55:14 cg Exp $' |
12610 | 510 |
! |
511 |
||
18039
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
512 |
version_HG |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
513 |
|
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
514 |
^ '$Changeset: <not expanded> $' |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
515 |
! |
09806667c605
Bugfix : file-in of UTF8 encoded .st file.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18011
diff
changeset
|
516 |
|
13400 | 517 |
version_SVN |
15345 | 518 |
^ '$ Id: EncodedStream.st 10643 2011-06-08 21:53:07Z vranyj1 $' |
8047 | 519 |
! ! |
15049 | 520 |