File: SetPathName.hpp

package info (click to toggle)
fauhdlc 20180504-3.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 3,064 kB
  • sloc: cpp: 23,188; ansic: 6,077; yacc: 3,764; lex: 763; makefile: 605; python: 412; xml: 403; sh: 61
file content (87 lines) | stat: -rw-r--r-- 2,456 bytes parent folder | download | duplicates (3)
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
/* $Id$ 
 *
 * For different symbol bearing nodes, determine the full vhdl path name.
 *
 * 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 __SET_PATHNAME_HPP_INCLUDED
#define __SET_PATHNAME_HPP_INCLUDED

#include "frontend/visitor/TopDownVisitor.hpp"
#include <list>

namespace ast {

//! set the path name of any symbol.
/** This visitor will set the corresponding path name of any symbol. 
 *  Dependencies: Any visitor that adds declarations *must* have been
 *                executed before. NormalizeAssocs is one example.
 */
class SetPathName : public TopDownVisitor {
public:
	//! c'tor
	SetPathName();
	
	/** Visit a Library.
	 *  @param node Library node that get's visited.
	 */
	virtual void visit(Library &node);

	/** Visit an Entity declaration.
	 *  @param node Entity Declaration node that get's visited.
	 */
	virtual void visit(Entity &node);

	/** Visit an Architecture node.
	 *  @param node Architecture node that get's visited.
	 */
	virtual void visit(Architecture &node);

	/** Visit a Package node.
	 *  @param node Package node that get's visited.
	 */
	virtual void visit(Package &node);

	/** Visit a Process node.
	 *  @param node Process node that get's visited.
	 */
	virtual void visit(Process &node);

	/** Visit a FunctionDeclaration node.
	 *  @param node FunctionDeclaration node that get's visited.
	 */
	virtual void visit(FunctionDeclaration &node);

	/** Visit a ProcedureDeclaration node.
	 *  @param node ProcedureDeclaration node that get's visited.
	 */
	virtual void visit(ProcedureDeclaration &node);

private:
	/** process a generic SymbolDeclaration
	 *  @param node SymbolDeclaration to process
	 */
	virtual void process(SymbolDeclaration &node);

	//! Process a generic Callable.
	/** This function will set the path name of a callable, adding 
	 *  suffix to it if not NULL.
	 */
	void processCallable(Callable &node, const std::string *pSuffix);

	//! determine the current path name.
	std::string getPath(void) const;
	//! stack with entries of the current path.
	std::list<std::string> currentPath;
	//! counter to make unique path names for anonymous constructs.
	int anonCounter;
}; 

}; /* namespace ast */

#endif /* __SET_PATHNAME_HPP_INCLUDED */