added Interval asParser
e.g. ( to:) asParser parse:'a'
"{ Package: 'stx:goodies/petitparser' }"!
!Block methodsFor:'*petitparser-core-converting'!
asParser
^ PPPluggableParser on: self
! !
!BlockContext methodsFor:'*petitparser-core-converting'!
asParser
^ PPPluggableParser on: self
! !
!Character methodsFor:'arithmetic'!
-converting'
! !
!Character methodsFor:'*petitparser-converting'!
e instance-variables collection, position and readLimit but instead have a completely different internal representation. In these cases just use the super implementation that is inefficient but should work in all cases."
"DUNNO WHY, but on: collection from: position to: last set the start to position -1"
self breakPoint: #petitparser.
^ (collection isNil or: [ position isNil or: [ readLimit isNil ] ])
ifFalse: [ PPStream on: collection from: (position +1) to: readLimit ]
ifTrue: [ super asPetitStream ]
"/ ^ (collection isNil or: [ position isNil or: [ readLimit isNil ] ])
"/ ifFalse: [ PPStream on: collection from: position to: readLimit ]
"/ ifTrue: [ super asPetitStream ]
"Modified: / 18-12-2010 / 17:38:01 / Jan Kurs <kurs.jan@post.cz>"
! !
!Character methodsFor:'arithmetic'!
different internal representation. In these cases just use the super implementation that is inefficient but should work in all cases."
"DUNNO WHY, but on: collection from: position to: last set the start to position -1"
self breakPoint: #petitparser.
^ (collection isNil or: [ position isNil or: [ readLimit isNil ] ])
ifFalse: [ PPStream on: collection from: (position +1) to: readLimit ]
ifTrue: [ super asPetitStream ]
"/ ^ (collection isNil or: [ position isNil or: [ readLimit isNil ] ])
"/ ifFalse: [ PPStream on: collection from: position to: readLimit ]
"/ ifTrue: [ super asPetitStream ]
"Modified: / 18-12-2010 / 17:38:01 / Jan Kurs <kurs.jan@post.cz>"
! !
!Interval methodsFor:'*petitparser-converting'!
asParser
"Create a range of characters between start and stop."
self assert:start isCharacter.
self assert:stop isCharacter.
self assert:step == 1.
^ PPPredicateObjectParser between: start and: stop
"
($a to:$f) asParser parse:'a'
($a to:$f) asParser parse:'g'
"
! !
!Object methodsFor:'*petitparser-core-converting'!
ition isNil or: [ readLimit isNil ] ])
ifFalse: [ PPStream on: collection from: (position +1) to: readLimit ]
ifTrue: [ super asPetitStream ]
"/ ^ (collection isNil or: [ position isNil or: [ readLimit isNil ] ])
"/ ifFalse: [ PPStream on: collection from: position to: readLimit ]
"/ ifTrue: [ super asPetitStream ]
"Modified: / 18-12-2010 / 17:38:01 / Jan Kurs <kurs.jan@post.cz>"
! !
!Object methodsFor:'*petitparser-core-testing'!
adLimit ]
ifTrue: [ super asPetitStream ]
"/ ^ (collection isNil or: [ position isNil or: [ readLimit isNil ] ])
"/ ifFalse: [ PPStream on: collection from: position to: readLimit ]
"/ ifTrue: [ super asPetitStream ]
"Modified: / 18-12-2010 / 17:38:01 / Jan Kurs <kurs.jan@post.cz>"
! !
!Object methodsFor:'*petitparser-core-testing'!
: [ position isNil or: [ readLimit isNil ] ])
"/ ifFalse: [ PPStream on: collection from: position to: readLimit ]
"/ ifTrue: [ super asPetitStream ]
"Modified: / 18-12-2010 / 17:38:01 / Jan Kurs <kurs.jan@post.cz>"
! !
!PositionableStream methodsFor:'*petitparser-core-converting'!
ection from: position to: readLimit ]
"/ ifTrue: [ super asPetitStream ]
"Modified: / 18-12-2010 / 17:38:01 / Jan Kurs <kurs.jan@post.cz>"
! !
!SequenceableCollection methodsFor:'*petitparser-core-converting'!
asParser
^ PPSequenceParser withAll: (self collect: [ :each | each asParser ] as:Array)
! !
!SequenceableCollection methodsFor:'*petitparser-core-converting'!
f
! !
!Set methodsFor:'*petitparser-core-converting'!
arser perform: self
! !
!Stream methodsFor:'*petitparser-core-converting'!
2-2010 / 16:47:22 / Jan Kurs <kurs.jan@post.cz>"
! !
!String methodsFor:'*petitparser-core-converting'!
ream
^ string asPetitStream
! !
!Symbol methodsFor:'*petitparser-core-converting'!
PPEpsilonParser new
! !
!Symbol methodsFor:'Compatibility-Squeak'!
ion_CVS
^ '$Header: /cvs/stx/stx/goodies/petitparser/extensions.st,v 1.7 2014-02-17 14:35:54 cg Exp $'
! !
!Text methodsFor:'*petitparser-core'!
! !
!UndefinedObject methodsFor:'*petitparser-converting'!
! !
!stx_goodies_petitparser class methodsFor:'documentation'!
! !