compiler/TFormatter.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 25 Sep 2015 03:51:15 +0100
changeset 16 17a2d1d9f205
parent 14 fa42d3f1a578
permissions -rw-r--r--
Added standalone Tea compiler - teak It allows for compilation of .tea files from the command line.

"
    Copyright (C) 2015-now Jan Vrany

    This code is not an open-source (yet). You may use this code
    for your own experiments and projects, given that:

    * all modification to the code will be sent to the
      original author for inclusion in future releases
    * this is not used in any commercial software

    This license is provisional and may (will) change in
    a future.
"
"{ Package: 'jv:tea/compiler' }"

"{ NameSpace: Smalltalk }"

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

!TFormatter class methodsFor:'documentation'!

copyright
"
    Copyright (C) 2015-now Jan Vrany

    This code is not an open-source (yet). You may use this code
    for your own experiments and projects, given that:

    * all modification to the code will be sent to the
      original author for inclusion in future releases
    * this is not used in any commercial software

    This license is provisional and may (will) change in
    a future.
"
! !

!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>"
! !