equal
deleted
inserted
replaced
|
1 "{ Package: 'stx:goodies/petitparser/islands' }" |
|
2 |
|
3 PPDelegateParser subclass:#PPNonEmptyParser |
|
4 instanceVariableNames:'' |
|
5 classVariableNames:'' |
|
6 poolDictionaries:'' |
|
7 category:'PetitIslands-Parsers' |
|
8 ! |
|
9 |
|
10 PPNonEmptyParser comment:'I return failure, if the delegate parser did not consumed any input.' |
|
11 ! |
|
12 |
|
13 !PPNonEmptyParser methodsFor:'parsing'! |
|
14 |
|
15 parseOn: aPPContext |
|
16 | position result | |
|
17 position := aPPContext position. |
|
18 result := parser parseOn: aPPContext. |
|
19 |
|
20 |
|
21 (((position == aPPContext position) and: [ aPPContext atEnd not ]) and: [ result isPetitFailure not ]) ifTrue: [ |
|
22 ^ PPFailure message: 'Epsilon parse not allowed' context: aPPContext at: position |
|
23 ]. |
|
24 ^ result |
|
25 ! ! |
|
26 |