Source code: com/port80/eclipse/csharp/llk/ast/IScopeStack.java
1 //
2 // Copyright(c) 2002, Chris Leung
3 //
4
5 package com.port80.eclipse.csharp.llk.ast;
6
7 import com.port80.eclipse.csharp.llk.parser.ASTCompilationUnit;
8 import com.port80.eclipse.csharp.llk.parser.ASTRootContext;
9
10 /** Scope stack is used by the parser to keep track of the current
11 * lexical scopes and performs symbol lookups.
12 *
13 * . Scope stack from bottom to top:
14 * rootNode scope
15 * compilationUnit scope
16 * topLevelClass scope
17 * class/block/method...etc. scopes
18 * ...
19 *
20 * . When a variable is encountered in the statement, its type is
21 * determined by searching the scopes from the top of the scope stack
22 * downwards until it found the variable declaration/definition. If
23 * a scope belongs to a classs (parent!=null), ASTClassNode would
24 * search the superclasses and interfaces.
25 */
26 public interface IScopeStack extends ILLKScope {
27
28 // Stack interface /////////////////////////////////////////////////////
29
30 public boolean empty();
31 public void push(Object o);
32 public ILLKScope pop();
33 public ILLKScope peek();
34 public int size();
35 public ILLKScope get(int i);
36
37 ////////////////////////////////////////////////////////////////////////
38
39 public ASTRootContext getRootContext();
40 public ASTCompilationUnit getCompilationUnit();
41
42 public boolean isClassScope();
43 public int getClassLevel();
44 public Type getCurrentClass();
45 public Type getTopLevelClass();
46
47 public ISymbol getSimpleType(String aname);
48 public Type findClass(String name);
49 public Type loadClass(String name);
50
51 ////////////////////////////////////////////////////////////////////////
52
53 }