4
|
1 |
"{ Package: 'stx:goodies/petitparser' }"
|
0
|
2 |
|
|
3 |
PPDelegateParser subclass:#PPActionParser
|
|
4 |
instanceVariableNames:'block'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'PetitParser-Parsers'
|
|
8 |
!
|
|
9 |
|
|
10 |
PPActionParser comment:'A parser that performs an action block with the successful parse result of the delegate.
|
|
11 |
Instance Variables:
|
4
|
12 |
block <BlockClosure> The action block to be executed.
|
0
|
13 |
'
|
|
14 |
!
|
|
15 |
|
|
16 |
|
|
17 |
!PPActionParser class methodsFor:'instance creation'!
|
|
18 |
|
|
19 |
on: aParser block: aBlock
|
|
20 |
^ (self on: aParser) setBlock: aBlock
|
|
21 |
! !
|
|
22 |
|
|
23 |
!PPActionParser methodsFor:'accessing'!
|
|
24 |
|
|
25 |
block
|
|
26 |
"Answer the action block of the receiver."
|
|
27 |
|
|
28 |
^ block
|
|
29 |
! !
|
|
30 |
|
|
31 |
!PPActionParser methodsFor:'initialization'!
|
|
32 |
|
|
33 |
setBlock: aBlock
|
|
34 |
block := aBlock
|
|
35 |
! !
|
|
36 |
|
|
37 |
!PPActionParser methodsFor:'parsing'!
|
|
38 |
|
|
39 |
parseOn: aStream
|
|
40 |
| element |
|
|
41 |
^ (element := parser parseOn: aStream) isPetitFailure
|
|
42 |
ifFalse: [ block value: element ]
|
|
43 |
ifTrue: [ element ]
|
|
44 |
! !
|
|
45 |
|
|
46 |
!PPActionParser class methodsFor:'documentation'!
|
|
47 |
|
|
48 |
version_SVN
|
4
|
49 |
^ '$Id: PPActionParser.st,v 1.2 2012-01-13 11:22:50 cg Exp $'
|
0
|
50 |
! !
|