/usr/include/Synopsis/SymbolFactory.hh is in libsynopsis0.12-dev 0.12-10.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | //
// Copyright (C) 2004 Stefan Seefeld
// All rights reserved.
// Licensed to the public under the terms of the GNU LGPL (>= 2),
// see the file COPYING for details.
//
#ifndef Synopsis_SymbolFactory_hh_
#define Synopsis_SymbolFactory_hh_
#include <Synopsis/SymbolLookup/Scope.hh>
#include <stack>
namespace Synopsis
{
namespace SymbolLookup
{
class PrototypeScope;
class TemplateParameterScope;
}
//. SymbolFactory populates a symbol table.
class SymbolFactory
{
public:
//.
enum Language { NONE = 0x00, C99 = 0x01, CXX = 0x02};
//. Create a symbol lookup table for the given language.
//. Right now only CXX is supported.
SymbolFactory(Language = CXX);
SymbolLookup::Scope *current_scope() { return my_scopes.top();}
void enter_scope(PTree::NamespaceSpec const *);
void enter_scope(PTree::ClassSpec const *);
void enter_scope(PTree::Node const *);
void enter_scope(PTree::FunctionDefinition const *);
void enter_scope(PTree::TemplateDecl const *);
void enter_scope(PTree::Block const *);
void leave_scope();
void declare(PTree::Declaration const *);
void declare(PTree::Typedef const *);
//. declare the enumeration as a new TYPE as well as all the enumerators as CONST
void declare(PTree::EnumSpec const *);
//. declare the namespace as a new NAMESPACE
void declare(PTree::NamespaceSpec const *);
//. declare the class as a new TYPE
void declare(PTree::ClassSpec const *);
void declare(PTree::TemplateDecl const *);
void declare(PTree::TypeParameter const *);
void declare(PTree::UsingDirective const *);
void declare(PTree::ParameterDeclaration const *);
void declare(PTree::UsingDeclaration const *);
private:
typedef std::stack<SymbolLookup::Scope *> Scopes;
//. Lookup the scope of a qualified name.
//. The encoded name is modified in place to
//. refer to the unqualified name.
SymbolLookup::Scope *lookup_scope_of_qname(PTree::Encoding &, PTree::Node const *);
Language my_language;
Scopes my_scopes;
//. When parsing a function definition the declarator is seen first,
//. and thus a prototype is created to hold the parameters.
//. Later, when the function definition proper is seen, the symbols
//. are transfered and the prototype is deleted.
SymbolLookup::PrototypeScope *my_prototype;
//. When parsing a class or function template the template-parameter-list
//. is seen first. Since ClassSpec and Declarator don't know they are part
//. of a template declaration, we cache it here so it gets consumed when
//. the Class or PrototypeScope are created.
// FIXME: Should ClassSpec get a flag so it knows it's a template, similar
// to Encodings helt in Declarators ?
SymbolLookup::TemplateParameterScope *my_template_parameters;
};
}
#endif
|