Cface__CNodeVisitor.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 06 Jul 2015 07:18:24 +0100
changeset 36 4e586238a9f7
parent 32 d7464405cbda
child 40 7d1e77b6115e
permissions -rw-r--r--
Fix in class generator (MethofDefinitionChange>>classVariableNames: now takes collection, not string)

"{ Package: 'jv:cface' }"

"{ NameSpace: Cface }"

Object subclass:#CNodeVisitor
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Cface-Visitors'
!


!CNodeVisitor class methodsFor:'instance creation'!

new
    ^ self basicNew initialize.

    "Created: / 12-02-2008 / 22:55:07 / janfrog"
! !

!CNodeVisitor class methodsFor:'processing'!

process: aCNode

    ^self new process: aCNode

    "Created: / 12-02-2008 / 23:49:23 / janfrog"
! !

!CNodeVisitor methodsFor:'initialization'!

initialize
    "Invoked when a new instance is created."

    "/ please change as required (and remove this comment)

    "/ super initialize.   -- commented since inherited method does nothing

    "Created: / 12-02-2008 / 22:55:07 / janfrog"
! !

!CNodeVisitor methodsFor:'processing'!

process: aCNode

    self visit: aCNode

    "Created: / 12-02-2008 / 23:46:49 / janfrog"
! !

!CNodeVisitor methodsFor:'visiting'!

visit: aCNode


    ^aCNode acceptVisitor: self

    "Created: / 08-02-2008 / 09:06:17 / janfrog"
    "Modified: / 09-07-2008 / 20:50:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

visitCArgumentNode:anObject 

    ^self visit: anObject type

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCArrayNode:anObject 

    ^self visit: anObject type

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCCharNode:anObject

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCConstNode:anObject 

    self visit: anObject type

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCDefinitionFileNode:anObject 

    anObject definitions do:
        [:definition|self visit: definition]

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCDoubleNode:anObject

    "Modified: / 12-02-2008 / 23:04:50 / janfrog"
!

visitCEnumNode:anObject 

    anObject values do:
        [:enumValue|self visit: enumValue]

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCEnumValueNode:anObject

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCFloatNode:anObject

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCFunctionNode:anObject 

    anObject arguments do:
        [:argumentNode|self visit: argumentNode].
    self visit: anObject return

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCFunctionTypeNode:anObject 

    anObject arguments do:
        [:argumentNode|self visit: argumentNode].
    self visit: anObject return

    "Created: / 17-02-2008 / 18:44:19 / janfrog"
!

visitCIntNode:anObject

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCLongNode:anObject 

    self visit: anObject type

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCNoNode: node

    "nothing to do"

    "Created: / 04-07-2008 / 09:13:03 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

visitCPointerNode:anObject 

    self visit: anObject type

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCShortNode:anObject

    "Created: / 12-02-2008 / 23:19:46 / janfrog"
!

visitCStructFieldNode:anObject 

    self visit: anObject type

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCStructNode:anObject 

    thisContext isRecursive ifTrue:[^self].

    anObject fields do:
        [:fieldNode|self visit: fieldNode]

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
    "Modified: / 04-07-2008 / 12:42:10 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

visitCTypedefNode:anObject 

    self visit: anObject type

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCUnionNode:anObject 

    anObject fields do:
        [:fieldNode|self visit: fieldNode]

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCUnknownTypeNode:anObject

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCUnsignedNode:anObject 

    self visit: anObject type

    "Created: / 12-02-2008 / 23:00:26 / janfrog"
!

visitCUserDefinedTypeNode:anObject

    "Created: / 12-02-2008 / 23:00:03 / janfrog"
!

visitCVoidNode:anObject

    "Created: / 12-02-2008 / 22:14:55 / janfrog"
!

visitCWCharNode:anObject

    "Created: / 04-07-2008 / 12:37:52 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

visitObject:anObject 
    "dispatched back from the visited objects (visitor pattern)"

    "general fallBack - please change as required"

    self halt:'not yet implemented'

    "Created: / 12-02-2008 / 23:19:46 / janfrog"
! !

!CNodeVisitor class methodsFor:'documentation'!

version
    ^ '$Id$'
!

version_SVN
    ^ '$Id$'
! !