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

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

LexicalScopeを移動

File size: 1.4 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 CScope *SearchScope( SCOPE_TYPE TypeOfStatement );
47
48 virtual CScope *CreateScope( int level, int addr, SCOPE_TYPE TypeOfStatement ) = 0;
49public:
50 CLexicalScopes();
51 ~CLexicalScopes();
52
53 //初期化(関数コンパイルの開始時に呼び出される)
54 void Init(int addr);
55
56 // スコープを開始
57 void Start( int addr, SCOPE_TYPE TypeOfStatement );
58
59 //スコープを終了
60 void End();
61
62 //スコープ抜け出しステートメント
63 void Break();
64
65 int GetNowLevel(void);
66 void SetNowLevel( int level );
67 int GetStartAddress(void);
68
69 //スコープ終了時のデストラクタ呼び出し
70 virtual void CallDestructorsOfScopeEnd() = 0;
71
72 //Returnステートメント用のデストラクタ呼び出し
73 virtual void CallDestructorsOfReturn( int BaseLevel = 0 ) = 0;
74};
75
Note: See TracBrowser for help on using the repository browser.