The Inbox: Tools-nice.725.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Tools-nice.725.mcz

commits-2
Nicolas Cellier uploaded a new version of Tools to project The Inbox:
http://source.squeak.org/inbox/Tools-nice.725.mcz

==================== Summary ====================

Name: Tools-nice.725
Author: nice
Time: 4 September 2016, 9:31:23.175175 pm
UUID: 7009e733-b45e-403a-9469-6106ad6f747a
Ancestors: Tools-tfel.724

Recognize Cuis #classDefinition: when scanning a cuis change file.

=============== Diff against Tools-tfel.724 ===============

Item was changed:
  ----- Method: ChangeList>>scanCategory (in category 'scanning') -----
  scanCategory  
  "Scan anything that involves more than one chunk; method name is historical only"
 
+ | itemPosition item tokens stamp anIndex class meta |
- | itemPosition item tokens stamp anIndex |
  itemPosition := file position.
  item := file nextChunk.
 
  ((item includesSubstring: 'commentStamp:')
  or: [(item includesSubstring: 'methodsFor:')
+ or: [(item includesSubstring: 'classDefinition:')
+ or: [item endsWith: 'reorganize']]]) ifFalse:
- or: [item endsWith: 'reorganize']]) ifFalse:
  ["Maybe a preamble, but not one we recognize; bail out with the preamble trick"
  ^ self addItem: (ChangeRecord new file: file position: itemPosition type: #preamble)
  text: ('preamble: ' , item contractTo: 50)].
 
  tokens := Scanner new scanTokens: item.
  tokens size >= 3 ifTrue:
  [stamp := ''.
  anIndex := tokens indexOf: #stamp: ifAbsent: [nil].
  anIndex ifNotNil: [stamp := tokens at: (anIndex + 1)].
 
  tokens second == #methodsFor:
  ifTrue: [^ self scanCategory: tokens third class: tokens first
  meta: false stamp: stamp].
  tokens third == #methodsFor:
  ifTrue: [^ self scanCategory: tokens fourth class: tokens first
  meta: true stamp: stamp]].
 
  tokens second == #commentStamp:
  ifTrue:
  [stamp := tokens third.
  self addItem:
  (ChangeRecord new file: file position: file position type: #classComment
  class: tokens first category: nil meta: false stamp: stamp)
  text: 'class comment for ' , tokens first,
   (stamp isEmpty ifTrue: [''] ifFalse: ['; ' , stamp]).
  file nextChunk.
  ^ file skipStyleChunk].
+
+ tokens first == #classDefinition:
+ ifTrue:
+ [class := tokens second.
+ meta := tokens size >= 3 and: [tokens third = 'class'].
+ stamp := ''.
+ self addItem:
+ (ChangeRecord new file: file position: file position type: #classDefinition
+ class: class category: nil meta: meta stamp: stamp)
+ text: 'class definition for ' , class,
+  (stamp isEmpty ifTrue: [''] ifFalse: ['; ' , stamp]).
+ file nextChunk.
+ ^ file skipStyleChunk].
 
  self assert: tokens last == #reorganize.
  self addItem:
  (ChangeRecord new
  file: file position: file position type: #reorganize
  class: tokens first category: nil meta: false stamp: stamp)
  text: 'organization for ' , tokens first, (tokens second == #class ifTrue: [' class'] ifFalse: ['']).
  file nextChunk!