This file is indexed.

/usr/share/gnu-smalltalk/examples/xml.sed is in gnu-smalltalk-common 3.2.4-2.1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
#! /bin/sed -f

#######################################################################
#
#   Convert VisualWorks XML file-outs to chunked format
#
########################################################################


#######################################################################
#
# Copyright 1999, 2000, 2008 Free Software Foundation, Inc.
# Written by Paolo Bonzini.
#
# This file is part of GNU Smalltalk
#
# GNU Smalltalk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# 
# GNU Smalltalk is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with GNU Smalltalk; see the file COPYING.  If not, write to
# the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.  
#
########################################################################

# Remove processing instructions and comments
s/<?[^?]*?>//g

:xmlcomment
/^<!--/ {
  /-->/! {
    :continue
    N
    /-->/! b continue
  }
  s/^<!--[^-]*-\([^-][^-]*-\)*->//
  b xmlcomment
}

/^$/d

# Set the default namespace to be Smalltalk, and restore it
# when we reach the imported classes
1 {
  h
  s/.*/Smalltalk/
  x
}

/"Imported Classes:"/ {
  :imports
  /parcel imports/! {
    N
    b imports
  }
  x
  /^Smalltalk$/! i\
Namespace current: Smalltalk!
  s/.*/"Imported Classes:"/
  h
  d
}

0,/<st-source>/d
/<\/st-source>/,$ d

# Turn copyright into a Smalltalk comment; "..." becomes `...'
/<copyright>/ {
  :copyright
  /<\/copyright>/! {
    N
    b copyright
  }

  :quote
  s/"/`/
  s/"/'/
  t quote
  s|</\{0,1\}copyright>|"|g
  s/$/\
/
  b entities
}

# Turn timestamp into a Smalltalk string
/<time-stamp>/ {
  :timestamp
  /<\/time-stamp>/! {
    N
    b timestamp
  }
  s/'/''/g
  s|</\{0,1\}time-stamp>|'|g
  s/$/!/
  b entities
}

# Convert namespace declarations to `parent addSubspace: #child'
/<name-space>/ {
  :namespace
  /<\/name-space>/! {
    N
    b namespace
  }

  s|<name-space>\
<name>\([^<]*\)</name>\
<environment>\([^<]*\)</environment>.*\
</name-space>|\
\2 addSubspace: #\1!|
}

/<methods>/ {
  :methods
  /<\/methods>/! {
    N
    b methods
  }

  # Convert the body into chunk representation
  s|^<methods>||
  s|\n</methods>$| !|
  s|<body[^>]*>\([^\n]*.\)\n\{0,1\}|\1|g
  s|</body>|!|g

  # Subsume the category into the class-id tag
  s|\(</class-id>\) <category>\([^<].*\)</category>\n| methodsFor: '\2'!\
\1|
  b classid
}

/<comment>/ {
  :comment
  /<\/comment>/! {
    N
    b comment
  }
  # Reject namespace comments
  /<class-id>/! d

  # Quote any apostrophe, since we are inside a string, and
  # convert to `<class-id>class</class-id> comment: 'body' '
  s/'/''/g
  s|.*<class-id>\(.*\)</class-id>\
.*<body>\(.*\)</body>\
.*|\
<class-id>\1</class-id> comment: '\
\2'!\
|

  # Check if the class belongs to the active name-space
  # If so, omit the name-space specification.
  :classid
  s/<class-id>Core./<class-id>Smalltalk./
  G
  /<class-id>\([^.]*\)\..*\n\1$/  s/\(<class-id>\)[^.]*\./\1/
  s/\(.*\)\n.*/\1/

  s|<class-id>\([^<]*\)</class-id>|\1|

  # Fix a little the output
  /methodsFor/ s/^\n/&!/
  b entities
}

/<class>/ {
  :class
  /<\/class>/! {
    N
    b class
  }

  # We have no Core namespace
  s|<environment>Core</environment>|<environment>Smalltalk</environment>|
  s|<super>Core\.|<super>Smalltalk.|

  # If the class is to be defined in another environment, set
  # the current namespace
  G
  /"Imported Classes:"$/d

  /<environment>\([^<]*\)<\/environment>.*\n\1$/! {
    h
    s|.*<environment>\(.*\)</environment>.*|\
Namespace current: \1!|p
    s/.*Namespace current: //
    s/!//g
    x
  }
  s/\(.*\)\n.*/\1/

  # If the class and the superclass belong to the same namespace, remove
  # the namespace from the superclass
  s|\(<environment>\([^<]*\)</environment>.<super>\)\2\.|\1|

  # There is a default for the category
  s|<category></category>|<category>Unclassified</category>|

  # The attributes tag is optional ([^s> does not match attributes
  # closing tag)
  s|\([^s]>\)\(.\)\(</class>\)|\1\2<attributes></attributes>\2\3|
  
  # Do the bulk of the translation
  s|<class>\
<name>\([^<]*\)</name>\
<environment>\([^<]*\)</environment>\
<super>\([^<]*\)</super>\
<private>[^<]*</private>\
<indexed-type>\([^<]*\)</indexed-type>\
<inst-vars>\([^<]*\)</inst-vars>\
<class-inst-vars>\([^<]*\)</class-inst-vars>\
<imports>[^<]*</imports>\
<category>\([^<]*\)</category>\
<attributes>.*</attributes>\
</class>|\
\3 -\4- #\1\
    instanceVariableNames: '\5'\
    classVariableNames: ''\
    poolDictionaries: ''\
    category: '\2-\7'!\
\
\1 class instanceVariableNames: '\6'!|

  # Remove an empty class-instance variable declaration, and
  # convert the indexed instance variable declaration
  s/\n\n[^ ]* class instanceVariableNames: ''!//
  s/-none- #/subclass: #/
  s/-byte- #/variableByteSubclass: #/
  s/-word- #/variableWordSubclass: #/
  s/-objects\?- #/variableSubclass: #/
  b entities
}

/<shared-variable>/ {
  :var
  /<\/shared-variable>/! {
    N
    b var
  }

  # We have no Core namespace
  s|<environment>Core</environment>|<environment>Smalltalk</environment>|

  # If the class is to be defined in another environment, set
  # the current namespace
  G
  treset
  :reset
  s|<environment>\([^<]*\.\([^<]*\)\)\(.*\)\n\1$|<environment>\2\3|
  tenv
  s/\(.*\)\n.*/\1/
  :env

  # The attributes tag is optional ([^s> does not match attributes
  # closing tag)
  s|\([^s]>\)\(.\)\(</class>\)|\1\2<attributes></attributes>\2\3|

  # Do the bulk of the translation for pool variables
  s|<shared-variable>\
<name>\([^<]*\)</name>\
<environment>\([^<]*\)</environment>\
<private>\([^<]*\)</private>\
<constant>\([^<]*\)</constant>\
<category>\([^<]*\)</category>\
<initializer>\([^<]*\)</initializer>\
<attributes>.*</attributes>\
</shared-variable>|\
\2 at: #'\1' put: \6!|

  # Do the bulk of the translation for class variables
  s|<shared-variable>\
<name>\([^<]*\)</name>\
<environment>\([^<]*\)</environment>\
<private>\([^<]*\)</private>\
<constant>\([^<]*\)</constant>\
<category>\([^<]*\)</category>\
<attributes>.*</attributes>\
</shared-variable>|\
\2 addClassVariable: #'\1'!|

  b entities
}

/<initialize>/ {
  :initialize
  /<\/initialize>/! {
    N
    b initialize
  }
  s|</\{0,1\}initialize>||g

  # Convert initializations to sends of initialize
  s|</class-id>| initialize!|g
  s/<class-id>//g
  b entities
}

# Convert entities
:entities
s/<[^>]*>//g
s/&lt;/</g
s/&gt;/>/g
s/&amp;/\&/g

# Convert to four-character tabs and re-tabify
:tabs
s/\(\n\)	/\1    /g
s/\(\n	*\)        /\1	/g
t tabs