2002-03-08 07:45:36 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 09:27:47 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2002-03-08 07:45:36 -06:00
|
|
|
*
|
2008-04-10 09:27:47 -05:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2002-03-08 07:45:36 -06:00
|
|
|
*
|
2008-04-10 09:27:47 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-03-08 07:45:36 -06:00
|
|
|
*
|
2008-04-10 09:27:47 -05:00
|
|
|
* $RCSfile: pe_tpltp.cxx,v $
|
|
|
|
* $Revision: 1.10 $
|
2002-03-08 07:45:36 -06:00
|
|
|
*
|
2008-04-10 09:27:47 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2002-03-08 07:45:36 -06:00
|
|
|
*
|
2008-04-10 09:27:47 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2002-03-08 07:45:36 -06:00
|
|
|
*
|
2008-04-10 09:27:47 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2002-03-08 07:45:36 -06:00
|
|
|
*
|
2008-04-10 09:27:47 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2002-03-08 07:45:36 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include <precomp.h>
|
|
|
|
#include "pe_tpltp.hxx"
|
|
|
|
|
|
|
|
|
|
|
|
// NOT FULLY DECLARED SERVICES
|
2007-11-02 10:57:02 -05:00
|
|
|
#include <cosv/tpl/tpltools.hxx>
|
2002-03-08 07:45:36 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace cpp {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PE_TemplateTop::PE_TemplateTop( Cpp_PE * i_pParent )
|
|
|
|
: Cpp_PE(i_pParent),
|
|
|
|
pStati( new PeStatusArray<PE_TemplateTop> ),
|
|
|
|
// aResult_Parameters,
|
|
|
|
bCurIsConstant(false)
|
|
|
|
{
|
|
|
|
Setup_StatusFunctions();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PE_TemplateTop::~PE_TemplateTop()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PE_TemplateTop::Call_Handler( const cpp::Token & i_rTok )
|
|
|
|
{
|
|
|
|
pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PE_TemplateTop::Setup_StatusFunctions()
|
|
|
|
{
|
|
|
|
typedef CallFunction<PE_TemplateTop>::F_Tok F_Tok;
|
|
|
|
|
2002-05-07 12:32:25 -05:00
|
|
|
static F_Tok stateF_start[] = { &PE_TemplateTop::On_start_Less };
|
2002-03-08 07:45:36 -06:00
|
|
|
static INT16 stateT_start[] = { Tid_Less };
|
|
|
|
|
2005-01-27 04:25:04 -06:00
|
|
|
static F_Tok stateF_expect_qualifier[]= { &PE_TemplateTop::On_expect_qualifier_ClassOrTypename,
|
2007-11-02 10:57:02 -05:00
|
|
|
&PE_TemplateTop::On_expect_qualifier_Greater,
|
2005-01-27 04:25:04 -06:00
|
|
|
&PE_TemplateTop::On_expect_qualifier_ClassOrTypename };
|
|
|
|
static INT16 stateT_expect_qualifier[]= { Tid_class,
|
2007-11-02 10:57:02 -05:00
|
|
|
Tid_Greater,
|
2005-01-27 04:25:04 -06:00
|
|
|
Tid_typename };
|
2002-03-08 07:45:36 -06:00
|
|
|
|
2002-05-07 12:32:25 -05:00
|
|
|
static F_Tok stateF_expect_name[] = { &PE_TemplateTop::On_expect_name_Identifier };
|
2002-03-08 07:45:36 -06:00
|
|
|
static INT16 stateT_expect_name[] = { Tid_Identifier };
|
|
|
|
|
2002-05-07 12:32:25 -05:00
|
|
|
static F_Tok stateF_expect_separator[]= { &PE_TemplateTop::On_expect_separator_Comma,
|
|
|
|
&PE_TemplateTop::On_expect_separator_Greater };
|
2002-03-08 07:45:36 -06:00
|
|
|
static INT16 stateT_expect_separator[]= { Tid_Comma,
|
|
|
|
Tid_Greater };
|
|
|
|
|
|
|
|
SEMPARSE_CREATE_STATUS(PE_TemplateTop, start, Hdl_SyntaxError);
|
|
|
|
SEMPARSE_CREATE_STATUS(PE_TemplateTop, expect_qualifier, On_expect_qualifier_Other);
|
|
|
|
SEMPARSE_CREATE_STATUS(PE_TemplateTop, expect_name, Hdl_SyntaxError);
|
|
|
|
SEMPARSE_CREATE_STATUS(PE_TemplateTop, expect_separator, Hdl_SyntaxError);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PE_TemplateTop::InitData()
|
|
|
|
{
|
|
|
|
pStati->SetCur(start);
|
|
|
|
csv::erase_container(aResult_Parameters);
|
|
|
|
bCurIsConstant = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PE_TemplateTop::TransferData()
|
|
|
|
{
|
|
|
|
pStati->SetCur(size_of_states);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PE_TemplateTop::Hdl_SyntaxError(const char * i_sText)
|
|
|
|
{
|
|
|
|
StdHandlingOfSyntaxError(i_sText);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PE_TemplateTop::On_start_Less( const char *)
|
|
|
|
{
|
|
|
|
SetTokenResult(done, stay);
|
|
|
|
pStati->SetCur(expect_qualifier);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2005-01-27 04:25:04 -06:00
|
|
|
PE_TemplateTop::On_expect_qualifier_ClassOrTypename( const char *)
|
2002-03-08 07:45:36 -06:00
|
|
|
{
|
|
|
|
SetTokenResult(done, stay);
|
|
|
|
pStati->SetCur(expect_name);
|
|
|
|
}
|
|
|
|
|
2007-11-02 10:57:02 -05:00
|
|
|
void
|
|
|
|
PE_TemplateTop::On_expect_qualifier_Greater(const char *)
|
|
|
|
{
|
|
|
|
SetTokenResult(done, pop_success);
|
|
|
|
}
|
|
|
|
|
2002-03-08 07:45:36 -06:00
|
|
|
void
|
|
|
|
PE_TemplateTop::On_expect_qualifier_Other( const char *)
|
|
|
|
{
|
|
|
|
SetTokenResult(done, stay);
|
|
|
|
pStati->SetCur(expect_name);
|
|
|
|
|
|
|
|
bCurIsConstant = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PE_TemplateTop::On_expect_name_Identifier( const char * i_sText)
|
|
|
|
{
|
|
|
|
SetTokenResult(done, stay);
|
|
|
|
pStati->SetCur(expect_separator);
|
|
|
|
|
2006-06-19 06:05:10 -05:00
|
|
|
StreamLock sl(50);
|
2002-03-08 07:45:36 -06:00
|
|
|
if ( NOT bCurIsConstant )
|
|
|
|
{
|
2006-06-19 06:05:10 -05:00
|
|
|
String sText( sl() << "typename " << i_sText << c_str );
|
2002-03-08 07:45:36 -06:00
|
|
|
aResult_Parameters.push_back(sText);
|
|
|
|
}
|
|
|
|
else //
|
|
|
|
{
|
2006-06-19 06:05:10 -05:00
|
|
|
String sText( sl() << "constant " << i_sText << c_str );
|
2002-03-08 07:45:36 -06:00
|
|
|
aResult_Parameters.push_back(sText);
|
|
|
|
bCurIsConstant = false;
|
|
|
|
} // endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PE_TemplateTop::On_expect_separator_Comma( const char *)
|
|
|
|
{
|
|
|
|
SetTokenResult(done, stay);
|
|
|
|
pStati->SetCur(expect_qualifier);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PE_TemplateTop::On_expect_separator_Greater( const char *)
|
|
|
|
{
|
|
|
|
SetTokenResult(done, pop_success);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-02 10:57:02 -05:00
|
|
|
|
|
|
|
|
2002-03-08 07:45:36 -06:00
|
|
|
} // namespace cpp
|