PPCharSetPredicate.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 03 Oct 2014 02:33:08 +0100
changeset 377 6112a403a52d
parent 54 3e4cde74f2ea
child 427 a7f5e6de19d2
permissions -rw-r--r--
Updated to latest version from Moose repository. Name: PetitParser-JanKurs.250 Author: JanKurs Time: 01-10-2014, 04:44:04 AM UUID: c46eea20-51a0-4deb-8fd5-8cb99810a8b4 Repository: http://smalltalkhub.com/mc/Moose/PetitParser/main Name: PetitTests-JanKurs.60 Author: JanKurs Time: 29-09-2014, 11:48:10 AM UUID: 28fd2e65-c287-4f73-b71e-5b6bb25bebaa Repository: http://smalltalkhub.com/mc/Moose/PetitParser/main

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

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 value: 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 §'
! !