source: dev/trunk/jenga/include/smoothie/LexicalScoping.h@ 211

Last change on this file since 211 was 205, checked in by dai_9181, 17 years ago

コード全体のリファクタリングを実施

File size: 1.3 KB
Line 
1#pragma once
2
3#include <windows.h>
4
5enum SCOPE_TYPE{
6 //ベース
7 SCOPE_TYPE_BASE,
8
9 //分岐
10 SCOPE_TYPE_IF,
11
12 //ループ
13 SCOPE_TYPE_DO,
14 SCOPE_TYPE_FOR,
15 SCOPE_TYPE_WHILE,
16
17 //ケース分け
18 SCOPE_TYPE_SELECT,
19};
20
21class CScope{
22protected:
23 int level;
24 int StartAddress;
25 SCOPE_TYPE TypeOfStatement;
26
27 DWORD *pBreakSchedule;
28 int nBreakSchedule;
29
30public:
31 CScope( int level, int addr, SCOPE_TYPE TypeOfStatement );
32 ~CScope();
33
34 int GetStartAddress();
35 SCOPE_TYPE GetTypeOfStatement();
36
37 virtual void Break() = 0;
38 virtual void RunScheduleOfBreak() = 0;
39};
40
41class CLexicalScopes{
42protected:
43 CScope **ppScopes;
44 int level;
45
46 virtual CScope *CreateScope( int level, int addr, SCOPE_TYPE TypeOfStatement ) = 0;
47public:
48 CLexicalScopes();
49 ~CLexicalScopes();
50
51 //初期化(関数コンパイルの開始時に呼び出される)
52 void Init(int addr);
53
54 // スコープを開始
55 void Start( int addr, SCOPE_TYPE TypeOfStatement );
56
57 // スコープを終了
58 virtual void End() = 0;
59
60 // スコープを検索
61 CScope *SearchScope( SCOPE_TYPE TypeOfStatement );
62
63 int GetNowLevel(void);
64 void SetNowLevel( int level );
65 int GetStartAddress(void);
66
67 //スコープ終了時のデストラクタ呼び出し
68 virtual void CallDestructorsOfScopeEnd() = 0;
69
70 //Returnステートメント用のデストラクタ呼び出し
71 virtual void CallDestructorsOfReturn( int BaseLevel = 0 ) = 0;
72};
73
Note: See TracBrowser for help on using the repository browser.