1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pe_evalu.cxx,v $
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 ************************************************************************/
32 #include <s2_luidl/pe_evalu.hxx>
34 // NOT FULLY DECLARED SERVICES
35 #include <ary/idl/i_enumvalue.hxx>
36 #include <ary/idl/i_gate.hxx>
37 #include <ary/idl/ip_ce.hxx>
38 #include <ary/doc/d_oldidldocu.hxx>
39 #include <s2_luidl/tk_ident.hxx>
40 #include <s2_luidl/tk_punct.hxx>
41 #include <s2_luidl/tk_const.hxx>
53 #define DF &PE_Value::On_Default
56 PE_Value::aDispatcher
[PE_Value::e_STATES_MAX
][PE_Value::tt_MAX
] =
57 { { DF
, DF
, DF
}, // e_none
58 { &PE_Value::On_expect_name_Identifier
,
59 DF
, DF
}, // expect_name
60 { DF
, &PE_Value::On_got_name_Punctuation
,
61 &PE_Value::On_got_name_Assignment
} // got_name
67 PE_Value::CallHandler( const char * i_sTokenText
,
68 E_TokenType i_eTokenType
)
69 { (this->*aDispatcher
[eState
][i_eTokenType
])(i_sTokenText
); }
75 PE_Value::PE_Value( String
& o_rName
,
76 String
& o_rAssignment
,
80 pAssignment(&o_rAssignment
),
86 PE_Value::EstablishContacts( UnoIDL_PE
* io_pParentPE
,
87 ary::Repository
& io_rRepository
,
88 TokenProcessing_Result
& o_rResult
)
90 UnoIDL_PE::EstablishContacts(io_pParentPE
,io_rRepository
,o_rResult
);
98 PE_Value::ProcessToken( const Token
& i_rToken
)
100 i_rToken
.Trigger(*this);
104 PE_Value::Process_Identifier( const TokIdentifier
& i_rToken
)
106 CallHandler(i_rToken
.Text(), tt_identifier
);
110 PE_Value::Process_Punctuation( const TokPunctuation
& i_rToken
)
112 CallHandler(i_rToken
.Text(), tt_punctuation
);
116 PE_Value::Process_Assignment( const TokAssignment
& i_rToken
)
118 CallHandler(i_rToken
.Text(), tt_assignment
);
122 PE_Value::On_expect_name_Identifier(const char * i_sText
)
125 SetResult(done
,stay
);
130 PE_Value::On_got_name_Punctuation(const char * i_sText
)
132 if ( (i_sText
[0] == ',' AND NOT
IsConst())
133 OR (i_sText
[0] == ';' AND
IsConst()) )
135 SetResult(done
,pop_success
);
138 else if (i_sText
[0] == '}' AND NOT
IsConst())
140 SetResult(not_done
,pop_success
);
148 PE_Value::On_got_name_Assignment(const char * i_sText
)
150 *pAssignment
= i_sText
;
151 SetResult(done
,pop_success
);
156 PE_Value::On_Default(const char * )
158 SetResult(not_done
,pop_failure
);
164 eState
= expect_name
;
171 PE_Value::TransferData()
173 csv_assert(pName
->length() > 0);