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