4
|
1 |
"{ Package: 'stx:goodies/petitparser' }"
|
0
|
2 |
|
|
3 |
PPParser subclass:#PPPluggableParser
|
|
4 |
instanceVariableNames:'block'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'PetitParser-Parsers'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!PPPluggableParser class methodsFor:'instance creation'!
|
|
12 |
|
|
13 |
on: aBlock
|
|
14 |
^ self new initializeOn: aBlock
|
|
15 |
! !
|
|
16 |
|
174
|
17 |
!PPPluggableParser methodsFor:'*petitanalyzer-matching'!
|
|
18 |
|
|
19 |
match: aParser inContext: aDictionary seen: anIdentitySet
|
|
20 |
^ (super match: aParser inContext: aDictionary seen: anIdentitySet) and: [ self block = aParser block ]
|
|
21 |
! !
|
|
22 |
|
0
|
23 |
!PPPluggableParser methodsFor:'accessing'!
|
|
24 |
|
|
25 |
block
|
|
26 |
"Answer the pluggable block."
|
|
27 |
|
|
28 |
^ block
|
|
29 |
! !
|
|
30 |
|
|
31 |
!PPPluggableParser methodsFor:'initialization'!
|
|
32 |
|
|
33 |
initializeOn: aBlock
|
|
34 |
block := aBlock
|
|
35 |
! !
|
|
36 |
|
|
37 |
!PPPluggableParser methodsFor:'parsing'!
|
|
38 |
|
|
39 |
parseOn: aStream
|
|
40 |
| position result |
|
|
41 |
position := aStream position.
|
|
42 |
result := block value: aStream.
|
|
43 |
result isPetitFailure
|
|
44 |
ifTrue: [ aStream position: position ].
|
|
45 |
^ result
|
|
46 |
! !
|
|
47 |
|
|
48 |
!PPPluggableParser class methodsFor:'documentation'!
|
|
49 |
|
55
|
50 |
version
|
174
|
51 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPPluggableParser.st,v 1.4 2014-03-04 14:33:12 cg Exp $'
|
55
|
52 |
!
|
|
53 |
|
|
54 |
version_CVS
|
174
|
55 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPPluggableParser.st,v 1.4 2014-03-04 14:33:12 cg Exp $'
|
55
|
56 |
!
|
|
57 |
|
0
|
58 |
version_SVN
|
174
|
59 |
^ '$Id: PPPluggableParser.st,v 1.4 2014-03-04 14:33:12 cg Exp $'
|
0
|
60 |
! !
|
174
|
61 |
|