Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 13 additions & 23 deletions src/FamixReplication-Smalltalk/FamixRepSmalltalkCleaner.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ I am a cleaner to clean smalltalk method code for replication detection
"
Class {
#name : 'FamixRepSmalltalkCleaner',
#superclass : 'FamixRepSourcesCleaner',
#superclass : 'FamixRepPairedCommentsCleaner',
#category : 'FamixReplication-Smalltalk',
#package : 'FamixReplication-Smalltalk'
}
Expand All @@ -22,28 +22,6 @@ FamixRepSmalltalkCleaner >> cleanLine: aText [
^ (super cleanLine: aText) copyWithRegex: '\".*\"' matchesReplacedWith: ''
]

{ #category : 'actions' }
FamixRepSmalltalkCleaner >> cleanMultilineComments: aText [
"removes all comments possibly spanning several lines without changing the number of lines
(a multi line comment becomes a set of empty lines)"

| current commentStart commentEnd |
current := 1.
^ String streamContents: [ :stream |
[
commentStart := aText indexOf: $" startingAt: current.
commentEnd := aText indexOf: $" startingAt: commentStart + 1.
(commentStart > 0) and: [ commentEnd > 0 ]
] whileTrue: [
self copy: aText from: current to: commentStart - 1 into: stream.
current := commentStart + 1.
self copyAsEmptyLines: aText from: current to: commentEnd - 1 into: stream.
current := commentEnd + 1
].
self copy: aText from: current toEndInto: stream
]
]

{ #category : 'actions' }
FamixRepSmalltalkCleaner >> isComment: aLine [
"we could have defined comment as
Expand All @@ -52,3 +30,15 @@ FamixRepSmalltalkCleaner >> isComment: aLine [

^ false
]

{ #category : 'actions' }
FamixRepSmalltalkCleaner >> multilineCommentCloser [

^ '"'
]

{ #category : 'actions' }
FamixRepSmalltalkCleaner >> multilineCommentOpener [

^ '"'
]