Update ooo320-m1
[ooovba.git] / autodoc / source / parser / cpp / pe_enval.cxx
blob2f70d3325a7640e403d9b118b7b962a19d9d867e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pe_enval.cxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <precomp.h>
32 #include "pe_enval.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <cosv/tpl/tpltools.hxx>
37 #include <ary/cpp/c_gate.hxx>
38 #include <ary/cpp/cp_ce.hxx>
39 #include "pe_expr.hxx"
43 namespace cpp {
46 PE_EnumValue::PE_EnumValue( Cpp_PE * i_pParent )
47 : Cpp_PE(i_pParent),
48 pStati( new PeStatusArray<PE_EnumValue> )
49 // pSpExpression,
50 // pSpuInitExpression
52 Setup_StatusFunctions();
54 pSpExpression = new SP_Expression(*this);
55 pSpuInitExpression = new SPU_Expression(*pSpExpression, 0, &PE_EnumValue::SpReturn_InitExpression);
58 PE_EnumValue::~PE_EnumValue()
62 void
63 PE_EnumValue::Call_Handler( const cpp::Token & i_rTok )
65 pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text());
68 void
69 PE_EnumValue::Setup_StatusFunctions()
71 typedef CallFunction<PE_EnumValue>::F_Tok F_Tok;
73 static F_Tok stateF_start[] = { &PE_EnumValue::On_start_Identifier };
74 static INT16 stateT_start[] = { Tid_Identifier };
76 static F_Tok stateF_afterName[] = { &PE_EnumValue::On_afterName_SwBracket_Right,
77 &PE_EnumValue::On_afterName_Comma,
78 &PE_EnumValue::On_afterName_Assign };
79 static INT16 stateT_afterName[] = { Tid_SwBracket_Right,
80 Tid_Comma,
81 Tid_Assign };
83 static F_Tok stateF_expectFinish[] = { &PE_EnumValue::On_expectFinish_SwBracket_Right,
84 &PE_EnumValue::On_expectFinish_Comma };
85 static INT16 stateT_expectFinish[] = { Tid_SwBracket_Right,
86 Tid_Comma };
88 SEMPARSE_CREATE_STATUS(PE_EnumValue, start, Hdl_SyntaxError);
89 SEMPARSE_CREATE_STATUS(PE_EnumValue, afterName, Hdl_SyntaxError);
90 SEMPARSE_CREATE_STATUS(PE_EnumValue, expectFinish, Hdl_SyntaxError);
93 void
94 PE_EnumValue::InitData()
96 pStati->SetCur(start);
98 sName.clear();
99 sInitExpression.clear();
102 void
103 PE_EnumValue::TransferData()
105 pStati->SetCur(size_of_states);
107 ary::cpp::EnumValue &
108 rEnVal = Env().AryGate().Ces().Store_EnumValue(
109 Env().Context(), sName, sInitExpression );
110 Env().Event_Store_EnumValue(rEnVal);
113 void
114 PE_EnumValue::Hdl_SyntaxError( const char * i_sText)
116 StdHandlingOfSyntaxError(i_sText);
119 void
120 PE_EnumValue::SpReturn_InitExpression()
122 pStati->SetCur(expectFinish);
124 sInitExpression = pSpuInitExpression->Child().Result_Text();
127 void
128 PE_EnumValue::On_start_Identifier(const char * i_sText)
130 SetTokenResult(done, stay);
131 pStati->SetCur(afterName);
133 sName = i_sText;
136 void
137 PE_EnumValue::On_afterName_SwBracket_Right(const char *)
139 SetTokenResult(not_done, pop_success);
142 void
143 PE_EnumValue::On_afterName_Comma(const char * )
145 SetTokenResult(done, pop_success);
148 void
149 PE_EnumValue::On_afterName_Assign(const char * )
151 pSpuInitExpression->Push(done);
154 void
155 PE_EnumValue::On_expectFinish_SwBracket_Right(const char * )
157 SetTokenResult(not_done, pop_success);
160 void
161 PE_EnumValue::On_expectFinish_Comma(const char * )
163 SetTokenResult(done, pop_success);
167 } // namespace cpp