34 lines
957 B
Smalltalk
34 lines
957 B
Smalltalk
Extension { #name : 'PPSequenceParser' }
|
|
|
|
{ #category : '*petitcompiler' }
|
|
PPSequenceParser >> asCompilerNode [
|
|
^ PPCSequenceNode new
|
|
children: parsers;
|
|
name: self name;
|
|
properties: properties;
|
|
yourself
|
|
]
|
|
|
|
{ #category : '*petitcompiler' }
|
|
PPSequenceParser >> firstSetSuchThat: block into: aCollection openSet: aSet [
|
|
(aSet includes: self) ifTrue: [ ^ aCollection ].
|
|
aSet add: self.
|
|
|
|
(block value: self) ifTrue: [ aCollection add: self. ^ aCollection ].
|
|
|
|
self children do: [ :child |
|
|
child firstSetSuchThat: block into: aCollection openSet: aSet.
|
|
child acceptsEpsilon ifFalse: [ ^ aCollection ]
|
|
].
|
|
^ aCollection
|
|
]
|
|
|
|
{ #category : '*petitcompiler' }
|
|
PPSequenceParser >> map: aBlock [
|
|
^ aBlock numArgs = self children size
|
|
ifTrue: [ PPMappedActionParser on: self block: aBlock ]
|
|
ifFalse: [ self error: aBlock numArgs asString , ' arguments expected.' ]
|
|
|
|
"Modified: / 02-06-2015 / 17:16:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
]
|