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_funct.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir #include <cosv/tpl/tpltools.hxx>
28cdf0e10cSrcweir #include <ary/cpp/c_gate.hxx>
29cdf0e10cSrcweir #include <ary/cpp/c_funct.hxx>
30cdf0e10cSrcweir #include <ary/cpp/c_type.hxx>
31cdf0e10cSrcweir #include <ary/cpp/cp_ce.hxx>
32cdf0e10cSrcweir #include <ary/cpp/cp_type.hxx>
33cdf0e10cSrcweir #include <ary/cpp/inpcontx.hxx>
34cdf0e10cSrcweir #include "pe_type.hxx"
35cdf0e10cSrcweir #include "pe_param.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 
40cdf0e10cSrcweir namespace cpp
41cdf0e10cSrcweir {
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 
44cdf0e10cSrcweir inline void
PerformFinishingPunctuation()45cdf0e10cSrcweir PE_Function::PerformFinishingPunctuation()
46cdf0e10cSrcweir {
47cdf0e10cSrcweir     SetTokenResult(not_done,pop_success);
48cdf0e10cSrcweir }
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 
PE_Function(Cpp_PE * i_pParent)51cdf0e10cSrcweir PE_Function::PE_Function( Cpp_PE * i_pParent )
52cdf0e10cSrcweir 	:   Cpp_PE(i_pParent),
53cdf0e10cSrcweir 		pStati( new PeStatusArray<PE_Function> ),
54cdf0e10cSrcweir 		// pSpParameter,
55cdf0e10cSrcweir 		// pSpuParameter,
56cdf0e10cSrcweir         // pSpType,
57cdf0e10cSrcweir         // pSpuException,
58cdf0e10cSrcweir         // pSpuCastOperatorType,
59cdf0e10cSrcweir 		nResult(0),
60cdf0e10cSrcweir         bResult_WithImplementation(false),
61cdf0e10cSrcweir         aName(60),
62cdf0e10cSrcweir         eVirtuality(ary::cpp::VIRTUAL_none),
63cdf0e10cSrcweir         eConVol(ary::cpp::CONVOL_none),
64cdf0e10cSrcweir         // aFlags,
65cdf0e10cSrcweir         nReturnType(0),
66cdf0e10cSrcweir         // aParameters
67cdf0e10cSrcweir         // aExceptions,
68cdf0e10cSrcweir         bThrow(false),
69cdf0e10cSrcweir         nBracketCounterInImplementation(0)
70cdf0e10cSrcweir {
71cdf0e10cSrcweir 	Setup_StatusFunctions();
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	pSpParameter     = new SP_Parameter(*this);
74cdf0e10cSrcweir 	pSpType          = new SP_Type(*this);
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	pSpuParameter	        = new SPU_Parameter(*pSpParameter, 0, &PE_Function::SpReturn_Parameter);
77cdf0e10cSrcweir 	pSpuException	        = new SPU_Type(*pSpType, 0, &PE_Function::SpReturn_Exception);
78cdf0e10cSrcweir 	pSpuCastOperatorType	= new SPU_Type(*pSpType, &PE_Function::SpInit_CastOperatorType, &PE_Function::SpReturn_CastOperatorType);
79cdf0e10cSrcweir }
80cdf0e10cSrcweir 
~PE_Function()81cdf0e10cSrcweir PE_Function::~PE_Function()
82cdf0e10cSrcweir {
83cdf0e10cSrcweir 
84cdf0e10cSrcweir }
85cdf0e10cSrcweir 
86cdf0e10cSrcweir void
Init_Std(const String & i_sName,ary::cpp::Type_id i_nReturnType,bool i_bVirtual,ary::cpp::FunctionFlags i_aFlags)87cdf0e10cSrcweir PE_Function::Init_Std( const String  &          i_sName,
88cdf0e10cSrcweir                        ary::cpp::Type_id        i_nReturnType,
89cdf0e10cSrcweir 	                   bool                     i_bVirtual,
90cdf0e10cSrcweir                        ary::cpp::FunctionFlags  i_aFlags )
91cdf0e10cSrcweir {
92cdf0e10cSrcweir     aName << i_sName;
93cdf0e10cSrcweir     eVirtuality = i_bVirtual ? ary::cpp::VIRTUAL_virtual : ary::cpp::VIRTUAL_none;
94cdf0e10cSrcweir     aFlags = i_aFlags;
95cdf0e10cSrcweir     nReturnType = i_nReturnType;
96cdf0e10cSrcweir     pStati->SetCur(afterName);
97cdf0e10cSrcweir }
98cdf0e10cSrcweir 
99cdf0e10cSrcweir void
Init_Ctor(const String & i_sName,ary::cpp::FunctionFlags i_aFlags)100cdf0e10cSrcweir PE_Function::Init_Ctor( const String  &         i_sName,
101cdf0e10cSrcweir                         ary::cpp::FunctionFlags i_aFlags )
102cdf0e10cSrcweir {
103cdf0e10cSrcweir     aName << i_sName;
104cdf0e10cSrcweir     eVirtuality = ary::cpp::VIRTUAL_none;
105cdf0e10cSrcweir     aFlags = i_aFlags;
106cdf0e10cSrcweir     nReturnType = 0;
107cdf0e10cSrcweir     pStati->SetCur(afterName);
108cdf0e10cSrcweir }
109cdf0e10cSrcweir 
110cdf0e10cSrcweir void
Init_Dtor(const String & i_sName,bool i_bVirtual,ary::cpp::FunctionFlags i_aFlags)111cdf0e10cSrcweir PE_Function::Init_Dtor( const String  &         i_sName,
112cdf0e10cSrcweir                         bool                    i_bVirtual,
113cdf0e10cSrcweir                         ary::cpp::FunctionFlags i_aFlags )
114cdf0e10cSrcweir {
115cdf0e10cSrcweir     aName << "~" << i_sName;
116cdf0e10cSrcweir     eVirtuality = i_bVirtual ? ary::cpp::VIRTUAL_virtual : ary::cpp::VIRTUAL_none;
117cdf0e10cSrcweir     aFlags = i_aFlags;
118cdf0e10cSrcweir     nReturnType = 0;
119cdf0e10cSrcweir     pStati->SetCur(afterName);
120cdf0e10cSrcweir }
121cdf0e10cSrcweir 
122cdf0e10cSrcweir void
Init_CastOperator(bool i_bVirtual,ary::cpp::FunctionFlags i_aFlags)123cdf0e10cSrcweir PE_Function::Init_CastOperator( bool                    i_bVirtual,
124cdf0e10cSrcweir                                 ary::cpp::FunctionFlags i_aFlags )
125cdf0e10cSrcweir {
126cdf0e10cSrcweir     aName << "operator ";
127cdf0e10cSrcweir     eVirtuality = i_bVirtual ? ary::cpp::VIRTUAL_virtual : ary::cpp::VIRTUAL_none;
128cdf0e10cSrcweir     aFlags = i_aFlags;
129cdf0e10cSrcweir     nReturnType = 0;
130cdf0e10cSrcweir     pStati->SetCur(afterCastOperator);
131cdf0e10cSrcweir }
132cdf0e10cSrcweir 
133cdf0e10cSrcweir void
Init_NormalOperator(ary::cpp::Type_id i_nReturnType,bool i_bVirtual,ary::cpp::FunctionFlags i_aFlags)134cdf0e10cSrcweir PE_Function::Init_NormalOperator( ary::cpp::Type_id                  i_nReturnType,
135cdf0e10cSrcweir 	                              bool                      i_bVirtual,
136cdf0e10cSrcweir                                   ary::cpp::FunctionFlags   i_aFlags )
137cdf0e10cSrcweir {
138cdf0e10cSrcweir     aName << "operator";
139cdf0e10cSrcweir     eVirtuality = i_bVirtual ? ary::cpp::VIRTUAL_virtual : ary::cpp::VIRTUAL_none;
140cdf0e10cSrcweir     aFlags = i_aFlags;
141cdf0e10cSrcweir     nReturnType = i_nReturnType;
142cdf0e10cSrcweir     pStati->SetCur(afterStdOperator);
143cdf0e10cSrcweir }
144cdf0e10cSrcweir 
145cdf0e10cSrcweir ary::cpp::Ce_id
Result_Id() const146cdf0e10cSrcweir PE_Function::Result_Id() const
147cdf0e10cSrcweir {
148cdf0e10cSrcweir 	return nResult;
149cdf0e10cSrcweir }
150cdf0e10cSrcweir 
151cdf0e10cSrcweir void
Call_Handler(const cpp::Token & i_rTok)152cdf0e10cSrcweir PE_Function::Call_Handler( const cpp::Token & i_rTok )
153cdf0e10cSrcweir {
154cdf0e10cSrcweir 	pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text());
155cdf0e10cSrcweir }
156cdf0e10cSrcweir 
157cdf0e10cSrcweir void
Setup_StatusFunctions()158cdf0e10cSrcweir PE_Function::Setup_StatusFunctions()
159cdf0e10cSrcweir {
160cdf0e10cSrcweir 	typedef CallFunction<PE_Function>::F_Tok	F_Tok;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 	static F_Tok stateF_afterStdOperator[] =
163cdf0e10cSrcweir                                             { &PE_Function::On_afterOperator_Std_Operator,
164cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Std_LeftBracket,
165cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Std_LeftBracket,
166cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Std_Operator,
167cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Std_Operator,
168cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Std_Operator,
169cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Std_Operator,
170cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Std_Operator,
171cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Std_Operator };
172cdf0e10cSrcweir 	static INT16 stateT_afterStdOperator[] =
173cdf0e10cSrcweir                                             { Tid_Operator,
174cdf0e10cSrcweir 											  Tid_ArrayBracket_Left,
175cdf0e10cSrcweir 											  Tid_Bracket_Left,
176cdf0e10cSrcweir 											  Tid_Comma,
177cdf0e10cSrcweir 											  Tid_Assign,
178cdf0e10cSrcweir 											  Tid_Less,
179cdf0e10cSrcweir 											  Tid_Greater,
180cdf0e10cSrcweir 											  Tid_Asterix,
181cdf0e10cSrcweir 											  Tid_AmpersAnd };
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 	static F_Tok stateF_afterStdOperatorLeftBracket[] =
184cdf0e10cSrcweir                                             { &PE_Function::On_afterStdOperatorLeftBracket_RightBracket,
185cdf0e10cSrcweir                                               &PE_Function::On_afterStdOperatorLeftBracket_RightBracket };
186cdf0e10cSrcweir 	static INT16 stateT_afterStdOperatorLeftBracket[] =
187cdf0e10cSrcweir                                             { Tid_ArrayBracket_Right,
188cdf0e10cSrcweir 											  Tid_Bracket_Right };
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 	static F_Tok stateF_afterCastOperator[] =
191cdf0e10cSrcweir                                             { &PE_Function::On_afterOperator_Cast_Type,
192cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Cast_Type,
193cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Cast_Type,
194cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Cast_Type,
195cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Cast_Type,
196cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Cast_Type,
197cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Cast_Type,
198cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Cast_Type,
199cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Cast_Type,
200cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Cast_Type,
201cdf0e10cSrcweir 											  &PE_Function::On_afterOperator_Cast_Type };
202cdf0e10cSrcweir 	static INT16 stateT_afterCastOperator[] =
203cdf0e10cSrcweir                                             { Tid_Identifier,
204cdf0e10cSrcweir 											  Tid_class,
205cdf0e10cSrcweir 											  Tid_struct,
206cdf0e10cSrcweir 											  Tid_union,
207cdf0e10cSrcweir 											  Tid_enum,
208cdf0e10cSrcweir 											  Tid_const,
209cdf0e10cSrcweir 											  Tid_volatile,
210cdf0e10cSrcweir 											  Tid_DoubleColon,
211cdf0e10cSrcweir                                               Tid_typename,
212cdf0e10cSrcweir 											  Tid_BuiltInType,
213cdf0e10cSrcweir 											  Tid_TypeSpecializer };
214cdf0e10cSrcweir 
215cdf0e10cSrcweir 	static F_Tok stateF_afterName[] =		{ &PE_Function::On_afterName_Bracket_Left };
216cdf0e10cSrcweir 	static INT16 stateT_afterName[] =     	{ Tid_Bracket_Left };
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 	static F_Tok stateF_expectParameterSeparator[] =
219cdf0e10cSrcweir 											{ &PE_Function::On_expectParameterSeparator_BracketRight,
220cdf0e10cSrcweir 											  &PE_Function::On_expectParameterSeparator_Comma };
221cdf0e10cSrcweir 	static INT16 stateT_expectParameterSeparator[] =
222cdf0e10cSrcweir 											{ Tid_Bracket_Right,
223cdf0e10cSrcweir 											  Tid_Comma };
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 	static F_Tok stateF_afterParameters[] =	{ &PE_Function::On_afterParameters_const,
226cdf0e10cSrcweir 											  &PE_Function::On_afterParameters_volatile,
227cdf0e10cSrcweir 											  &PE_Function::On_afterParameters_throw,
228cdf0e10cSrcweir 											  &PE_Function::On_afterParameters_SwBracket_Left,
229cdf0e10cSrcweir 											  &PE_Function::On_afterParameters_Semicolon,
230cdf0e10cSrcweir 											  &PE_Function::On_afterParameters_Comma,
231cdf0e10cSrcweir 											  &PE_Function::On_afterParameters_Colon,
232cdf0e10cSrcweir 											  &PE_Function::On_afterParameters_Assign };
233cdf0e10cSrcweir 	static INT16 stateT_afterParameters[] = { Tid_const,
234cdf0e10cSrcweir 											  Tid_volatile,
235cdf0e10cSrcweir 											  Tid_throw,
236cdf0e10cSrcweir                                               Tid_SwBracket_Left,
237cdf0e10cSrcweir 											  Tid_Semicolon,
238cdf0e10cSrcweir 											  Tid_Comma,
239cdf0e10cSrcweir                                               Tid_Colon,
240cdf0e10cSrcweir 											  Tid_Assign };
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 	static F_Tok stateF_afterThrow[] =		{ &PE_Function::On_afterThrow_Bracket_Left };
243cdf0e10cSrcweir 	static INT16 stateT_afterThrow[] =     	{ Tid_Bracket_Left };
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 	static F_Tok stateF_expectExceptionSeparator[] =
246cdf0e10cSrcweir 											{ &PE_Function::On_expectExceptionSeparator_BracketRight,
247cdf0e10cSrcweir 											  &PE_Function::On_expectExceptionSeparator_Comma };
248cdf0e10cSrcweir 	static INT16 stateT_expectExceptionSeparator[] =
249cdf0e10cSrcweir 											{ Tid_Bracket_Right,
250cdf0e10cSrcweir 											  Tid_Comma };
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 	static F_Tok stateF_afterExceptions[] =	{ &PE_Function::On_afterExceptions_SwBracket_Left,
253cdf0e10cSrcweir                                               &PE_Function::On_afterExceptions_Semicolon,
254cdf0e10cSrcweir 											  &PE_Function::On_afterExceptions_Comma,
255cdf0e10cSrcweir 											  &PE_Function::On_afterExceptions_Colon,
256cdf0e10cSrcweir 											  &PE_Function::On_afterExceptions_Assign };
257cdf0e10cSrcweir 	static INT16 stateT_afterExceptions[] = { Tid_SwBracket_Left,
258cdf0e10cSrcweir                                               Tid_Semicolon,
259cdf0e10cSrcweir 											  Tid_Comma,
260cdf0e10cSrcweir 											  Tid_Colon,
261cdf0e10cSrcweir 											  Tid_Assign };
262cdf0e10cSrcweir 
263cdf0e10cSrcweir 	static F_Tok stateF_expectZero[] =		{ &PE_Function::On_expectZero_Constant };
264cdf0e10cSrcweir 	static INT16 stateT_expectZero[] =     	{ Tid_Constant };
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 	static F_Tok stateF_inImplementation[] =
267cdf0e10cSrcweir                                             { &PE_Function::On_inImplementation_SwBracket_Left,
268cdf0e10cSrcweir                                               &PE_Function::On_inImplementation_SwBracket_Right };
269cdf0e10cSrcweir 	static INT16 stateT_inImplementation[] =
270cdf0e10cSrcweir                                             { Tid_SwBracket_Left,
271cdf0e10cSrcweir                                               Tid_SwBracket_Right };
272cdf0e10cSrcweir 
273cdf0e10cSrcweir 	SEMPARSE_CREATE_STATUS(PE_Function, afterStdOperator, Hdl_SyntaxError);
274cdf0e10cSrcweir 	SEMPARSE_CREATE_STATUS(PE_Function, afterStdOperatorLeftBracket, Hdl_SyntaxError);
275cdf0e10cSrcweir 	SEMPARSE_CREATE_STATUS(PE_Function, afterCastOperator, Hdl_SyntaxError);
276cdf0e10cSrcweir 	SEMPARSE_CREATE_STATUS(PE_Function, afterName, Hdl_SyntaxError);
277cdf0e10cSrcweir 	SEMPARSE_CREATE_STATUS(PE_Function, expectParameterSeparator, Hdl_SyntaxError);
278cdf0e10cSrcweir 	SEMPARSE_CREATE_STATUS(PE_Function, afterParameters, Hdl_SyntaxError);
279cdf0e10cSrcweir 	SEMPARSE_CREATE_STATUS(PE_Function, afterThrow, Hdl_SyntaxError);
280cdf0e10cSrcweir 	SEMPARSE_CREATE_STATUS(PE_Function, expectExceptionSeparator, Hdl_SyntaxError);
281cdf0e10cSrcweir 	SEMPARSE_CREATE_STATUS(PE_Function, afterExceptions, Hdl_SyntaxError);
282cdf0e10cSrcweir 	SEMPARSE_CREATE_STATUS(PE_Function, expectZero, Hdl_SyntaxError);
283cdf0e10cSrcweir 	SEMPARSE_CREATE_STATUS(PE_Function, inImplementation, On_inImplementation_Default );
284cdf0e10cSrcweir }
285cdf0e10cSrcweir 
286cdf0e10cSrcweir void
InitData()287cdf0e10cSrcweir PE_Function::InitData()
288cdf0e10cSrcweir {
289cdf0e10cSrcweir     pStati->SetCur( afterName ),
290cdf0e10cSrcweir 	nResult = 0;
291cdf0e10cSrcweir     bResult_WithImplementation = false;
292cdf0e10cSrcweir     aName.seekp(0);
293cdf0e10cSrcweir     eVirtuality = ary::cpp::VIRTUAL_none;
294cdf0e10cSrcweir     eConVol = ary::cpp::CONVOL_none;
295cdf0e10cSrcweir     aFlags.Reset();
296cdf0e10cSrcweir     nReturnType = 0;
297cdf0e10cSrcweir     csv::erase_container(aParameters);
298cdf0e10cSrcweir     csv::erase_container(aExceptions);
299cdf0e10cSrcweir     bThrow = false;
300cdf0e10cSrcweir }
301cdf0e10cSrcweir 
302cdf0e10cSrcweir void
TransferData()303cdf0e10cSrcweir PE_Function::TransferData()
304cdf0e10cSrcweir {
305cdf0e10cSrcweir     String  sName( aName.c_str() );
306cdf0e10cSrcweir     ary::cpp::Function *
307cdf0e10cSrcweir         pFunction = Env().AryGate().Ces().Store_Operation(
308cdf0e10cSrcweir                                                 Env().Context(),
309cdf0e10cSrcweir                                                 sName,
310cdf0e10cSrcweir                                                 nReturnType,
311cdf0e10cSrcweir                                                 aParameters,
312cdf0e10cSrcweir                                                 eVirtuality,
313cdf0e10cSrcweir                                                 eConVol,
314cdf0e10cSrcweir                                                 aFlags,
315cdf0e10cSrcweir                                                 bThrow,
316cdf0e10cSrcweir                                                 aExceptions );
317cdf0e10cSrcweir     if (pFunction != 0)
318cdf0e10cSrcweir     {
319cdf0e10cSrcweir         // KORR_FUTURE: How to handle differing documentation?
320cdf0e10cSrcweir 
321cdf0e10cSrcweir         Dyn< StringVector >
322cdf0e10cSrcweir                 pTplParams ( Env().Get_CurTemplateParameters() );
323cdf0e10cSrcweir         if ( pTplParams )
324cdf0e10cSrcweir         {
325cdf0e10cSrcweir           	for ( StringVector::const_iterator it = pTplParams->begin();
326cdf0e10cSrcweir     	    	  it !=  pTplParams->end();
327cdf0e10cSrcweir     		      ++it )
328cdf0e10cSrcweir         	{
329cdf0e10cSrcweir     	    	pFunction->Add_TemplateParameterType( *it, ary::cpp::Type_id(0) );
330cdf0e10cSrcweir         	}  // end for
331cdf0e10cSrcweir         }
332cdf0e10cSrcweir 
333cdf0e10cSrcweir         Env().Event_Store_Function(*pFunction);
334cdf0e10cSrcweir     }
335cdf0e10cSrcweir 
336cdf0e10cSrcweir     pStati->SetCur(size_of_states);
337cdf0e10cSrcweir }
338cdf0e10cSrcweir 
339cdf0e10cSrcweir void
Hdl_SyntaxError(const char * i_sText)340cdf0e10cSrcweir PE_Function::Hdl_SyntaxError(const char * i_sText)
341cdf0e10cSrcweir {
342cdf0e10cSrcweir     StdHandlingOfSyntaxError(i_sText);
343cdf0e10cSrcweir }
344cdf0e10cSrcweir 
345cdf0e10cSrcweir void
SpInit_CastOperatorType()346cdf0e10cSrcweir PE_Function::SpInit_CastOperatorType()
347cdf0e10cSrcweir {
348cdf0e10cSrcweir     pSpuCastOperatorType->Child().Init_AsCastOperatorType();
349cdf0e10cSrcweir }
350cdf0e10cSrcweir 
351cdf0e10cSrcweir void
SpReturn_Parameter()352cdf0e10cSrcweir PE_Function::SpReturn_Parameter()
353cdf0e10cSrcweir {
354cdf0e10cSrcweir     pStati->SetCur(expectParameterSeparator);
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 	ary::cpp::Type_id nParamType = pSpuParameter->Child().Result_FrontType();
357cdf0e10cSrcweir 	if ( nParamType.IsValid() )      // Check, if there was a parameter, or only the closing ')'.
358cdf0e10cSrcweir 	{
359cdf0e10cSrcweir 	    aParameters.push_back( pSpuParameter->Child().Result_ParamInfo() );
360cdf0e10cSrcweir 	}
361cdf0e10cSrcweir }
362cdf0e10cSrcweir 
363cdf0e10cSrcweir void
SpReturn_Exception()364cdf0e10cSrcweir PE_Function::SpReturn_Exception()
365cdf0e10cSrcweir {
366cdf0e10cSrcweir     pStati->SetCur(expectExceptionSeparator);
367cdf0e10cSrcweir 
368cdf0e10cSrcweir     ary::cpp::Type_id
369cdf0e10cSrcweir         nException = pSpuException->Child().Result_Type().TypeId();
370cdf0e10cSrcweir     if ( nException.IsValid() AND pSpuException->Child().Result_KindOf() == PE_Type::is_type )
371cdf0e10cSrcweir     {
372cdf0e10cSrcweir         aExceptions.push_back( nException );
373cdf0e10cSrcweir     }
374cdf0e10cSrcweir }
375cdf0e10cSrcweir 
376cdf0e10cSrcweir void
SpReturn_CastOperatorType()377cdf0e10cSrcweir PE_Function::SpReturn_CastOperatorType()
378cdf0e10cSrcweir {
379cdf0e10cSrcweir     pStati->SetCur(afterName);
380cdf0e10cSrcweir 
381cdf0e10cSrcweir     Env().AryGate().Types().Get_TypeText(
382cdf0e10cSrcweir             aName, pSpuCastOperatorType->Child().Result_Type().TypeId() );
383cdf0e10cSrcweir }
384cdf0e10cSrcweir 
385cdf0e10cSrcweir void
On_afterOperator_Std_Operator(const char * i_sText)386cdf0e10cSrcweir PE_Function::On_afterOperator_Std_Operator(const char * i_sText)
387cdf0e10cSrcweir {
388cdf0e10cSrcweir     SetTokenResult(done,stay);
389cdf0e10cSrcweir     pStati->SetCur(afterName);
390cdf0e10cSrcweir 
391cdf0e10cSrcweir     if ( 'a' <= *i_sText AND *i_sText <= 'z' )
392cdf0e10cSrcweir         aName << ' ';
393cdf0e10cSrcweir     aName << i_sText;
394cdf0e10cSrcweir }
395cdf0e10cSrcweir 
396cdf0e10cSrcweir void
On_afterOperator_Std_LeftBracket(const char * i_sText)397cdf0e10cSrcweir PE_Function::On_afterOperator_Std_LeftBracket(const char * i_sText)
398cdf0e10cSrcweir {
399cdf0e10cSrcweir     SetTokenResult(done,stay);
400cdf0e10cSrcweir     pStati->SetCur(afterStdOperatorLeftBracket);
401cdf0e10cSrcweir 
402cdf0e10cSrcweir     aName << i_sText;
403cdf0e10cSrcweir }
404cdf0e10cSrcweir 
405cdf0e10cSrcweir void
On_afterStdOperatorLeftBracket_RightBracket(const char * i_sText)406cdf0e10cSrcweir PE_Function::On_afterStdOperatorLeftBracket_RightBracket(const char * i_sText)
407cdf0e10cSrcweir {
408cdf0e10cSrcweir     SetTokenResult(done,stay);
409cdf0e10cSrcweir     pStati->SetCur(afterName);
410cdf0e10cSrcweir 
411cdf0e10cSrcweir     aName << i_sText;
412cdf0e10cSrcweir }
413cdf0e10cSrcweir 
414cdf0e10cSrcweir void
On_afterOperator_Cast_Type(const char *)415cdf0e10cSrcweir PE_Function::On_afterOperator_Cast_Type(const char *)
416cdf0e10cSrcweir {
417cdf0e10cSrcweir     pSpuCastOperatorType->Push(not_done);
418cdf0e10cSrcweir }
419cdf0e10cSrcweir 
420cdf0e10cSrcweir void
On_afterName_Bracket_Left(const char *)421cdf0e10cSrcweir PE_Function::On_afterName_Bracket_Left(const char *)
422cdf0e10cSrcweir {
423cdf0e10cSrcweir     pSpuParameter->Push(done);
424cdf0e10cSrcweir }
425cdf0e10cSrcweir 
426cdf0e10cSrcweir void
On_expectParameterSeparator_BracketRight(const char *)427cdf0e10cSrcweir PE_Function::On_expectParameterSeparator_BracketRight(const char *)
428cdf0e10cSrcweir {
429cdf0e10cSrcweir     SetTokenResult(done,stay);
430cdf0e10cSrcweir     pStati->SetCur(afterParameters);
431cdf0e10cSrcweir }
432cdf0e10cSrcweir 
433cdf0e10cSrcweir void
On_expectParameterSeparator_Comma(const char *)434cdf0e10cSrcweir PE_Function::On_expectParameterSeparator_Comma(const char *)
435cdf0e10cSrcweir {
436cdf0e10cSrcweir     pSpuParameter->Push(done);
437cdf0e10cSrcweir }
438cdf0e10cSrcweir 
439cdf0e10cSrcweir void
On_afterParameters_const(const char *)440cdf0e10cSrcweir PE_Function::On_afterParameters_const(const char *)
441cdf0e10cSrcweir {
442cdf0e10cSrcweir     SetTokenResult(done,stay);
443cdf0e10cSrcweir     eConVol = static_cast<E_ConVol>(
444cdf0e10cSrcweir                     static_cast<int>(eConVol) | static_cast<int>(ary::cpp::CONVOL_const) );
445cdf0e10cSrcweir }
446cdf0e10cSrcweir 
447cdf0e10cSrcweir void
On_afterParameters_volatile(const char *)448cdf0e10cSrcweir PE_Function::On_afterParameters_volatile(const char *)
449cdf0e10cSrcweir {
450cdf0e10cSrcweir     SetTokenResult(done,stay);
451cdf0e10cSrcweir     eConVol = static_cast<E_ConVol>(
452cdf0e10cSrcweir                     static_cast<int>(eConVol) | static_cast<int>(ary::cpp::CONVOL_volatile) );
453cdf0e10cSrcweir }
454cdf0e10cSrcweir 
455cdf0e10cSrcweir void
On_afterParameters_throw(const char *)456cdf0e10cSrcweir PE_Function::On_afterParameters_throw(const char *)
457cdf0e10cSrcweir {
458cdf0e10cSrcweir     SetTokenResult(done,stay);
459cdf0e10cSrcweir     pStati->SetCur(afterThrow);
460cdf0e10cSrcweir     bThrow = true;
461cdf0e10cSrcweir }
462cdf0e10cSrcweir 
463cdf0e10cSrcweir void
On_afterParameters_SwBracket_Left(const char *)464cdf0e10cSrcweir PE_Function::On_afterParameters_SwBracket_Left(const char *)
465cdf0e10cSrcweir {
466cdf0e10cSrcweir     EnterImplementation(1);
467cdf0e10cSrcweir }
468cdf0e10cSrcweir 
469cdf0e10cSrcweir void
On_afterParameters_Semicolon(const char *)470cdf0e10cSrcweir PE_Function::On_afterParameters_Semicolon(const char *)
471cdf0e10cSrcweir {
472cdf0e10cSrcweir     PerformFinishingPunctuation();
473cdf0e10cSrcweir }
474cdf0e10cSrcweir 
475cdf0e10cSrcweir void
On_afterParameters_Comma(const char *)476cdf0e10cSrcweir PE_Function::On_afterParameters_Comma(const char *)
477cdf0e10cSrcweir {
478cdf0e10cSrcweir     PerformFinishingPunctuation();
479cdf0e10cSrcweir }
480cdf0e10cSrcweir 
481cdf0e10cSrcweir void
On_afterParameters_Colon(const char *)482cdf0e10cSrcweir PE_Function::On_afterParameters_Colon(const char *)
483cdf0e10cSrcweir {
484cdf0e10cSrcweir     EnterImplementation(0);
485cdf0e10cSrcweir }
486cdf0e10cSrcweir 
487cdf0e10cSrcweir void
On_afterParameters_Assign(const char *)488cdf0e10cSrcweir PE_Function::On_afterParameters_Assign(const char *)
489cdf0e10cSrcweir {
490cdf0e10cSrcweir     SetTokenResult(done,stay);
491cdf0e10cSrcweir     pStati->SetCur(expectZero);
492cdf0e10cSrcweir }
493cdf0e10cSrcweir 
494cdf0e10cSrcweir void
On_afterThrow_Bracket_Left(const char *)495cdf0e10cSrcweir PE_Function::On_afterThrow_Bracket_Left(const char *)
496cdf0e10cSrcweir {
497cdf0e10cSrcweir     pSpuException->Push(done);
498cdf0e10cSrcweir }
499cdf0e10cSrcweir 
500cdf0e10cSrcweir void
On_expectExceptionSeparator_BracketRight(const char *)501cdf0e10cSrcweir PE_Function::On_expectExceptionSeparator_BracketRight(const char *)
502cdf0e10cSrcweir {
503cdf0e10cSrcweir     SetTokenResult(done,stay);
504cdf0e10cSrcweir     pStati->SetCur(afterExceptions);
505cdf0e10cSrcweir }
506cdf0e10cSrcweir 
507cdf0e10cSrcweir void
On_expectExceptionSeparator_Comma(const char *)508cdf0e10cSrcweir PE_Function::On_expectExceptionSeparator_Comma(const char *)
509cdf0e10cSrcweir {
510cdf0e10cSrcweir     pSpuException->Push(done);
511cdf0e10cSrcweir }
512cdf0e10cSrcweir 
513cdf0e10cSrcweir void
On_afterExceptions_SwBracket_Left(const char *)514cdf0e10cSrcweir PE_Function::On_afterExceptions_SwBracket_Left(const char *)
515cdf0e10cSrcweir {
516cdf0e10cSrcweir     EnterImplementation(1);
517cdf0e10cSrcweir }
518cdf0e10cSrcweir 
519cdf0e10cSrcweir void
On_afterExceptions_Semicolon(const char *)520cdf0e10cSrcweir PE_Function::On_afterExceptions_Semicolon(const char *)
521cdf0e10cSrcweir {
522cdf0e10cSrcweir     PerformFinishingPunctuation();
523cdf0e10cSrcweir }
524cdf0e10cSrcweir 
525cdf0e10cSrcweir void
On_afterExceptions_Comma(const char *)526cdf0e10cSrcweir PE_Function::On_afterExceptions_Comma(const char *)
527cdf0e10cSrcweir {
528cdf0e10cSrcweir     PerformFinishingPunctuation();
529cdf0e10cSrcweir }
530cdf0e10cSrcweir 
531cdf0e10cSrcweir void
On_afterExceptions_Colon(const char *)532cdf0e10cSrcweir PE_Function::On_afterExceptions_Colon(const char *)
533cdf0e10cSrcweir {
534cdf0e10cSrcweir     EnterImplementation(0);
535cdf0e10cSrcweir }
536cdf0e10cSrcweir 
537cdf0e10cSrcweir void
On_afterExceptions_Assign(const char *)538cdf0e10cSrcweir PE_Function::On_afterExceptions_Assign(const char *)
539cdf0e10cSrcweir {
540cdf0e10cSrcweir     SetTokenResult(done,stay);
541cdf0e10cSrcweir     pStati->SetCur(expectZero);
542cdf0e10cSrcweir }
543cdf0e10cSrcweir 
544cdf0e10cSrcweir void
On_expectZero_Constant(const char * i_sText)545cdf0e10cSrcweir PE_Function::On_expectZero_Constant(const char * i_sText)
546cdf0e10cSrcweir {
547cdf0e10cSrcweir     if ( strcmp(i_sText,"0") != 0 )
548cdf0e10cSrcweir         Hdl_SyntaxError(i_sText);
549cdf0e10cSrcweir 
550cdf0e10cSrcweir     SetTokenResult(done,stay);
551cdf0e10cSrcweir     pStati->SetCur(afterExceptions);
552cdf0e10cSrcweir 
553cdf0e10cSrcweir     eVirtuality = ary::cpp::VIRTUAL_abstract;
554cdf0e10cSrcweir }
555cdf0e10cSrcweir 
556cdf0e10cSrcweir void
On_inImplementation_SwBracket_Left(const char *)557cdf0e10cSrcweir PE_Function::On_inImplementation_SwBracket_Left(const char *)
558cdf0e10cSrcweir {
559cdf0e10cSrcweir     SetTokenResult(done,stay);
560cdf0e10cSrcweir     nBracketCounterInImplementation++;
561cdf0e10cSrcweir }
562cdf0e10cSrcweir 
563cdf0e10cSrcweir void
On_inImplementation_SwBracket_Right(const char *)564cdf0e10cSrcweir PE_Function::On_inImplementation_SwBracket_Right(const char *)
565cdf0e10cSrcweir {
566cdf0e10cSrcweir     nBracketCounterInImplementation--;
567cdf0e10cSrcweir     if (nBracketCounterInImplementation == 0)
568cdf0e10cSrcweir     {
569cdf0e10cSrcweir         SetTokenResult(done,pop_success);
570cdf0e10cSrcweir     }
571cdf0e10cSrcweir     else
572cdf0e10cSrcweir     {
573cdf0e10cSrcweir         SetTokenResult(done,stay);
574cdf0e10cSrcweir     }
575cdf0e10cSrcweir }
576cdf0e10cSrcweir 
577cdf0e10cSrcweir void
On_inImplementation_Default(const char *)578cdf0e10cSrcweir PE_Function::On_inImplementation_Default(const char *)
579cdf0e10cSrcweir {
580cdf0e10cSrcweir     SetTokenResult(done,stay);
581cdf0e10cSrcweir }
582cdf0e10cSrcweir 
583cdf0e10cSrcweir void
EnterImplementation(intt i_nBracketCountStart)584cdf0e10cSrcweir PE_Function::EnterImplementation( intt i_nBracketCountStart )
585cdf0e10cSrcweir {
586cdf0e10cSrcweir     SetTokenResult(done,stay);
587cdf0e10cSrcweir     pStati->SetCur(inImplementation);
588cdf0e10cSrcweir 
589cdf0e10cSrcweir     bResult_WithImplementation = true;
590cdf0e10cSrcweir     nBracketCounterInImplementation = i_nBracketCountStart;
591cdf0e10cSrcweir     if ( Env().Context().CurClass() != 0 )
592cdf0e10cSrcweir     {
593cdf0e10cSrcweir         aFlags.SetInline();
594cdf0e10cSrcweir     }
595cdf0e10cSrcweir }
596cdf0e10cSrcweir 
597cdf0e10cSrcweir 
598cdf0e10cSrcweir 
599cdf0e10cSrcweir }   // namespace cpp
600cdf0e10cSrcweir 
601cdf0e10cSrcweir 
602cdf0e10cSrcweir 
603cdf0e10cSrcweir 
604cdf0e10cSrcweir 
605