PPCharSetPredicate.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 13 Apr 2015 22:00:44 +0100
changeset 427 a7f5e6de19d2
parent 54 3e4cde74f2ea
child 642 77d5fddb6462
permissions -rw-r--r--
Merged JK's version from Monticello Name: PetitParser-JanKurs.275 Author: JanKurs Time: 31-03-2015, 05:51:24.398 PM UUID: 9ab3be24-8393-4794-a7e6-e318f3195673 Name: PetitTests-JanKurs.73 Author: JanKurs Time: 21-02-2015, 01:10:13.115 PM UUID: de4f77e3-2d07-476b-855e-69f845edfc7c

"{ Package: 'stx:goodies/petitparser' }"

"{ NameSpace: Smalltalk }"

Object subclass:#PPCharSetPredicate
	instanceVariableNames:'block classification'
	classVariableNames:''
	poolDictionaries:''
	category:'PetitParser-Tools'
!


!PPCharSetPredicate class methodsFor:'instance creation'!

on: aBlock
	^ self basicNew initializeOn: aBlock
! !

!PPCharSetPredicate methodsFor:'evaluating'!

value: aCharacter
	| index |
	index := aCharacter asInteger.
	index == 0
		ifTrue: [ ^ block value: aCharacter ].
	index > 255
		ifTrue: [ ^ block value: aCharacter ].
	^ classification at: index
! !

!PPCharSetPredicate methodsFor:'initialization'!

initializeOn: aBlock
	block := aBlock.
	classification := Array new: 255.
	1 to: classification size do: [ :index |
		classification at: index put: (block
			value: (Character codePoint: index)) ]
! !

!PPCharSetPredicate class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPCharSetPredicate.st,v 1.3 2012-05-04 22:09:50 vrany Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPCharSetPredicate.st,v 1.3 2012-05-04 22:09:50 vrany Exp $'
!

version_SVN
    ^ '§Id: PPCharSetPredicate.st 4 2010-12-18 17:02:23Z kursjan §'
! !