annotate trunk/src/dil/Scope.d @ 486:bd176bc73e43

Fixed a few things in the Parser. Refactored some code that used parseArguments() to using parseExpressionList(). Added calls to set() and tidied up the code of the Parser a bit. Fixed parsing DotIdentifier in parseAsmPrimaryExpression(). Added charLiteral member to class CharExpression. Added class InformationManager. Added member infoMan to class Scope.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 01 Dec 2007 18:22:56 +0100
parents e6c759e151cd
children 47be6bfe39cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
407
5431c0faf3b5 Added modules dil.Scope and dil.Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
1 /++
5431c0faf3b5 Added modules dil.Scope and dil.Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
2 Author: Aziz Köksal
5431c0faf3b5 Added modules dil.Scope and dil.Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
3 License: GPL3
5431c0faf3b5 Added modules dil.Scope and dil.Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
4 +/
5431c0faf3b5 Added modules dil.Scope and dil.Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
5 module dil.Scope;
430
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
6 import dil.Symbol;
486
bd176bc73e43 Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 430
diff changeset
7 import dil.Information;
407
5431c0faf3b5 Added modules dil.Scope and dil.Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
8 import common;
5431c0faf3b5 Added modules dil.Scope and dil.Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
9
5431c0faf3b5 Added modules dil.Scope and dil.Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
10 class Scope
5431c0faf3b5 Added modules dil.Scope and dil.Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
11 {
430
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
12 Scope parent; /// The surrounding scope.
486
bd176bc73e43 Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 430
diff changeset
13 InformationManager infoMan; /// Collects errors reported during the semantic phase.
407
5431c0faf3b5 Added modules dil.Scope and dil.Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
14
430
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
15 this()
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
16 {
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
17 }
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
18
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
19 /++
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
20 Find an identifier in this scope.
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
21 +/
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
22 Symbol find(char[] ident)
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
23 {
486
bd176bc73e43 Fixed a few things in the Parser.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 430
diff changeset
24 return null;
430
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
25 }
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
26
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
27 /++
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
28 Add a symbol to this scope.
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
29 +/
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
30 void add(Symbol sym)
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
31 {
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
32
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
33 }
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
34
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
35 /++
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
36 Create a new inner scope.
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
37 +/
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
38 Scope push()
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
39 {
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
40 auto sc = new Scope();
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
41 sc.parent = this;
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
42 return sc;
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
43 }
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
44
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
45 /++
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
46 Destroy this scope and return the outer scope.
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
47 +/
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
48 Scope pop()
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
49 {
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
50 auto sc = parent;
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
51 // delete this;
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
52 return sc;
e6c759e151cd Fixed a few things regarding encoding/decoding UTF-8 sequences.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents: 407
diff changeset
53 }
407
5431c0faf3b5 Added modules dil.Scope and dil.Symbol.
Aziz K?ksal <aziz.koeksal@gmail.com>
parents:
diff changeset
54 }