From 52fef194c1fb49f4c012651a373b6a2d56a7e5ec Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Thu, 2 May 2024 14:29:57 +0200 Subject: [PATCH] add setter for outptStream add indentSize configuration without modifying default --- src/FAST-Core-Visitor/FASTTExporter.trait.st | 24 +++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/FAST-Core-Visitor/FASTTExporter.trait.st b/src/FAST-Core-Visitor/FASTTExporter.trait.st index 56e0ce8..a6df63e 100644 --- a/src/FAST-Core-Visitor/FASTTExporter.trait.st +++ b/src/FAST-Core-Visitor/FASTTExporter.trait.st @@ -10,7 +10,8 @@ Trait { 'operatorsPrecedence', 'expressionContextOperator', 'outputStream', - 'indentLevel' + 'indentLevel', + 'indentSize' ], #category : #'FAST-Core-Visitor' } @@ -143,6 +144,18 @@ FASTTExporter >> indentLevel [ ^ indentLevel ifNil: [ indentLevel := 0 ] ] +{ #category : #outputting } +FASTTExporter >> indentSize [ + + ^ indentSize ifNil: [ indentSize := 2 ] +] + +{ #category : #accessing } +FASTTExporter >> indentSize: anObject [ + + indentSize := anObject +] + { #category : #outputting } FASTTExporter >> indented: aPrintable [ @@ -226,8 +239,7 @@ FASTTExporter >> outputExpression: aBlock withOperator: operator [ FASTTExporter >> outputIndentPrefix [ "prints indentation spaces" - self spaces: (self indentLevel * 2) - + self spaces: self indentLevel * self indentSize ] { #category : #outputting } @@ -237,6 +249,12 @@ FASTTExporter >> outputStream [ ^outputStream ifNil: [ outputStream := WriteStream on: '' ] ] +{ #category : #outputting } +FASTTExporter >> outputStream: anOutputStream [ + + ^ outputStream := anOutputStream +] + { #category : #precedence } FASTTExporter >> outputTopLevelExpression: aBlock [ "Execute aBlock to output an expression.