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