Action inlining [1/x]: Initial support for inlining actions parsers (i.e., ==>)
The code of the action is now inlined into parsing method rather then delegated to
stored block. Mapping parser (i.e., map:[...]) are not supported and not detected, so
using them cause crash. This will be fixed later.
"{ Package: 'stx:goodies/petitparser/islands' }"
"{ NameSpace: Smalltalk }"
PPDelegateParser subclass:#PPNonEmptyParser
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'PetitIslands-Parsers'
!
PPNonEmptyParser comment:'I return failure, if the delegate parser did not consumed any input.'
!
!PPNonEmptyParser methodsFor:'parsing'!
parseOn: aPPContext
| position result |
position := aPPContext position.
result := parser parseOn: aPPContext.
(((position == aPPContext position) and: [ aPPContext atEnd not ]) and: [ result isPetitFailure not ]) ifTrue: [
^ PPFailure message: 'Epsilon parse not allowed' context: aPPContext at: position
].
^ result
! !