1# -*- python -*-
2#                           Package   : omniidl
3# idlvisitor.py             Created on: 1999/10/27
4#			    Author    : Duncan Grisby (dpg1)
5#
6#    Copyright (C) 1999 AT&T Laboratories Cambridge
7#
8#  This file is part of omniidl.
9#
10#  omniidl is free software; you can redistribute it and/or modify it
11#  under the terms of the GNU General Public License as published by
12#  the Free Software Foundation; either version 2 of the License, or
13#  (at your option) any later version.
14#
15#  This program is distributed in the hope that it will be useful,
16#  but WITHOUT ANY WARRANTY; without even the implied warranty of
17#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18#  General Public License for more details.
19#
20#  You should have received a copy of the GNU General Public License
21#  along with this program.  If not, see http://www.gnu.org/licenses/
22#
23# Description:
24#
25#   Base classes for Visitors
26
27"""Visitor pattern visitors for AST nodes and types
28
29This module declares abstract visitor classes for visiting AST nodes
30and type objects. Python's type system means that you do not actually
31need to derive from these classes to implement visitors. This module
32only really exists to show what functions should exist in visitors.
33
34Classes:
35
36  AstVisitor  -- visitor for classes in idlast.py
37  TypeVisitor -- visitor for classes in idltype.py"""
38
39class AstVisitor :
40    """Visitor for AST nodes
41
42Functions:
43
44  visitAST(node)
45  visitModule(node)
46  visitInterface(node)
47  visitForward(node)
48  visitConst(node)
49  visitDeclarator(node)
50  visitTypedef(node)
51  visitMember(node)
52  visitStruct(node)
53  visitStructForward(node)
54  visitException(node)
55  visitCaseLabel(node)
56  visitUnionCase(node)
57  visitUnion(node)
58  visitUnionForward(node)
59  visitEnumerator(node)
60  visitEnum(node)
61  visitAttribute(node)
62  visitParameter(node)
63  visitOperation(node)
64  visitNative(node)
65  visitStateMember(node)
66  visitFactory(node)
67  visitValueForward(node)
68  visitValueBox(node)
69  visitValueAbs(node)
70  visitValue(node)"""
71
72    def visitAST(self, node):           return
73    def visitModule(self, node):        return
74    def visitInterface(self, node):     return
75    def visitForward(self, node):       return
76    def visitConst(self, node):         return
77    def visitDeclarator(self, node):    return
78    def visitTypedef(self, node):       return
79    def visitMember(self, node):        return
80    def visitStruct(self, node):        return
81    def visitStructForward(self, node): return
82    def visitException(self, node):     return
83    def visitCaseLabel(self, node):     return
84    def visitUnionCase(self, node):     return
85    def visitUnion(self, node):         return
86    def visitUnionForward(self, node):  return
87    def visitEnumerator(self, node):    return
88    def visitEnum(self, node):          return
89    def visitAttribute(self, node):     return
90    def visitParameter(self, node):     return
91    def visitOperation(self, node):     return
92    def visitNative(self, node):        return
93    def visitStateMember(self, node):   return
94    def visitFactory(self, node):       return
95    def visitValueForward(self, node):  return
96    def visitValueBox(self, node):      return
97    def visitValueAbs(self, node):      return
98    def visitValue(self, node):         return
99
100
101class TypeVisitor:
102    """Visitor for Type objects
103
104Functions:
105
106  visitBaseType(type)
107  visitStringType(type)
108  visitWStringType(type)
109  visitSequenceType(type)
110  visitFixedType(type)
111  visitDeclaredType(type)"""
112
113    def visitBaseType(self, type):     return
114    def visitStringType(self, type):   return
115    def visitWStringType(self, type):  return
116    def visitSequenceType(self, type): return
117    def visitFixedType(self, type):    return
118    def visitDeclaredType(self, type): return
119