From a6e97041d4f8a4beed5a26e54ef218815f79792a Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Tue, 10 Nov 2026 18:00:05 +0100 Subject: [PATCH 1/2] Allow to use the agnostic importer --- .../FASTPythonImporterTest.class.st | 17 +++++++++++++++++ .../FASTPythonImporter.class.st | 7 +++++++ 2 files changed, 24 insertions(+) diff --git a/src/FAST-Python-Tools-Tests/FASTPythonImporterTest.class.st b/src/FAST-Python-Tools-Tests/FASTPythonImporterTest.class.st index 4a3f5a3..c6e0455 100644 --- a/src/FAST-Python-Tools-Tests/FASTPythonImporterTest.class.st +++ b/src/FAST-Python-Tools-Tests/FASTPythonImporterTest.class.st @@ -27387,6 +27387,13 @@ FASTPythonImporterTest >> testGlobalStatementMultiple [ self assert: self topEntity name equals: 'z' ] +{ #category : 'tests - importer API' } +FASTPythonImporterTest >> testHandlesPythonFiles [ + + self assert: (FASTPythonImporter handlesFile: '/folder/module.py' asFileReference). + self deny: (FASTPythonImporter handlesFile: '/folder/module.pyc' asFileReference) +] + { #category : 'tests - advanced statements' } FASTPythonImporterTest >> testIf [ @@ -40855,6 +40862,16 @@ FASTPythonImporterTest >> testParameter [ self assert: (self topEntity isOfType: FASTPyPassStatement) ] +{ #category : 'tests - model reuse' } +FASTPythonImporterTest >> testParseIntoAnExistingModelAddsTheNewSourceToIt [ + + | model | + model := self importer parse: 'x = 1'. + self assert: (self importer parse: 'y = 2' into: model) identicalTo: model. + self assert: (model allWithType: FASTPyModule) size equals: 2. + self assert: (model allWithType: FASTPyAssignment) size equals: 2 +] + { #category : 'tests - statements' } FASTPythonImporterTest >> testPassStatement [ diff --git a/src/FAST-Python-Tools/FASTPythonImporter.class.st b/src/FAST-Python-Tools/FASTPythonImporter.class.st index a27c2cd..41ab401 100644 --- a/src/FAST-Python-Tools/FASTPythonImporter.class.st +++ b/src/FAST-Python-Tools/FASTPythonImporter.class.st @@ -106,6 +106,13 @@ FASTPythonImporter class >> devParseFiles: aCollection [ result inspect ] +{ #category : 'accessing' } +FASTPythonImporter class >> extensions [ + "File extensions without the dot that the importer handles" + + ^ #( 'py' ) +] + { #category : 'parsing' } FASTPythonImporter class >> parseAndResolve: aString [ From ac6c8c74e0c7da53ad446ef9e5fcb69d01cc69e9 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Mon, 16 Nov 2026 18:46:33 +0100 Subject: [PATCH 2/2] Bump TreeSitter to v3.3.1 --- src/BaselineOfFASTPython/BaselineOfFASTPython.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BaselineOfFASTPython/BaselineOfFASTPython.class.st b/src/BaselineOfFASTPython/BaselineOfFASTPython.class.st index 8dcd56c..2c259c4 100644 --- a/src/BaselineOfFASTPython/BaselineOfFASTPython.class.st +++ b/src/BaselineOfFASTPython/BaselineOfFASTPython.class.st @@ -63,6 +63,6 @@ BaselineOfFASTPython >> treeSitter: spec [ spec baseline: 'TreeSitter' with: [ spec - repository: 'github://Evref-BL/Pharo-Tree-Sitter:v.2.1.2/src'; + repository: 'github://Evref-BL/Pharo-Tree-Sitter:v3.3.1/src'; loads: #( 'moose' 'python' ) ] ]