1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
/* $Id$
*
* Copyright (C) 2008-2009 FAUmachine Team <info@faumachine.org>.
* This program is free software. You can redistribute it and/or modify it
* under the terms of the GNU General Public License, either version 2 of
* the License, or (at your option) any later version. See COPYING.
*/
#ifndef __RESOLVE_SYMBOLS_HPP_INCLUDED
#define __RESOLVE_SYMBOLS_HPP_INCLUDED
#include "frontend/visitor/TopDownVisitor.hpp"
#include "frontend/misc/SymbolTable.hpp"
namespace ast {
//! class used to late resolve symbols
/** This class can be used to set the symbol candidates for name based nodes,
* in case these couldn't get looked up yet during scanning.
* The most prominent example is any association list.
*/
class ResolveSymbols : public TopDownVisitor {
public:
//! c'tor
/** @param symbolTable symbol table instance. */
ResolveSymbols(
SymbolTable &symbolTable
) : symTab(symbolTable),
prefixCands(NULL) {}
private:
/** visit a SimpleName
* @param node node that get's visited.
*/
virtual void visit(SimpleName &node);
/** visit a TemporaryName
* @param node node that get's visited.
*/
virtual void visit(TemporaryName &node);
/** visit a SelectedName
* @param node node that get's visited.
*/
virtual void visit(SelectedName &node);
/** visit a AttributeName
* @param node node that get's visited.
*/
virtual void visit(AttributeName &node);
/** visit a Slice
* @param node node that get's visited.
*/
virtual void visit(Slice &node);
/** visit a Subscript
* @param node node that get's visited.
*/
virtual void visit(Subscript &node);
/** visit a FunctionCall
* @param node node that get's visited.
*/
virtual void visit(FunctionCall &node);
/** visit an AssociationElement
* @param node node that get's visited.
*/
virtual void visit(AssociationElement &node);
/** visit a ElementAssociation
* @param node node that get's visited.
*/
virtual void visit(ElementAssociation &node);
/** visit an CompInstStat
* @param node node that get's visited.
*/
virtual void visit(CompInstStat &node);
//! process a generic expression
/** @param node node to process.
*/
virtual void process(Expression &node);
//! process a generic AstNode (must not happen).
/** @param node node to process.
*/
virtual void process(AstNode &node);
//! SymbolTable instance.
SymbolTable &symTab;
//! typedef for symbol lists.
// FIXME should probably go to DeclarativeRegion or SymbolTable
typedef std::list<Symbol*> symListT;
//! prefix candidate symbols.
symListT *prefixCands;
};
}; /* namespace ast */
#endif /* __RESOLVE_SYMBOLS_HPP_INCLUDED */
|