[squeak-dev] The Trunk: Regex-Core-ct.59.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jul 5 08:54:51 UTC 2021


Marcel Taeumel uploaded a new version of Regex-Core to project The Trunk:
http://source.squeak.org/trunk/Regex-Core-ct.59.mcz

==================== Summary ====================

Name: Regex-Core-ct.59
Author: ct
Time: 2 July 2021, 12:26:24.018367 am
UUID: 1a76f4fd-fa36-f44e-81e8-1bdc113bcfa3
Ancestors: Regex-Core-ct.58

Fixes a slip when parsing quantifiers of the form {<min>,}. This was a simple typo.

See Regex-Tests-Core-ct.12 for regression tests.

=============== Diff against Regex-Core-ct.58 ===============

Item was changed:
  ----- Method: RxMatcher>>makeQuantified:min:max: (in category 'private') -----
  makeQuantified: anRxmLink min: min max: max 
  	"Perform recursive poor-man's transformation of the {<min>,<max>} quantifiers."
  	| aMatcher |
  	
  	"<atom>{,<max>}       ==>  (<atom>{1,<max>})?"
  	min = 0 ifTrue: [ 
  		^ self makeOptional: (self makeQuantified: anRxmLink min: 1 max: max) ].
  	
  	"<atom>{<min>,}       ==>  <atom>{<min>-1, <min>-1}<atom>+"
  	max ifNil: [
+ 		^ (self makeQuantified: anRxmLink min: min - 1 max: min - 1) pointTailTo: (self makePlus: anRxmLink copyChain) ].
- 		^ (self makeQuantified: anRxmLink min: 1 max: min-1) pointTailTo: (self makePlus: anRxmLink copyChain) ].
  	
  	"<atom>{<max>,<max>}  ==>  <atom><atom> ... <atom>"
  	min = max 
  		ifTrue: [ 
  			aMatcher := anRxmLink copyChain.
  			(min-1) timesRepeat: [ aMatcher pointTailTo: anRxmLink copyChain ].
  			^ aMatcher ].
  
  	"<atom>{<min>,<max>}  ==>  <atom>{<min>,<min>}(<atom>{1,<max>-1})?"
  	aMatcher := self makeOptional: anRxmLink copyChain.
  	(max - min - 1) timesRepeat: [ 
  		 aMatcher := self makeOptional: (anRxmLink copyChain pointTailTo: aMatcher) ].
  	^ (self makeQuantified: anRxmLink min: min max: min) pointTailTo: aMatcher!



More information about the Squeak-dev mailing list