22 lines
479 B
Smalltalk
22 lines
479 B
Smalltalk
|
Extension { #name : 'PPPossessiveRepeatingParser' }
|
||
|
|
||
|
{ #category : '*petitcompiler' }
|
||
|
PPPossessiveRepeatingParser >> asCompilerNode [
|
||
|
((self min = 0) and: [ self max = SmallInteger maxVal ]) ifTrue: [
|
||
|
^ PPCStarNode new
|
||
|
name: self name;
|
||
|
child: parser;
|
||
|
parser: self;
|
||
|
yourself
|
||
|
].
|
||
|
|
||
|
((self min = 1) and: [ self max = SmallInteger maxVal ]) ifTrue: [
|
||
|
^ PPCPlusNode new
|
||
|
name: self name;
|
||
|
child: parser;
|
||
|
parser: self;
|
||
|
yourself
|
||
|
].
|
||
|
^ super asCompilerNode
|
||
|
]
|