source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/src/NamespaceSupporter.cpp@ 496

Last change on this file since 496 was 465, checked in by dai_9181, 17 years ago

Messenger/ErrorMessengerクラスを導入。SetError関数によるエラー生成を廃止した。

File size: 1.5 KB
Line 
1#include "stdafx.h"
2
3#include <Compiler.h>
4
5bool NamespaceSupporter::ImportsNamespace( const std::string &namespaceStr )
6{
7 NamespaceScopes namespaceScopes( namespaceStr );
8 if( !compiler.GetObjectModule().meta.GetNamespaces().IsExist( namespaceScopes ) ){
9 return false;
10 }
11
12 this->importedNamespaces.push_back( namespaceScopes );
13
14 return true;
15}
16
17bool NamespaceSupporter::CollectNamespaces( const char *source, NamespaceScopesCollection &namespaceScopesCollection )
18{
19 int i, i2;
20 char temporary[1024];
21
22 bool isSuccessful = true;
23
24 // 名前空間管理
25 NamespaceScopes namespaceScopes;
26
27 for(i=0;;i++){
28 if(source[i]=='\0') break;
29
30 if( source[i] == 1 && source[i+1] == ESC_NAMESPACE ){
31 for(i+=2,i2=0;;i2++,i++){
32 if( IsCommandDelimitation( source[i] ) ){
33 temporary[i2]=0;
34 break;
35 }
36 temporary[i2]=source[i];
37 }
38 namespaceScopes.push_back( temporary );
39
40 if( !namespaceScopesCollection.IsExist( namespaceScopes ) ){
41 namespaceScopesCollection.push_back( namespaceScopes );
42 }
43
44 continue;
45 }
46 else if( source[i] == 1 && source[i+1] == ESC_ENDNAMESPACE ){
47 if( namespaceScopes.size() <= 0 ){
48 compiler.errorMessenger.Output( 12, "End Namespace", i );
49 isSuccessful = false;
50 }
51 else{
52 namespaceScopes.pop_back();
53 }
54
55 i += 2;
56 continue;
57 }
58 }
59
60 if( namespaceScopes.size() > 0 ){
61 compiler.errorMessenger.Output( 63, NULL, cp );
62 isSuccessful = false;
63 }
64
65 return isSuccessful;
66}
Note: See TracBrowser for help on using the repository browser.