source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer.cpp@ 712

Last change on this file since 712 was 625, checked in by dai_9181, 17 years ago

・WindowInfoクラスをリファクタリング
・MdiInfoを単純配列からvectorに変更した。

File size: 1.6 KB
Line 
1#include "stdafx.h"
2
3using namespace ActiveBasic::Compiler;
4
5bool 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}
55
56Symbol LexicalAnalyzer::FullNameToSymbol( const char *fullName )
57{
58 char areaName[VN_SIZE] = ""; //オブジェクト変数
59 char nestName[VN_SIZE] = ""; //入れ子メンバ
60 bool isNest = SplitMemberName( fullName, areaName, nestName );
61
62 return Symbol( NamespaceScopes( areaName ), nestName );
63}
64
65Symbol LexicalAnalyzer::FullNameToSymbol( const std::string &fullName )
66{
67 return FullNameToSymbol( fullName.c_str() );
68}
Note: See TracBrowser for help on using the repository browser.