1*78bc99aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*78bc99aaSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*78bc99aaSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*78bc99aaSAndrew Rist * distributed with this work for additional information
6*78bc99aaSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*78bc99aaSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*78bc99aaSAndrew Rist * "License"); you may not use this file except in compliance
9*78bc99aaSAndrew Rist * with the License. You may obtain a copy of the License at
10*78bc99aaSAndrew Rist *
11*78bc99aaSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*78bc99aaSAndrew Rist *
13*78bc99aaSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*78bc99aaSAndrew Rist * software distributed under the License is distributed on an
15*78bc99aaSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*78bc99aaSAndrew Rist * KIND, either express or implied. See the License for the
17*78bc99aaSAndrew Rist * specific language governing permissions and limitations
18*78bc99aaSAndrew Rist * under the License.
19*78bc99aaSAndrew Rist *
20*78bc99aaSAndrew Rist *************************************************************/
21cdf0e10cSrcweir
22cdf0e10cSrcweir #include <precomp.h>
23cdf0e10cSrcweir #include "pe_base.hxx"
24cdf0e10cSrcweir
25cdf0e10cSrcweir
26cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES
27cdf0e10cSrcweir #include <cosv/tpl/tpltools.hxx>
28cdf0e10cSrcweir #include <ary/cpp/c_gate.hxx>
29cdf0e10cSrcweir #include <ary/cpp/c_type.hxx>
30cdf0e10cSrcweir #include "pe_type.hxx"
31cdf0e10cSrcweir
32cdf0e10cSrcweir
33cdf0e10cSrcweir
34cdf0e10cSrcweir
35cdf0e10cSrcweir namespace cpp
36cdf0e10cSrcweir {
37cdf0e10cSrcweir
38cdf0e10cSrcweir
39cdf0e10cSrcweir static const PE_Base::Base aNullBase_;
40cdf0e10cSrcweir
41cdf0e10cSrcweir
PE_Base(Cpp_PE * i_pParent)42cdf0e10cSrcweir PE_Base::PE_Base( Cpp_PE * i_pParent )
43cdf0e10cSrcweir : Cpp_PE(i_pParent),
44cdf0e10cSrcweir pStati(new PeStatusArray<PE_Base>)
45cdf0e10cSrcweir // aBaseIds,
46cdf0e10cSrcweir // pSpType,
47cdf0e10cSrcweir // pSpuBaseName
48cdf0e10cSrcweir {
49cdf0e10cSrcweir Setup_StatusFunctions();
50cdf0e10cSrcweir aBaseIds.reserve(4);
51cdf0e10cSrcweir
52cdf0e10cSrcweir pSpType = new SP_Type(*this);
53cdf0e10cSrcweir pSpuBaseName = new SPU_BaseName(*pSpType, 0, &PE_Base::SpReturn_BaseName);
54cdf0e10cSrcweir }
55cdf0e10cSrcweir
56cdf0e10cSrcweir
~PE_Base()57cdf0e10cSrcweir PE_Base::~PE_Base()
58cdf0e10cSrcweir {
59cdf0e10cSrcweir }
60cdf0e10cSrcweir
61cdf0e10cSrcweir void
Call_Handler(const cpp::Token & i_rTok)62cdf0e10cSrcweir PE_Base::Call_Handler( const cpp::Token & i_rTok )
63cdf0e10cSrcweir {
64cdf0e10cSrcweir pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text());
65cdf0e10cSrcweir }
66cdf0e10cSrcweir
67cdf0e10cSrcweir void
Setup_StatusFunctions()68cdf0e10cSrcweir PE_Base::Setup_StatusFunctions()
69cdf0e10cSrcweir {
70cdf0e10cSrcweir typedef CallFunction<PE_Base>::F_Tok F_Tok;
71cdf0e10cSrcweir static F_Tok stateF_startOfNext[] = { &PE_Base::On_startOfNext_Identifier,
72cdf0e10cSrcweir &PE_Base::On_startOfNext_public,
73cdf0e10cSrcweir &PE_Base::On_startOfNext_protected,
74cdf0e10cSrcweir &PE_Base::On_startOfNext_private,
75cdf0e10cSrcweir &PE_Base::On_startOfNext_virtual,
76cdf0e10cSrcweir &PE_Base::On_startOfNext_DoubleColon };
77cdf0e10cSrcweir static INT16 stateT_startOfNext[] = { Tid_Identifier,
78cdf0e10cSrcweir Tid_public,
79cdf0e10cSrcweir Tid_protected,
80cdf0e10cSrcweir Tid_private,
81cdf0e10cSrcweir Tid_virtual,
82cdf0e10cSrcweir Tid_DoubleColon };
83cdf0e10cSrcweir static F_Tok stateF_inName[] = { &PE_Base::On_inName_Identifier,
84cdf0e10cSrcweir &PE_Base::On_inName_virtual,
85cdf0e10cSrcweir &PE_Base::On_inName_SwBracket_Left,
86cdf0e10cSrcweir &PE_Base::On_inName_DoubleColon,
87cdf0e10cSrcweir &PE_Base::On_inName_Comma };
88cdf0e10cSrcweir static INT16 stateT_inName[] = { Tid_Identifier,
89cdf0e10cSrcweir Tid_virtual,
90cdf0e10cSrcweir Tid_SwBracket_Left,
91cdf0e10cSrcweir Tid_DoubleColon,
92cdf0e10cSrcweir Tid_Comma };
93cdf0e10cSrcweir
94cdf0e10cSrcweir SEMPARSE_CREATE_STATUS(PE_Base, startOfNext, Hdl_SyntaxError);
95cdf0e10cSrcweir SEMPARSE_CREATE_STATUS(PE_Base, inName, Hdl_SyntaxError);
96cdf0e10cSrcweir }
97cdf0e10cSrcweir
98cdf0e10cSrcweir void
Hdl_SyntaxError(const char * i_sText)99cdf0e10cSrcweir PE_Base::Hdl_SyntaxError( const char * i_sText)
100cdf0e10cSrcweir {
101cdf0e10cSrcweir StdHandlingOfSyntaxError(i_sText);
102cdf0e10cSrcweir }
103cdf0e10cSrcweir
104cdf0e10cSrcweir void
InitData()105cdf0e10cSrcweir PE_Base::InitData()
106cdf0e10cSrcweir {
107cdf0e10cSrcweir pStati->SetCur(startOfNext);
108cdf0e10cSrcweir csv::erase_container(aBaseIds);
109cdf0e10cSrcweir aBaseIds.push_back(aNullBase_);
110cdf0e10cSrcweir }
111cdf0e10cSrcweir
112cdf0e10cSrcweir void
TransferData()113cdf0e10cSrcweir PE_Base::TransferData()
114cdf0e10cSrcweir {
115cdf0e10cSrcweir // Does nothing.
116cdf0e10cSrcweir }
117cdf0e10cSrcweir
118cdf0e10cSrcweir void
SpReturn_BaseName()119cdf0e10cSrcweir PE_Base::SpReturn_BaseName()
120cdf0e10cSrcweir {
121cdf0e10cSrcweir CurObject().nId = pSpuBaseName->Child().Result_Type().Id();
122cdf0e10cSrcweir
123cdf0e10cSrcweir static StreamStr aBaseName(100);
124cdf0e10cSrcweir aBaseName.seekp(0);
125cdf0e10cSrcweir pSpuBaseName->Child().Result_Type().Get_Text( aBaseName, Env().AryGate() );
126cdf0e10cSrcweir
127cdf0e10cSrcweir Env().Event_Class_FinishedBase(aBaseName.c_str());
128cdf0e10cSrcweir }
129cdf0e10cSrcweir
130cdf0e10cSrcweir void
On_startOfNext_public(const char *)131cdf0e10cSrcweir PE_Base::On_startOfNext_public(const char *)
132cdf0e10cSrcweir {
133cdf0e10cSrcweir SetTokenResult(done, stay);
134cdf0e10cSrcweir pStati->SetCur(inName);
135cdf0e10cSrcweir
136cdf0e10cSrcweir CurObject().eProtection = ary::cpp::PROTECT_public;
137cdf0e10cSrcweir }
138cdf0e10cSrcweir
139cdf0e10cSrcweir void
On_startOfNext_protected(const char *)140cdf0e10cSrcweir PE_Base::On_startOfNext_protected(const char *)
141cdf0e10cSrcweir {
142cdf0e10cSrcweir SetTokenResult(done, stay);
143cdf0e10cSrcweir pStati->SetCur(inName);
144cdf0e10cSrcweir
145cdf0e10cSrcweir CurObject().eProtection = ary::cpp::PROTECT_protected;
146cdf0e10cSrcweir }
147cdf0e10cSrcweir
148cdf0e10cSrcweir void
On_startOfNext_private(const char *)149cdf0e10cSrcweir PE_Base::On_startOfNext_private(const char *)
150cdf0e10cSrcweir {
151cdf0e10cSrcweir SetTokenResult(done, stay);
152cdf0e10cSrcweir pStati->SetCur(inName);
153cdf0e10cSrcweir
154cdf0e10cSrcweir CurObject().eProtection = ary::cpp::PROTECT_private;
155cdf0e10cSrcweir }
156cdf0e10cSrcweir
157cdf0e10cSrcweir void
On_startOfNext_virtual(const char *)158cdf0e10cSrcweir PE_Base::On_startOfNext_virtual(const char *)
159cdf0e10cSrcweir {
160cdf0e10cSrcweir SetTokenResult(done, stay);
161cdf0e10cSrcweir
162cdf0e10cSrcweir CurObject().eVirtuality = ary::cpp::VIRTUAL_virtual;
163cdf0e10cSrcweir }
164cdf0e10cSrcweir
165cdf0e10cSrcweir void
On_startOfNext_Identifier(const char *)166cdf0e10cSrcweir PE_Base::On_startOfNext_Identifier(const char * )
167cdf0e10cSrcweir {
168cdf0e10cSrcweir pSpuBaseName->Push(not_done);
169cdf0e10cSrcweir }
170cdf0e10cSrcweir
171cdf0e10cSrcweir void
On_startOfNext_DoubleColon(const char *)172cdf0e10cSrcweir PE_Base::On_startOfNext_DoubleColon(const char *)
173cdf0e10cSrcweir {
174cdf0e10cSrcweir pSpuBaseName->Push(not_done);
175cdf0e10cSrcweir }
176cdf0e10cSrcweir
177cdf0e10cSrcweir void
On_inName_Identifier(const char *)178cdf0e10cSrcweir PE_Base::On_inName_Identifier(const char * )
179cdf0e10cSrcweir {
180cdf0e10cSrcweir pSpuBaseName->Push(not_done);
181cdf0e10cSrcweir }
182cdf0e10cSrcweir
183cdf0e10cSrcweir void
On_inName_virtual(const char *)184cdf0e10cSrcweir PE_Base::On_inName_virtual(const char *)
185cdf0e10cSrcweir {
186cdf0e10cSrcweir SetTokenResult(done, stay);
187cdf0e10cSrcweir
188cdf0e10cSrcweir CurObject().eVirtuality = ary::cpp::VIRTUAL_virtual;
189cdf0e10cSrcweir }
190cdf0e10cSrcweir
191cdf0e10cSrcweir void
On_inName_DoubleColon(const char *)192cdf0e10cSrcweir PE_Base::On_inName_DoubleColon(const char *)
193cdf0e10cSrcweir {
194cdf0e10cSrcweir pSpuBaseName->Push(not_done);
195cdf0e10cSrcweir }
196cdf0e10cSrcweir
197cdf0e10cSrcweir void
On_inName_Comma(const char *)198cdf0e10cSrcweir PE_Base::On_inName_Comma(const char *)
199cdf0e10cSrcweir {
200cdf0e10cSrcweir SetTokenResult(done, stay);
201cdf0e10cSrcweir pStati->SetCur(startOfNext);
202cdf0e10cSrcweir
203cdf0e10cSrcweir aBaseIds.push_back( aNullBase_ );
204cdf0e10cSrcweir }
205cdf0e10cSrcweir
206cdf0e10cSrcweir void
On_inName_SwBracket_Left(const char *)207cdf0e10cSrcweir PE_Base::On_inName_SwBracket_Left(const char *)
208cdf0e10cSrcweir {
209cdf0e10cSrcweir SetTokenResult(not_done, pop_success);
210cdf0e10cSrcweir }
211cdf0e10cSrcweir
212cdf0e10cSrcweir
213cdf0e10cSrcweir } // namespace cpp
214cdf0e10cSrcweir
215cdf0e10cSrcweir
216cdf0e10cSrcweir
217cdf0e10cSrcweir
218cdf0e10cSrcweir
219