Last change
on this file since 508 was 508, checked in by dai_9181, 16 years ago |
Symbolコンストラクタを少なくし、LexicalAnalyzer::FullNameToSymbolメソッドを実装。
|
File size:
1.4 KB
|
Line | |
---|
1 | #include "stdafx.h"
|
---|
2 |
|
---|
3 | #include <Compiler.h>
|
---|
4 | #include <Symbol.h>
|
---|
5 |
|
---|
6 | const NamespaceSupporter *Symbol::namespaceSupporter = NULL;
|
---|
7 |
|
---|
8 | std::string Symbol::GetFullName() const
|
---|
9 | {
|
---|
10 | if( namespaceScopes.size() )
|
---|
11 | {
|
---|
12 | return namespaceScopes.ToString() + "." + name;
|
---|
13 | }
|
---|
14 |
|
---|
15 | return name;
|
---|
16 | }
|
---|
17 |
|
---|
18 | bool Symbol::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const
|
---|
19 | {
|
---|
20 | if( GetName() != name ){
|
---|
21 | return false;
|
---|
22 | }
|
---|
23 |
|
---|
24 | _ASSERTE( namespaceSupporter );
|
---|
25 | return namespaceSupporter->IsSameAreaNamespace( GetNamespaceScopes(), namespaceScopes );
|
---|
26 | }
|
---|
27 | bool Symbol::IsEqualSymbol( const Symbol &symbol ) const
|
---|
28 | {
|
---|
29 | if( IsEqualSymbol( symbol.GetNamespaceScopes(), symbol.GetName() ) )
|
---|
30 | {
|
---|
31 | return true;
|
---|
32 | }
|
---|
33 |
|
---|
34 | if( symbol.GetNamespaceScopes().size() >= 1 )
|
---|
35 | {
|
---|
36 | // 静的メンバを考慮
|
---|
37 | NamespaceScopes namespaceScopes( symbol.GetNamespaceScopes() );
|
---|
38 | string name = namespaceScopes[namespaceScopes.size()-1] + "." + symbol.GetName();
|
---|
39 | namespaceScopes.pop_back();
|
---|
40 |
|
---|
41 | return IsEqualSymbol( namespaceScopes, name );
|
---|
42 | }
|
---|
43 | return false;
|
---|
44 | }
|
---|
45 | bool Symbol::IsEqualSymbol( const char *fullName ) const
|
---|
46 | {
|
---|
47 | char AreaName[VN_SIZE] = ""; //オブジェクト変数
|
---|
48 | char NestName[VN_SIZE] = ""; //入れ子メンバ
|
---|
49 | bool isNest = SplitMemberName( fullName, AreaName, NestName );
|
---|
50 |
|
---|
51 | if( IsEqualSymbol( NamespaceScopes( AreaName ), NestName ) ){
|
---|
52 | return true;
|
---|
53 | }
|
---|
54 |
|
---|
55 | return false;
|
---|
56 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.