Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <precomp.h>
21 : #include <s2_luidl/pe_vari2.hxx>
22 :
23 :
24 : // NOT FULLY DECLARED SERVICES
25 : #include <ary/idl/i_gate.hxx>
26 : #include <ary/idl/i_property.hxx>
27 : #include <ary/idl/ip_ce.hxx>
28 : #include <ary/doc/d_oldidldocu.hxx>
29 : #include <s2_luidl/pe_type2.hxx>
30 : #include <s2_luidl/tk_keyw.hxx>
31 : #include <s2_luidl/tk_ident.hxx>
32 : #include <s2_luidl/tk_punct.hxx>
33 :
34 :
35 : namespace csi
36 : {
37 : namespace uidl
38 : {
39 :
40 :
41 12 : PE_Variable::PE_Variable( ary::idl::Type_id & i_rResult_Type,
42 : String & i_rResult_Name )
43 : : eState(e_none),
44 : pResult_Type(&i_rResult_Type),
45 : pResult_Name(&i_rResult_Name),
46 12 : pPE_Type(0)
47 : {
48 12 : pPE_Type = new PE_Type(i_rResult_Type);
49 12 : }
50 :
51 : void
52 12 : PE_Variable::EstablishContacts( UnoIDL_PE * io_pParentPE,
53 : ary::Repository & io_rRepository,
54 : TokenProcessing_Result & o_rResult )
55 : {
56 12 : UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult);
57 12 : pPE_Type->EstablishContacts(this,io_rRepository,o_rResult);
58 12 : }
59 :
60 24 : PE_Variable::~PE_Variable()
61 : {
62 24 : }
63 :
64 : void
65 28211 : PE_Variable::ProcessToken( const Token & i_rToken )
66 : {
67 28211 : i_rToken.Trigger(*this);
68 28211 : }
69 :
70 :
71 : void
72 975 : PE_Variable::Process_Default()
73 : {
74 975 : if (eState == expect_type)
75 : {
76 975 : SetResult( not_done, push_sure, pPE_Type.Ptr() );
77 : }
78 : else{
79 : csv_assert(false);
80 : }
81 975 : }
82 :
83 : void
84 11795 : PE_Variable::Process_Identifier( const TokIdentifier & i_rToken )
85 : {
86 11795 : if (eState == expect_type)
87 : {
88 2458 : SetResult( not_done, push_sure, pPE_Type.Ptr() );
89 : }
90 9337 : else if (eState == expect_name)
91 : {
92 9337 : *pResult_Name = i_rToken.Text();
93 9337 : SetResult( done, stay );
94 9337 : eState = expect_finish;
95 : }
96 : else {
97 : csv_assert(false);
98 : }
99 11795 : }
100 :
101 : void
102 9337 : PE_Variable::Process_Punctuation( const TokPunctuation & )
103 : {
104 9337 : if (eState == expect_finish)
105 : {
106 9337 : SetResult( not_done, pop_success );
107 9337 : eState = e_none;
108 : }
109 0 : else if (eState == expect_name)
110 : {
111 0 : SetResult( not_done, pop_success );
112 0 : eState = e_none;
113 : }
114 : else {
115 : csv_assert(false);
116 : }
117 9337 : }
118 :
119 : void
120 5904 : PE_Variable::Process_BuiltInType( const TokBuiltInType & i_rToken )
121 : {
122 5904 : if (eState == expect_type)
123 : {
124 5904 : SetResult( not_done, push_sure, pPE_Type.Ptr() );
125 : }
126 0 : else if (eState == expect_name AND i_rToken.Id() == TokBuiltInType::bty_ellipse)
127 : {
128 0 : SetResult( not_done, pop_success );
129 0 : eState = e_none;
130 : }
131 : else {
132 : csv_assert(false);
133 : }
134 5904 : }
135 :
136 : void
137 9337 : PE_Variable::InitData()
138 : {
139 9337 : eState = expect_type;
140 :
141 9337 : *pResult_Type = 0;
142 9337 : *pResult_Name = "";
143 9337 : }
144 :
145 : void
146 9337 : PE_Variable::ReceiveData()
147 : {
148 9337 : eState = expect_name;
149 9337 : }
150 :
151 : void
152 9337 : PE_Variable::TransferData()
153 : {
154 9337 : eState = e_none;
155 9337 : }
156 :
157 : UnoIDL_PE &
158 200 : PE_Variable::MyPE()
159 : {
160 200 : return *this;
161 : }
162 :
163 : } // namespace uidl
164 3 : } // namespace csi
165 :
166 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|