4
|
1 |
"{ Package: 'stx:goodies/petitparser' }"
|
0
|
2 |
|
|
3 |
Object subclass:#PPCharSetPredicate
|
|
4 |
instanceVariableNames:'block classification'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'PetitParser-Tools'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
|
11 |
!PPCharSetPredicate class methodsFor:'instance creation'!
|
|
12 |
|
|
13 |
on: aBlock
|
|
14 |
^ self basicNew initializeOn: aBlock
|
|
15 |
! !
|
|
16 |
|
|
17 |
!PPCharSetPredicate methodsFor:'evaluating'!
|
|
18 |
|
|
19 |
value: aCharacter
|
|
20 |
| index |
|
|
21 |
index := aCharacter asInteger.
|
|
22 |
index == 0
|
|
23 |
ifTrue: [ ^ block value: aCharacter ].
|
|
24 |
index > 255
|
|
25 |
ifTrue: [ ^ block value: aCharacter ].
|
|
26 |
^ classification at: index
|
|
27 |
! !
|
|
28 |
|
|
29 |
!PPCharSetPredicate methodsFor:'initialization'!
|
|
30 |
|
|
31 |
initializeOn: aBlock
|
|
32 |
block := aBlock.
|
|
33 |
classification := Array new: 255.
|
|
34 |
1 to: classification size do: [ :index |
|
|
35 |
classification at: index put: (block
|
|
36 |
value: (Character value: index)) ]
|
|
37 |
! !
|
|
38 |
|
|
39 |
!PPCharSetPredicate class methodsFor:'documentation'!
|
|
40 |
|
|
41 |
version_SVN
|
4
|
42 |
^ '$Id: PPCharSetPredicate.st,v 1.2 2012-01-13 11:22:50 cg Exp $'
|
0
|
43 |
! !
|