merge the formfield patch from ooo-build
[ooovba.git] / autodoc / source / parser / cpp / pe_vari.cxx
blob299dcfce3511ed1d42e99c9bf721e96be595b5b1
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_vari.cxx,v $
10 * $Revision: 1.9 $
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_vari.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <cosv/tpl/tpltools.hxx>
37 #include "pe_expr.hxx"
42 namespace cpp {
45 PE_Variable::PE_Variable( Cpp_PE * i_pParent )
46 : Cpp_PE(i_pParent),
47 pStati( new PeStatusArray<PE_Variable> )
48 // pSpExpression,
49 // pSpuArraySizeExpression,
50 // pSpuInitExpression,
51 // sResultSizeExpression,
52 // sResultInitExpression
54 Setup_StatusFunctions();
56 pSpExpression = new SP_Expression(*this);
58 pSpuArraySizeExpression = new SPU_Expression(*pSpExpression, 0, &PE_Variable::SpReturn_ArraySizeExpression);
59 pSpuInitExpression = new SPU_Expression(*pSpExpression, 0, &PE_Variable::SpReturn_InitExpression);
62 PE_Variable::~PE_Variable()
66 void
67 PE_Variable::Call_Handler( const cpp::Token & i_rTok )
69 pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text());
72 void
73 PE_Variable::Setup_StatusFunctions()
75 typedef CallFunction<PE_Variable>::F_Tok F_Tok;
77 static F_Tok stateF_afterName[] = { &PE_Variable::On_afterName_ArrayBracket_Left,
78 &PE_Variable::On_afterName_Semicolon,
79 &PE_Variable::On_afterName_Comma,
80 &PE_Variable::On_afterName_Assign };
81 static INT16 stateT_afterName[] = { Tid_ArrayBracket_Left,
82 Tid_Semicolon,
83 Tid_Comma,
84 Tid_Assign };
85 static F_Tok stateF_afterSize[] = { &PE_Variable::On_afterSize_ArrayBracket_Right };
86 static INT16 stateT_afterSize[] = { Tid_ArrayBracket_Right };
87 static F_Tok stateF_expectFinish[] = { &PE_Variable::On_expectFinish_Bracket_Right,
88 &PE_Variable::On_expectFinish_Semicolon,
89 &PE_Variable::On_expectFinish_Comma };
90 static INT16 stateT_expectFinish[] = { Tid_Bracket_Right,
91 Tid_Semicolon,
92 Tid_Comma };
94 SEMPARSE_CREATE_STATUS(PE_Variable, afterName, Hdl_SyntaxError);
95 SEMPARSE_CREATE_STATUS(PE_Variable, afterSize, Hdl_SyntaxError);
96 SEMPARSE_CREATE_STATUS(PE_Variable, expectFinish, Hdl_SyntaxError);
99 void
100 PE_Variable::InitData()
102 pStati->SetCur(afterName);
104 sResultSizeExpression.clear();
105 sResultInitExpression.clear();
108 void
109 PE_Variable::TransferData()
111 pStati->SetCur(size_of_states);
114 void
115 PE_Variable::Hdl_SyntaxError( const char * i_sText)
117 StdHandlingOfSyntaxError(i_sText);
120 void
121 PE_Variable::SpReturn_ArraySizeExpression()
123 pStati->SetCur(afterSize);
125 sResultSizeExpression = pSpuArraySizeExpression->Child().Result_Text();
128 void
129 PE_Variable::SpReturn_InitExpression()
131 pStati->SetCur(expectFinish);
133 sResultInitExpression = pSpuInitExpression->Child().Result_Text();
136 void
137 PE_Variable::On_afterName_ArrayBracket_Left(const char *)
139 pSpuArraySizeExpression->Push(done);
142 void
143 PE_Variable::On_afterName_Semicolon(const char *)
145 SetTokenResult(not_done, pop_success);
148 void
149 PE_Variable::On_afterName_Comma(const char *)
151 SetTokenResult(not_done, pop_success);
154 void
155 PE_Variable::On_afterName_Assign(const char *)
157 pSpuInitExpression->Push(done);
160 void
161 PE_Variable::On_afterSize_ArrayBracket_Right(const char *)
163 SetTokenResult(done, stay);
164 pStati->SetCur(afterName);
167 void
168 PE_Variable::On_expectFinish_Semicolon(const char *)
170 SetTokenResult(not_done, pop_success);
173 void
174 PE_Variable::On_expectFinish_Comma(const char *)
176 SetTokenResult(not_done, pop_success);
179 void
180 PE_Variable::On_expectFinish_Bracket_Right(const char *)
182 SetTokenResult(not_done, pop_success);
186 } // namespace cpp