compiler/TFormatter.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 22 Sep 2015 17:43:38 +0100
changeset 14 fa42d3f1a578
parent 9 569bf5707c7e
child 16 17a2d1d9f205
permissions -rw-r--r--
Removed syntax for inline assembly, use <primitive: [:asm | ... ]> syntax. This one is easier to implement and less introusive, syntax-wise. And follows Smalltalk tradiiton.

"{ Package: 'jv:tea/compiler' }"

"{ NameSpace: Smalltalk }"

RBFormatter subclass:#TFormatter
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Languages-Tea-Compiler-AST'
!

!TFormatter methodsFor:'visitor-double dispatching'!

acceptSimpleTypeNode: aTSimpleTypeNode
    codeStream nextPutAll: aTSimpleTypeNode name

    "Created: / 21-08-2015 / 22:20:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

acceptSpecialFormNode: aTSpecialFormNode
    self acceptMessageNode: aTSpecialFormNode

    "Created: / 14-09-2015 / 12:10:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

acceptTypeSpecNode: aTTypeSpecNode
    aTTypeSpecNode type notNil ifTrue:[ 
        codeStream nextPut:$<; space.
        self visitNode: aTTypeSpecNode type.
        codeStream space; nextPut:$>.
    ]

    "Created: / 21-08-2015 / 22:18:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 01-09-2015 / 19:08:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

acceptUnionTypeNode: aTUnionTypeNode
    aTUnionTypeNode types do:[:type | 
        self visitNode: type
    ] separatedBy:[ 
        codeStream space; nextPut: $|; space
    ].

    "Created: / 21-08-2015 / 22:21:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !