Skip to content

Commit

Permalink
use integers instead of symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
vonbecmann committed Nov 8, 2023
1 parent 9640768 commit 8feda93
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions repository/EarleyParser-Core/JEDepthFirstVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ Class {

{ #category : #visiting }
JEDepthFirstVisitor >> visitNode: aPackedOrFamilyNode [
" status: notvisited -> visited -> done"
" status: notvisited(0) -> visited(1) -> done(2)"

| visitStack visited |
visitStack := SinglyLinkedStack with: aPackedOrFamilyNode.
visited := IdentityDictionary new.
[ visitStack isEmpty ]
whileFalse: [ | element status |
element := visitStack top.
status := visited at: element ifAbsent: #notvisited.
status == #notvisited
status := visited at: element ifAbsent: 0.
status == 0
ifTrue: [
visited at: element put: #visited.
visited at: element put: 1.
element acceptPreOrderVisitor: self.
element children reverseDo: [ :child | visitStack push: child ] ]
ifFalse: [
status == #visited
status == 1
ifTrue: [
visitStack pop.
element acceptPostOrderVisitor: self.
visited at: element put: #done ]
visited at: element put: 2 ]
ifFalse: [
status == #done
status == 2
ifTrue: [ visitStack pop ] ] ] ]
]

0 comments on commit 8feda93

Please sign in to comment.