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_tpltp.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 "pe_tpltp.hxx"
35 // NOT FULLY DECLARED SERVICES
36 #include <cosv/tpl/tpltools.hxx>
44 PE_TemplateTop::PE_TemplateTop( Cpp_PE
* i_pParent
)
46 pStati( new PeStatusArray
<PE_TemplateTop
> ),
47 // aResult_Parameters,
50 Setup_StatusFunctions();
54 PE_TemplateTop::~PE_TemplateTop()
59 PE_TemplateTop::Call_Handler( const cpp::Token
& i_rTok
)
61 pStati
->Cur().Call_Handler(i_rTok
.TypeId(), i_rTok
.Text());
65 PE_TemplateTop::Setup_StatusFunctions()
67 typedef CallFunction
<PE_TemplateTop
>::F_Tok F_Tok
;
69 static F_Tok stateF_start
[] = { &PE_TemplateTop::On_start_Less
};
70 static INT16 stateT_start
[] = { Tid_Less
};
72 static F_Tok stateF_expect_qualifier
[]= { &PE_TemplateTop::On_expect_qualifier_ClassOrTypename
,
73 &PE_TemplateTop::On_expect_qualifier_Greater
,
74 &PE_TemplateTop::On_expect_qualifier_ClassOrTypename
};
75 static INT16 stateT_expect_qualifier
[]= { Tid_class
,
79 static F_Tok stateF_expect_name
[] = { &PE_TemplateTop::On_expect_name_Identifier
};
80 static INT16 stateT_expect_name
[] = { Tid_Identifier
};
82 static F_Tok stateF_expect_separator
[]= { &PE_TemplateTop::On_expect_separator_Comma
,
83 &PE_TemplateTop::On_expect_separator_Greater
};
84 static INT16 stateT_expect_separator
[]= { Tid_Comma
,
87 SEMPARSE_CREATE_STATUS(PE_TemplateTop
, start
, Hdl_SyntaxError
);
88 SEMPARSE_CREATE_STATUS(PE_TemplateTop
, expect_qualifier
, On_expect_qualifier_Other
);
89 SEMPARSE_CREATE_STATUS(PE_TemplateTop
, expect_name
, Hdl_SyntaxError
);
90 SEMPARSE_CREATE_STATUS(PE_TemplateTop
, expect_separator
, Hdl_SyntaxError
);
94 PE_TemplateTop::InitData()
96 pStati
->SetCur(start
);
97 csv::erase_container(aResult_Parameters
);
98 bCurIsConstant
= false;
102 PE_TemplateTop::TransferData()
104 pStati
->SetCur(size_of_states
);
108 PE_TemplateTop::Hdl_SyntaxError(const char * i_sText
)
110 StdHandlingOfSyntaxError(i_sText
);
114 PE_TemplateTop::On_start_Less( const char *)
116 SetTokenResult(done
, stay
);
117 pStati
->SetCur(expect_qualifier
);
121 PE_TemplateTop::On_expect_qualifier_ClassOrTypename( const char *)
123 SetTokenResult(done
, stay
);
124 pStati
->SetCur(expect_name
);
128 PE_TemplateTop::On_expect_qualifier_Greater(const char *)
130 SetTokenResult(done
, pop_success
);
134 PE_TemplateTop::On_expect_qualifier_Other( const char *)
136 SetTokenResult(done
, stay
);
137 pStati
->SetCur(expect_name
);
139 bCurIsConstant
= true;
143 PE_TemplateTop::On_expect_name_Identifier( const char * i_sText
)
145 SetTokenResult(done
, stay
);
146 pStati
->SetCur(expect_separator
);
149 if ( NOT bCurIsConstant
)
151 String
sText( sl() << "typename " << i_sText
<< c_str
);
152 aResult_Parameters
.push_back(sText
);
156 String
sText( sl() << "constant " << i_sText
<< c_str
);
157 aResult_Parameters
.push_back(sText
);
158 bCurIsConstant
= false;
163 PE_TemplateTop::On_expect_separator_Comma( const char *)
165 SetTokenResult(done
, stay
);
166 pStati
->SetCur(expect_qualifier
);
170 PE_TemplateTop::On_expect_separator_Greater( const char *)
172 SetTokenResult(done
, pop_success
);