1 //
2 // aegis - project change supervisor
3 // Copyright (C) 2008, 2012 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or (at
8 // your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License along
16 // with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18 
19 #include <common/ac/assert.h>
20 
21 #include <libaegis/meta_context/introspector.h>
22 #include <libaegis/sem.h>
23 
24 
~meta_context_introspector()25 meta_context_introspector::~meta_context_introspector()
26 {
27 }
28 
29 
meta_context_introspector()30 meta_context_introspector::meta_context_introspector()
31 {
32 }
33 
34 
35 void
parse_file(const nstring & filename,const introspector::pointer & ip)36 meta_context_introspector::parse_file(const nstring &filename,
37     const introspector::pointer &ip)
38 {
39     stack.push_back(ip);
40     sem_parse_file(*this, filename);
41     assert(stack.empty());
42     stack.clear();
43 }
44 
45 
46 void
integer(long n)47 meta_context_introspector::integer(long n)
48 {
49     assert(!stack.empty());
50     stack.back()->integer(n);
51 }
52 
53 
54 void
real(double n)55 meta_context_introspector::real(double n)
56 {
57     assert(!stack.empty());
58     stack.back()->real(n);
59 }
60 
61 
62 void
string(const nstring & s)63 meta_context_introspector::string(const nstring &s)
64 {
65     assert(!stack.empty());
66     stack.back()->string(s);
67 }
68 
69 
70 void
enumeration(const nstring & name)71 meta_context_introspector::enumeration(const nstring &name)
72 {
73     assert(!stack.empty());
74     stack.back()->enumeration(name);
75 }
76 
77 
78 void
list()79 meta_context_introspector::list()
80 {
81     assert(!stack.empty());
82     stack.push_back(stack.back()->list());
83 }
84 
85 
86 void
list_end()87 meta_context_introspector::list_end()
88 {
89     assert(!stack.empty());
90     stack.pop_back();
91 }
92 
93 
94 void
field(const nstring & name)95 meta_context_introspector::field(const nstring &name)
96 {
97     assert(!stack.empty());
98     stack.push_back(stack.back()->field(name));
99 }
100 
101 
102 void
field_end()103 meta_context_introspector::field_end()
104 {
105     assert(!stack.empty());
106     stack.pop_back();
107 }
108 
109 
110 void
end()111 meta_context_introspector::end()
112 {
113     assert(!stack.empty());
114     stack.pop_back();
115 }
116 
117 
118 // vim: set ts=8 sw=4 et :
119