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

commits at source.squeak.org commits at source.squeak.org
Wed Oct 5 18:06:12 UTC 2022


Christoph Thiede uploaded a new version of Regex-Core to project The Trunk:
http://source.squeak.org/trunk/Regex-Core-ct.65.mcz

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

Name: Regex-Core-ct.65
Author: ct
Time: 23 August 2021, 7:01:07.590768 pm
UUID: b4864ec6-fa4b-5e4c-8e42-8bab59cdb77b
Ancestors: Regex-Core-mt.61

Fixes a parser bug when encountering a brace quantifier after another quantifier. Regression tests are in #testQuantifierSequence, Regex-Tests-Core-ct.21.

=============== Diff against Regex-Core-mt.61 ===============

Item was changed:
  ----- Method: RxParser>>atom (in category 'recursive descent') -----
  atom
  	"An atom is one of a lot of possibilities, see below."
  
  	| atom |
  	(lookahead == nil 
  	or: [ lookahead == $| 
  	or: [ lookahead == $)
  	or: [ lookahead == $*
  	or: [ lookahead == $+ 
+ 	or: [ lookahead == $? ]
+ 	or: [ lookahead == ${ ]]]]])
- 	or: [ lookahead == $? ]]]]])
  		ifTrue: [ ^RxsEpsilon new ].
  		
  	lookahead == $( 
  		ifTrue: [
  			"<atom> ::= '(' <regex> ')' "
  			self match: $(.
  			atom := self regex.
  			self match: $).
  			^atom ].
  	
  	lookahead == $[
  		ifTrue: [
  			"<atom> ::= '[' <characterSet> ']' "
  			self match: $[.
  			atom := self characterSet.
  			self match: $].
  			^atom ].
  	
  	lookahead == $: 
  		ifTrue: [
  			"<atom> ::= ':' <messagePredicate> ':' "
  			self match: $:.
  			atom := self messagePredicate.
  			self match: $:.
  			^atom ].
  	
  	lookahead == $. 
  		ifTrue: [
  			"any non-whitespace character"
  			self next.
  			^RxsContextCondition new beAny].
  	
  	lookahead == $^ 
  		ifTrue: [
  			"beginning of line condition"
  			self next.
  			^RxsContextCondition new beBeginningOfLine].
  	
  	lookahead == $$ 
  		ifTrue: [
  			"end of line condition"
  			self next.
  			^RxsContextCondition new beEndOfLine].
  		
  	lookahead == $\ 
  		ifTrue: [
  			"<atom> ::= '\' <character>"
  			self next ifNil: [ self signalParseError: 'bad quotation' ].
  			(BackslashConstants includesKey: lookahead) ifTrue: [
  				atom := RxsCharacter with: (BackslashConstants at: lookahead).
  				self next.
+ 				^ atom].
+ 			self
+ 				ifSpecial: lookahead
+ 				then: [:node | self next. ^ node]].
- 				^atom].
- 			self ifSpecial: lookahead
- 				then: [:node | self next. ^node]].
  		
  	"If passed through the above, the following is a regular character."
  	atom := RxsCharacter with: lookahead.
  	self next.
  	^atom!



More information about the Squeak-dev mailing list