equal
deleted
inserted
replaced
|
1 "{ Package: 'squeak:petitparser' }" |
|
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: |
|
12 block <BlockClosure> The action block to be executed. |
|
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 |
|
49 ^ '$Id: PPActionParser.st,v 1.1 2011-08-18 18:56:17 cg Exp $' |
|
50 ! ! |