MiniDocs/src/PetitMarkdown/PPPreceedsParser.class.st

36 lines
679 B
Smalltalk

Class {
#name : #PPPreceedsParser,
#superclass : #PPDelegateParser,
#instVars : [
'length'
],
#category : #'PetitMarkdown-Parser'
}
{ #category : #accessing }
PPPreceedsParser >> length [
^ length
]
{ #category : #accessing }
PPPreceedsParser >> length: anObject [
length := anObject
]
{ #category : #'as yet unclassified' }
PPPreceedsParser >> parseOn: aPPContext [
| memento result |
(aPPContext position < length) ifTrue: [
^ PPFailure message: 'not enough space to preceed' context: aPPContext
].
memento := aPPContext position.
aPPContext skip: length negated.
result := parser parseOn: aPPContext.
aPPContext position: memento.
^ result
]