Christoph Thiede uploaded a new version of Regex-Core to project The Trunk:
http://source.squeak.org/trunk/Regex-Core-ct.84.mcz
==================== Summary ====================
Name: Regex-Core-ct.84
Author: ct
Time: 12 October 2022, 3:43:39.287412 pm
UUID: 5d80a0f0-0d3e-a84f-92af-0aec4b5512db
Ancestors: Regex-Core-ct.83
Fixes ordering of keyed subexpression ranges.
=============== Diff against Regex-Core-ct.83 ===============
Item was changed:
----- Method: RxMatcher>>keyedSubexpressionRanges: (in category 'accessing') -----
keyedSubexpressionRanges: key
"Answer an array of all match ranges (inclusiveStart -> inclusiveStop) of the subexpression at the given key."
+ ^ ((keyedMarkerPositions at: key) gather: [:pair |
- ^ (keyedMarkerPositions at: key) gather: [:pair |
(markerPositions at: pair first)
with: (markerPositions at: pair second)
+ collect: [:start :stop | start + 1 to: stop]])
+ "Since the same key can be defined for multiple markers, ordering the matches is non-trivial."
+ sort: [:range | range stop] ascending!
- collect: [:start :stop | start + 1 to: stop]]!
Christoph Thiede uploaded a new version of Regex-Core to project The Trunk:
http://source.squeak.org/trunk/Regex-Core-ct.82.mcz
==================== Summary ====================
Name: Regex-Core-ct.82
Author: ct
Time: 12 October 2022, 3:07:26.700412 pm
UUID: 9854ef71-758d-6e44-8761-0fe1f5681198
Ancestors: Regex-Core-ct.81
Minor refactoring: In #syntaxLookaround:, only pass receiver like in other dispatch selectors. Slightly recategorizes RxmLink and RxsNode hierarchy and adds missing abstract #dispatchTo:. Removes unused private initialization selectors from RxsLookaround and RxsMessagePredicate. Renames RxsMessagePredicate>>#negated into #isNegated to avoid confusion with #negated implementation of RxsCharacter et al.
=============== Diff against Regex-Core-ct.81 ===============
Item was added:
+ ----- Method: RxMatchOptimizer>>syntaxLookaround: (in category 'double dispatch') -----
+ syntaxLookaround: lookaroundNode
+ "Do nothing."!
Item was removed:
- ----- Method: RxMatchOptimizer>>syntaxLookaround:forward:positive: (in category 'double dispatch') -----
- syntaxLookaround: lookaroundNode forward: forward positive: positive
- "Do nothing."!
Item was changed:
----- Method: RxMatchOptimizer>>syntaxMessagePredicate: (in category 'double dispatch') -----
syntaxMessagePredicate: messagePredicateNode
+ messagePredicateNode isNegated ifTrue: [
- messagePredicateNode negated ifTrue: [
^self addNonMethodPredicate: messagePredicateNode selector ].
self addMethodPredicate: messagePredicateNode selector!
Item was added:
+ ----- Method: RxMatcher>>syntaxLookaround: (in category 'double dispatch') -----
+ syntaxLookaround: lookaroundNode
+ "Double dispatch from the syntax tree.
+ Special link can handle lookarounds (look ahead and look behind, positive and negative)."
+ | piece |
+ piece := lookaroundNode piece dispatchTo: self.
+ piece terminateWith: RxmTerminator new. "see commment in RxmLookaround>>#terminateWith:"
+ ^ RxmLookaround
+ with: piece
+ forward: lookaroundNode forward
+ positive: lookaroundNode positive!
Item was removed:
- ----- Method: RxMatcher>>syntaxLookaround:forward:positive: (in category 'double dispatch') -----
- syntaxLookaround: lookaroundNode forward: forwardBoolean positive: positiveBoolean
- "Double dispatch from the syntax tree.
- Special link can handle lookarounds (look ahead and look behind, positive and negative)."
- | piece |
- piece := lookaroundNode piece dispatchTo: self.
- piece terminateWith: RxmTerminator new. "see commment in RxmLookaround>>#terminateWith:"
- ^ RxmLookaround with: piece forward: forwardBoolean positive: positiveBoolean!
Item was changed:
----- Method: RxMatcher>>syntaxMessagePredicate: (in category 'double dispatch') -----
syntaxMessagePredicate: messagePredicateNode
"Double dispatch from the syntax tree.
Special link can handle predicates."
+ ^messagePredicateNode isNegated
- ^messagePredicateNode negated
ifTrue: [RxmPredicate new bePerformNot: messagePredicateNode selector]
ifFalse: [RxmPredicate new bePerform: messagePredicateNode selector]!
Item was changed:
+ ----- Method: RxmLink>>printOn: (in category 'printing') -----
- ----- Method: RxmLink>>printOn: (in category 'as yet unclassified') -----
printOn: stream
super printOn: stream.
stream
nextPut: $(;
print: self identityHash;
nextPutAll: ', ';
print: (next ifNotNil: [ next identityHash ]);
nextPut: $)!
Item was changed:
----- Method: RxmLookaround>>terminateWith: (in category 'building') -----
terminateWith: aNode
"Documentation only. The inner lookaround piece is terminated separately during the construction of the receiver. Lookaround links may not receive #terminateWith: if they are located in a loopback branch, but the inner piece does *not* contain a path to the next link of the receiver."
+ ^super terminateWith: aNode!
- super terminateWith: aNode!
Item was changed:
+ ----- Method: RxsBranch>>dispatchTo: (in category 'building') -----
- ----- Method: RxsBranch>>dispatchTo: (in category 'accessing') -----
dispatchTo: aMatcher
"Inform the matcher of the kind of the node, and it
will do whatever it has to."
^aMatcher syntaxBranch: self!
Item was changed:
+ ----- Method: RxsCharSet>>dispatchTo: (in category 'building') -----
- ----- Method: RxsCharSet>>dispatchTo: (in category 'accessing') -----
dispatchTo: aMatcher
"Inform the matcher of the kind of the node, and it
will do whatever it has to."
^aMatcher syntaxCharSet: self!
Item was changed:
+ ----- Method: RxsCharSet>>enumerateTo: (in category 'building') -----
- ----- Method: RxsCharSet>>enumerateTo: (in category 'accessing') -----
enumerateTo: aSet
negated ifTrue: [^ self "Not enumerable"].
^ elements do: [:each | each enumerateTo: aSet]!
Item was changed:
+ ----- Method: RxsCharacter>>dispatchTo: (in category 'building') -----
- ----- Method: RxsCharacter>>dispatchTo: (in category 'accessing') -----
dispatchTo: aMatcher
"Inform the matcher of the kind of the node, and it
will do whatever it has to."
^aMatcher syntaxCharacter: self!
Item was changed:
+ ----- Method: RxsCharacter>>enumerateTo: (in category 'building') -----
- ----- Method: RxsCharacter>>enumerateTo: (in category 'accessing') -----
enumerateTo: aSet
^aSet add: character!
Item was changed:
+ ----- Method: RxsContextCondition>>dispatchTo: (in category 'building') -----
- ----- Method: RxsContextCondition>>dispatchTo: (in category 'accessing') -----
dispatchTo: aBuilder
^aBuilder perform: kind!
Item was removed:
- ----- Method: RxsLookaround>>beLookahead (in category 'initialize-release') -----
- beLookahead
- forward := true!
Item was removed:
- ----- Method: RxsLookaround>>beLookbehind (in category 'initialize-release') -----
- beLookbehind
- forward := false!
Item was removed:
- ----- Method: RxsLookaround>>beNegative (in category 'initialize-release') -----
- beNegative
- positive := false!
Item was removed:
- ----- Method: RxsLookaround>>bePositive (in category 'initialize-release') -----
- bePositive
- positive := true!
Item was changed:
+ ----- Method: RxsLookaround>>dispatchTo: (in category 'building') -----
- ----- Method: RxsLookaround>>dispatchTo: (in category 'accessing') -----
dispatchTo: aBuilder
"Inform the matcher of the kind of the node, and it will do whatever it has to."
+ ^aBuilder syntaxLookaround: self!
- ^aBuilder syntaxLookaround: self forward: self forward positive: self positive!
Item was changed:
----- Method: RxsLookaround>>initialize (in category 'initialize-release') -----
initialize
super initialize.
+ positive := true.!
- self bePositive.!
Item was changed:
+ ----- Method: RxsMessagePredicate>>dispatchTo: (in category 'building') -----
- ----- Method: RxsMessagePredicate>>dispatchTo: (in category 'accessing') -----
dispatchTo: aBuilder
"Inform the matcher of the kind of the node, and it
will do whatever it has to."
^aBuilder syntaxMessagePredicate: self!
Item was removed:
- ----- Method: RxsMessagePredicate>>initializeSelector: (in category 'initialize-release') -----
- initializeSelector: aSelector
- "The selector must be a one-argument message understood by Character."
-
- selector := aSelector!
Item was added:
+ ----- Method: RxsMessagePredicate>>isNegated (in category 'accessing') -----
+ isNegated
+
+ ^negated!
Item was removed:
- ----- Method: RxsMessagePredicate>>negated (in category 'accessing') -----
- negated
-
- ^negated!
Item was added:
+ ----- Method: RxsNode>>dispatchTo: (in category 'building') -----
+ dispatchTo: aMatcher
+ "Inform the matcher of the kind of the node, and it will do whatever it has to."
+
+ ^ self subclassResponsibility!
Item was changed:
+ ----- Method: RxsPiece>>dispatchTo: (in category 'building') -----
- ----- Method: RxsPiece>>dispatchTo: (in category 'accessing') -----
dispatchTo: aMatcher
"Inform the matcher of the kind of the node, and it
will do whatever it has to."
^aMatcher syntaxPiece: self!
Item was changed:
+ ----- Method: RxsPredicate>>dispatchTo: (in category 'building') -----
- ----- Method: RxsPredicate>>dispatchTo: (in category 'accessing') -----
dispatchTo: anObject
^anObject syntaxPredicate: self!
Item was changed:
+ ----- Method: RxsPredicate>>enumerateTo: (in category 'building') -----
- ----- Method: RxsPredicate>>enumerateTo: (in category 'accessing') -----
enumerateTo: aSet
^self "Not enumerable"!
Item was changed:
+ ----- Method: RxsPredicate>>negated (in category 'converting') -----
- ----- Method: RxsPredicate>>negated (in category 'accessing') -----
negated
^self copy negate!
Item was added:
+ ----- Method: RxsRange>>dispatchTo: (in category 'building') -----
+ dispatchTo: aMatcher
+ "To be wrapped into a RxsCharSet first."
+
+ ^self shouldNotImplement!
Item was changed:
+ ----- Method: RxsRange>>enumerateTo: (in category 'building') -----
- ----- Method: RxsRange>>enumerateTo: (in category 'accessing') -----
enumerateTo: aSet
"Add all of the elements I represent to the collection."
first asInteger to: last asInteger do: [ :charCode |
aSet add: charCode asCharacter ].
^self!
Item was changed:
+ ----- Method: RxsRegex>>beNonCapturing (in category 'initialize-release') -----
- ----- Method: RxsRegex>>beNonCapturing (in category 'accessing') -----
beNonCapturing
isCapturing := false.!
Item was changed:
+ ----- Method: RxsRegex>>dispatchTo: (in category 'building') -----
- ----- Method: RxsRegex>>dispatchTo: (in category 'accessing') -----
dispatchTo: aMatcher
"Inform the matcher of the kind of the node, and it
will do whatever it has to."
^aMatcher syntaxRegex: self!
Christoph Thiede uploaded a new version of Regex-Core to project The Trunk:
http://source.squeak.org/trunk/Regex-Core-ct.79.mcz
==================== Summary ====================
Name: Regex-Core-ct.79
Author: ct
Time: 11 October 2022, 3:09:29.215455 pm
UUID: b733e45e-0504-774d-967a-7e4c4bb892cd
Ancestors: Regex-Core-ct.78
Fixes regression in lookarounds with branches. See Regex-Tests-Core-ct.31.
=============== Diff against Regex-Core-ct.78 ===============
Item was changed:
----- Method: RxMatcher>>syntaxRegex: (in category 'double dispatch') -----
syntaxRegex: regexNode
"Double dispatch from the syntax tree.
Regex node is a chain of branches to be tried. Should compile this into a bundle of parallel branches, between two marker nodes."
| startNode endNode alternatives |
+ regexNode isCapturing
+ ifTrue: [
+ startNode := RxmMarker new index: self allocateMarker.
+ endNode := RxmMarker new index: self allocateMarker]
+ ifFalse: [
+ endNode := RxmLink new "A single endNode is required that all branches of the answer must point to for termination."].
- regexNode isCapturing ifFalse: [
- ^ regexNode branch dispatchTo: self].
- startNode := RxmMarker new index: self allocateMarker.
- endNode := RxmMarker new index: self allocateMarker.
-
regexNode key ifNotNil: [:key |
self registerMarkerKey: key from: startNode index to: endNode index].
alternatives := self hookBranchOf: regexNode onto: endNode.
+ startNode ifNil: [^ alternatives].
^ startNode
pointTailTo: alternatives;
yourself!