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 |
|
54
|
41 |
version
|
|
42 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPCharSetPredicate.st,v 1.3 2012-05-04 22:09:50 vrany Exp $'
|
|
43 |
!
|
|
44 |
|
|
45 |
version_CVS
|
|
46 |
^ '$Header: /cvs/stx/stx/goodies/petitparser/PPCharSetPredicate.st,v 1.3 2012-05-04 22:09:50 vrany Exp $'
|
|
47 |
!
|
|
48 |
|
0
|
49 |
version_SVN
|
54
|
50 |
^ '§Id: PPCharSetPredicate.st 4 2010-12-18 17:02:23Z kursjan §'
|
0
|
51 |
! !
|