Removed autoload attribut for tests.
As all classes are in a test package, when package is loaded likely tests are required,
so load them right away.
"{ Package: 'stx:goodies/petitparser/compiler' }"
PPCDelegateNode subclass:#PPCNotNode
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'PetitCompiler-Nodes'
!
!PPCNotNode methodsFor:'accessing'!
prefix
^ #not
! !
!PPCNotNode methodsFor:'analysis'!
isFirstSetTerminal
^ false
! !
!PPCNotNode methodsFor:'compiling'!
compileWith: compiler effect: effect id: id
compiler startMethod: id.
compiler addVariable: 'memento'.
compiler add: (compiler smartRemember: child).
compiler startTokenMode.
compiler call: (child compileWith: compiler).
compiler stopTokenMode.
compiler add: (compiler smartRestore: child).
compiler add: '^ error ifFalse: [ self error ] ifTrue: [ self clearError. nil ]'.
^ compiler stopMethod.
! !
!PPCNotNode methodsFor:'optimizing'!
optimize: params
(self rewrite: params) ifTrue: [
^ true.
].
^ super optimize: params.
!
rewrite: changeStatus
(child isKindOf: PPCAbstractLiteralNode) ifTrue: [
changeStatus change.
^ PPCNotLiteralNode new
name: self name;
literal: self child literal;
yourself
].
(child isKindOf: PPCMessagePredicateNode) ifTrue: [
changeStatus change.
^ PPCNotMessagePredicateNode new
name: self name;
message: child message;
yourself
].
(child isKindOf: PPCCharSetPredicateNode) ifTrue: [
changeStatus change.
^ PPCNotCharSetPredicateNode new
name: self name;
predicate: child predicate;
yourself
]
! !