Commit | Line | Data |
---|---|---|
d38ab263 | 1 | SequenceableCollection extend [ |
34aa5ced VS |
2 | asDictionary [ |
3 | | dict assoc | | |
4 | dict := Dictionary new. | |
5 | 1 to: self size by: 2 do: | |
6 | [ :i | dict add: (self at: i) -> (self at: i + 1) ]. | |
7 | ^dict | |
8 | ] | |
9 | ] | |
10 | ||
11 | String extend [ | |
12 | parse [ | |
13 | |text| | |
14 | text := self copyFrom: 2 to: self size - 1. | |
15 | text := text copyReplaceAll: '\"' with: '"'. | |
16 | text := text copyReplaceAll: '\n' with: ' | |
17 | '. | |
18 | text := text copyReplaceAll: '\\' with: '\'. | |
19 | ^text | |
20 | ] | |
21 | ||
22 | repr [ | |
23 | |text| | |
24 | text := self copyReplaceAll: '\' with: '\\'. | |
25 | text := text copyReplaceAll: ' | |
26 | ' with: '\n'. | |
27 | text := text copyReplaceAll: '"' with: '\"'. | |
28 | ^'"', text, '"' | |
29 | ] | |
30 | ] | |
6da164bd VS |
31 | |
32 | BlockClosure extend [ | |
33 | valueWithExit [ | |
34 | ^self value: [ ^nil ] | |
35 | ] | |
65055aa2 VS |
36 | ] |
37 | ||
38 | "NOTE: bugfix version from 3.2.91 for 3.2.4" | |
39 | Namespace current: Kernel [ | |
40 | ||
41 | MatchingRegexResults extend [ | |
42 | at: anIndex [ | |
43 | <category: 'accessing'> | |
44 | | reg text | | |
45 | anIndex = 0 ifTrue: [^self match]. | |
46 | cache isNil ifTrue: [cache := Array new: registers size]. | |
47 | (cache at: anIndex) isNil | |
48 | ifTrue: | |
49 | [reg := registers at: anIndex. | |
50 | text := reg isNil | |
51 | ifTrue: [nil] | |
52 | ifFalse: [ | |
53 | reg isEmpty | |
54 | ifTrue: [''] | |
55 | ifFalse: [self subject copyFrom: reg first to: reg last]]. | |
56 | cache at: anIndex put: text]. | |
57 | ^cache at: anIndex | |
58 | ] | |
59 | ] | |
58e44bbb | 60 | |
6da164bd | 61 | ] |