Skip Java benchmarks on Smalltalk/X
...as Java parser is not yet supported.
"{ Package: 'stx:goodies/petitparser/compiler' }"
"{ NameSpace: Smalltalk }"
PPCDelegateNode subclass:#PPCTokenNode
instanceVariableNames:'tokenClass'
classVariableNames:''
poolDictionaries:''
category:'PetitCompiler-Nodes'
!
!PPCTokenNode methodsFor:'accessing'!
initialize
super initialize.
!
rewrite: changeStatus
| |
super rewrite: changeStatus.
(self allNodes anySatisfy: [ :node | node asFast ~= node ]) ifTrue: [
changeStatus change.
self replace: child with: (child transform: [:node | node asFast]).
]
!
tokenClass
^ tokenClass
!
tokenClass: anObject
tokenClass := anObject
! !
!PPCTokenNode methodsFor:'as yet unclassified'!
compileWith: compiler effect: effect id: id
| |
compiler startMethod: id.
compiler addVariable: 'start'.
compiler addVariable: 'end'.
compiler add: 'start := context position + 1.'.
compiler call: (self child compileWith: compiler).
compiler add: 'error ifTrue: [ ^ self ].'.
compiler add: 'end := context position.'.
compiler add: '^ ', tokenClass asString, ' on: (context collection)
start: start
stop: end
value: nil'.
^ compiler stopMethod.
!
prefix
^ #token
! !
!PPCTokenNode methodsFor:'comparing'!
= anotherNode
super = anotherNode ifFalse: [ ^ false ].
^ tokenClass = anotherNode tokenClass.
!
hash
^ super hash bitXor: tokenClass hash
! !