168
|
1 |
"{ Package: 'stx:goodies/petitparser' }"
|
|
2 |
|
|
3 |
PPRepeatingParser subclass:#PPLimitedRepeatingParser
|
|
4 |
instanceVariableNames:'limit'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'PetitParser-Parsers'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!PPLimitedRepeatingParser class methodsFor:'instance creation'!
|
|
12 |
|
|
13 |
on: aParser limit: aLimitParser
|
|
14 |
^ (self on: aParser) setLimit: aLimitParser
|
|
15 |
! !
|
|
16 |
|
|
17 |
!PPLimitedRepeatingParser methodsFor:'accessing'!
|
|
18 |
|
|
19 |
children
|
|
20 |
^ Array with: parser with: limit
|
|
21 |
!
|
|
22 |
|
|
23 |
limit
|
|
24 |
"Answer the parser that limits (or ends) this repetition."
|
|
25 |
|
|
26 |
^ limit
|
|
27 |
! !
|
|
28 |
|
|
29 |
!PPLimitedRepeatingParser methodsFor:'initialization'!
|
|
30 |
|
|
31 |
setLimit: aParser
|
|
32 |
limit := aParser
|
|
33 |
! !
|
|
34 |
|
|
35 |
!PPLimitedRepeatingParser methodsFor:'private'!
|
|
36 |
|
|
37 |
matchesLimitOn: aStream
|
|
38 |
| element position |
|
|
39 |
position := aStream position.
|
|
40 |
element := limit parseOn: aStream.
|
|
41 |
aStream position: position.
|
|
42 |
^ element isPetitFailure not
|
|
43 |
! !
|
|
44 |
|
|
45 |
!PPLimitedRepeatingParser class methodsFor:'documentation'!
|
|
46 |
|
|
47 |
version
|
|
48 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPLimitedRepeatingParser.st,v 1.1 2014-03-04 14:32:55 cg Exp $'
|
|
49 |
!
|
|
50 |
|
|
51 |
version_CVS
|
|
52 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPLimitedRepeatingParser.st,v 1.1 2014-03-04 14:32:55 cg Exp $'
|
|
53 |
! !
|
|
54 |
|