"{ Package: 'stx:goodies/petitparser/compiler' }"
"{ NameSpace: Smalltalk }"
PPCStarNode subclass:#PPCStarCharSetPredicateNode
instanceVariableNames:'predicate'
classVariableNames:''
poolDictionaries:''
category:'PetitCompiler-Nodes'
!
!PPCStarCharSetPredicateNode methodsFor:'accessing'!
compileWith: compiler effect: effect id: id
| classification classificationId |
compiler startMethod: id.
classification := self extendClassification: predicate classification.
classificationId := compiler idFor: classification prefixed: #classification.
compiler addConstant: classification as: classificationId.
compiler addVariable: 'retval'.
compiler add: 'retval := OrderedCollection new.'.
compiler add: '[ ', classificationId, ' at: context peek asInteger ] whileTrue: ['.
compiler indent.
compiler add: ' retval add: context next.'.
compiler dedent.
compiler add: '].'.
compiler add: '^ retval asArray'.
^ compiler stopMethod.
!
extendClassification: classification
^ (classification asOrderedCollection addLast: false; yourself) asArray
!
firstCharSet
^ PPCharSetPredicate on: predicate
!
predicate
^ predicate
!
predicate: anObject
predicate := anObject
!
prefix
^ #starPredicate
!
rewrite: changeStatus
"Nothing TODO"
! !
!PPCStarCharSetPredicateNode methodsFor:'comparing'!
= anotherNode
super = anotherNode ifFalse: [ ^ false ].
^ predicate = anotherNode predicate.
!
hash
^ super hash bitXor: predicate hash
! !