diff options
author | Nikolai Pretzell <np@openoffice.org> | 2002-03-08 13:45:36 +0000 |
---|---|---|
committer | Nikolai Pretzell <np@openoffice.org> | 2002-03-08 13:45:36 +0000 |
commit | d566f38f8a38739595fd8edb89eaa48c1c4b8f9b (patch) | |
tree | cbf47b13e83d60334fcd68872bd4c26791a39a0e /autodoc/source/parser | |
parent | 1710683406e72de5458733231636e8fdb2c2c0bc (diff) |
Moving Autodoc to OpenOffice.org, module autodoc: sourcecode repository and documentation generator
Diffstat (limited to 'autodoc/source/parser')
119 files changed, 22744 insertions, 0 deletions
diff --git a/autodoc/source/parser/adoc/a_rdocu.cxx b/autodoc/source/parser/adoc/a_rdocu.cxx new file mode 100644 index 000000000000..13965b1172fe --- /dev/null +++ b/autodoc/source/parser/adoc/a_rdocu.cxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * $RCSfile: a_rdocu.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <adoc/a_rdocu.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <adoc/docu_pe.hxx> +#include <adoc/adoc_tok.hxx> +#include <ary/docu.hxx> +#include <doc_deal.hxx> + + + +namespace adoc +{ + + +DocuExplorer::DocuExplorer() + : pDocuDistributor(0), + pPE(new Adoc_PE), + bIsPassedFirstDocu(false) +{ +} + +DocuExplorer::~DocuExplorer() +{ +} + +void +DocuExplorer::StartNewFile( DocuDealer & o_rDocuDistributor ) +{ + pDocuDistributor = &o_rDocuDistributor; + bIsPassedFirstDocu = false; +} + + +void +DocuExplorer::Process_Token( DYN adoc::Token & let_drToken ) +{ + csv_assert(pDocuDistributor != 0); + + let_drToken.Trigger(*pPE); + if ( pPE->IsComplete() ) + { + ary::Documentation * pDocu = pPE->ReleaseJustParsedDocu(); + if ( pDocu != 0 ) + { + if (bIsPassedFirstDocu) + pDocuDistributor->TakeDocu( *pDocu ); + else + { + delete pDocu; + bIsPassedFirstDocu = true; + } + } + } + + delete &let_drToken; +} + + +} // namespace adoc + diff --git a/autodoc/source/parser/adoc/adoc_tok.cxx b/autodoc/source/parser/adoc/adoc_tok.cxx new file mode 100644 index 000000000000..cb27c7b3c2ab --- /dev/null +++ b/autodoc/source/parser/adoc/adoc_tok.cxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * $RCSfile: adoc_tok.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <adoc/adoc_tok.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <adoc/atokdeal.hxx> + + +namespace adoc { + +void +Token::DealOut( ::TokenDealer & o_rDealer ) +{ + dynamic_cast< adoc::TokenDealer& >(o_rDealer).Deal_AdcDocu(*this); +} + + +} // namespace adoc + diff --git a/autodoc/source/parser/adoc/cx_a_std.cxx b/autodoc/source/parser/adoc/cx_a_std.cxx new file mode 100644 index 000000000000..c6fbf996ee0b --- /dev/null +++ b/autodoc/source/parser/adoc/cx_a_std.cxx @@ -0,0 +1,547 @@ +/************************************************************************* + * + * $RCSfile: cx_a_std.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include <adoc/cx_a_std.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <adoc/cx_a_sub.hxx> +#include <x_parse.hxx> +#include <tools/tkpchars.hxx> +#include <adoc/tk_attag.hxx> +#include <adoc/tk_docw.hxx> +#include <tokens/tokdeal.hxx> + + + +namespace adoc { + + +const intt C_nStatusSize = 128; +const intt C_nCppInitialNrOfStati = 400; + + +const uintt nF_fin_Error = 1; +const uintt nF_fin_Ignore = 2; +const uintt nF_fin_LineStart = 3; +const uintt nF_fin_Eol = 4; +const uintt nF_fin_Eof = 5; +const uintt nF_fin_AnyWord = 6; +const uintt nF_fin_Whitespace = 7; + +const uintt nF_goto_AtTag = 20; +const uintt nF_goto_CheckStar = 21; + +DYN TextToken * TCF_DocWord(const char * text) { return new Tok_DocWord(text); } + +DYN TextToken * TCF_atstd_ATT(const char * text) { return new Tok_at_std(ary::info::atid_ATT); } +DYN TextToken * TCF_atstd_author(const char * text) { return new Tok_at_std(ary::info::atid_author); } +DYN TextToken * TCF_atstd_change(const char * text) { return new Tok_at_std(ary::info::atid_change); } +DYN TextToken * TCF_atstd_collab(const char * text) { return new Tok_at_std(ary::info::atid_collab); } +DYN TextToken * TCF_atstd_contact(const char * text) { return new Tok_at_std(ary::info::atid_contact); } +DYN TextToken * TCF_atstd_copyright(const char * text) { return new Tok_at_std(ary::info::atid_copyright); } +DYN TextToken * TCF_atstd_descr(const char * text) { return new Tok_at_std(ary::info::atid_descr); } +DYN TextToken * TCF_atstd_docdate(const char * text) { return new Tok_at_std(ary::info::atid_docdate); } +DYN TextToken * TCF_atstd_derive(const char * text) { return new Tok_at_std(ary::info::atid_derive); } +DYN TextToken * TCF_atstd_instance(const char * text) { return new Tok_at_std(ary::info::atid_instance); } +DYN TextToken * TCF_atstd_life(const char * text) { return new Tok_at_std(ary::info::atid_life); } +DYN TextToken * TCF_atstd_multi(const char * text) { return new Tok_at_std(ary::info::atid_multi); } +DYN TextToken * TCF_atstd_onerror(const char * text) { return new Tok_at_std(ary::info::atid_onerror); } +DYN TextToken * TCF_atstd_persist(const char * text) { return new Tok_at_std(ary::info::atid_persist); } +DYN TextToken * TCF_atstd_postcond(const char * text) { return new Tok_at_std(ary::info::atid_postcond); } +DYN TextToken * TCF_atstd_precond(const char * text) { return new Tok_at_std(ary::info::atid_precond); } +DYN TextToken * TCF_atstd_responsibility(const char * text) { return new Tok_at_std(ary::info::atid_resp); } +DYN TextToken * TCF_atstd_return(const char * text) { return new Tok_at_std(ary::info::atid_return); } +DYN TextToken * TCF_atstd_short(const char * text) { return new Tok_at_std(ary::info::atid_short); } +DYN TextToken * TCF_atstd_todo(const char * text) { return new Tok_at_std(ary::info::atid_todo); } +DYN TextToken * TCF_atstd_version(const char * text) { return new Tok_at_std(ary::info::atid_version); } + +DYN TextToken * TCF_at_base(const char *) { return new Tok_at_base; } +DYN TextToken * TCF_at_exception(const char *) { return new Tok_at_exception; } +DYN TextToken * TCF_at_impl(const char *) { return new Tok_at_impl; } +DYN TextToken * TCF_at_interface(const char *) { return new Tok_at_interface; } +DYN TextToken * TCF_at_key(const char *) { return new Tok_at_key; } +DYN TextToken * TCF_at_param(const char *) { return new Tok_at_param; } +DYN TextToken * TCF_at_see(const char *) { return new Tok_at_see; } +DYN TextToken * TCF_at_template(const char *) { return new Tok_at_template; } +DYN TextToken * TCF_at_internal(const char *) { return new Tok_at_internal; } +DYN TextToken * TCF_at_obsolete(const char *) { return new Tok_at_obsolete; } +DYN TextToken * TCF_at_module(const char *) { return new Tok_at_module; } +DYN TextToken * TCF_at_file(const char *) { return new Tok_at_file; } +DYN TextToken * TCF_at_gloss(const char *) { return new Tok_at_gloss; } +DYN TextToken * TCF_at_global(const char *) { return new Tok_at_global; } +DYN TextToken * TCF_at_include(const char *) { return new Tok_at_include; } +DYN TextToken * TCF_at_label(const char *) { return new Tok_at_label; } +DYN TextToken * TCF_at_HTML(const char *) { return new Tok_at_HTML; } +DYN TextToken * TCF_at_NOHTML(const char *) { return new Tok_at_NOHTML; } +DYN TextToken * TCF_Whitespace(const char * i_sText); +DYN TextToken * TCF_EoDocu(const char *) { return new Tok_EoDocu; } +DYN TextToken * TCF_EoLine(const char *) { return new Tok_Eol; } +DYN TextToken * TCF_Eof(const char *) { return new Tok_Eof; } + + + + +Context_AdocStd::Context_AdocStd() + : aStateMachine(C_nStatusSize, C_nCppInitialNrOfStati), + pDealer(0), + pParentContext(0), + pFollowUpContext(0), + pCx_LineStart(0), + pCx_CheckStar(0), + pCx_AtTagCompletion(0), + pNewToken(0), + bIsMultiline(false) +{ + pCx_LineStart = new Cx_LineStart(*this); + pCx_CheckStar = new Cx_CheckStar(*this); + pCx_AtTagCompletion = new Cx_AtTagCompletion(*this); + + SetupStateMachine(); +} + +void +Context_AdocStd::SetParentContext( TkpContext & io_rParentContext, + const char * i_sMultiLineEndToken ) +{ + pFollowUpContext = pParentContext = &io_rParentContext; + pCx_CheckStar->Set_End_FollowUpContext(io_rParentContext); +} + +Context_AdocStd::~Context_AdocStd() +{ +} + +void +Context_AdocStd::AssignDealer( TokenDealer & o_rDealer ) +{ + pDealer = &o_rDealer; + pCx_LineStart->AssignDealer(o_rDealer); + pCx_CheckStar->AssignDealer(o_rDealer); + pCx_AtTagCompletion->AssignDealer(o_rDealer); +} + +void +Context_AdocStd::ReadCharChain( CharacterSource & io_rText ) +{ + csv_assert(pParentContext != 0); + pNewToken = 0; + + TextToken::F_CRTOK fTokenCreateFunction = 0; + StmBoundsStatus & rBound = aStateMachine.GetCharChain(fTokenCreateFunction, io_rText); + + // !!! + // The order of the next two lines is essential, because + // pFollowUpContext may be changed by PerformStatusFunction() also, + // which then MUST override the previous assignment. + pFollowUpContext = rBound.FollowUpContext(); + PerformStatusFunction(rBound.StatusFunctionNr(), fTokenCreateFunction, io_rText); +} + +bool +Context_AdocStd::PassNewToken() +{ + if (pNewToken) + { + pNewToken.Release()->DealOut(*pDealer); + return true; + } + return false; +} + +TkpContext & +Context_AdocStd::FollowUpContext() +{ + csv_assert(pFollowUpContext != 0); + return *pFollowUpContext; +} + +void +Context_AdocStd::PerformStatusFunction( uintt i_nStatusSignal, + F_CRTOK i_fTokenCreateFunction, + CharacterSource & io_rText ) +{ + switch (i_nStatusSignal) + { + case nF_fin_Error: + { + udmstri sChar( &io_rText.CurChar(), 1 ); + throw X_Parser(X_Parser::x_InvalidChar, sChar, udmstri::Null_(), 0); + } break; + case nF_fin_Ignore: + io_rText.CutToken(); + pNewToken = 0; + break; + case nF_fin_LineStart: + csv_assert(i_fTokenCreateFunction != 0); + pNewToken = (*i_fTokenCreateFunction)(io_rText.CutToken()); + break; + case nF_fin_Eol: + io_rText.CutToken(); + pDealer->Deal_Eol(); + if ( bIsMultiline ) + { + pNewToken = TCF_EoLine(0); + pFollowUpContext = pCx_LineStart.Ptr(); + } + else + { + pNewToken = TCF_EoDocu(0); + pFollowUpContext = pParentContext; + } + break; + case nF_fin_Eof: + pNewToken = TCF_Eof(0); + break; + case nF_fin_AnyWord: + if (i_fTokenCreateFunction != 0) + pNewToken = (*i_fTokenCreateFunction)(io_rText.CutToken()); + else + pNewToken = TCF_DocWord(io_rText.CutToken()); + break; + case nF_fin_Whitespace: + pNewToken = TCF_Whitespace(io_rText.CutToken()); + break; + case nF_goto_AtTag: + pNewToken = 0; + pCx_AtTagCompletion->SetCurToken(i_fTokenCreateFunction); + break; + case nF_goto_CheckStar: + pNewToken = 0; + pCx_CheckStar->SetCanBeEnd( bIsMultiline ); + break; + default: + { + udmstri sChar( &io_rText.CurChar(), 1 ); + throw X_Parser(X_Parser::x_InvalidChar, sChar, udmstri::Null_(), 0); + } + } // end switch (i_nStatusSignal) +} + +void +Context_AdocStd::SetupStateMachine() +{ + // Besondere Array-Stati (kein Tokenabschluss oder Kontextwechsel): + const INT16 bas = 0; // Base-Status + const INT16 wht = 1; // Whitespace-Status + const INT16 awd = 2; // Any-Word-Read-Status + + // Kontextwechsel-Stati: + const INT16 goto_CheckStar = 3; + const INT16 goto_AtTag = 4; + + // Tokenfinish-Stati: + const INT16 finError = 5; + const INT16 finIgnore = 6; + const INT16 finEol = 7; + const INT16 finEof = 8; + const INT16 finAnyWord = 9; + const INT16 finWhitespace = 10; + + // Konstanten zur Benutzung in der Tabelle: + const INT16 fof = finEof; + const INT16 err = finError; + const INT16 faw = finAnyWord; + const INT16 fig = finIgnore; + const INT16 fwh = finWhitespace; + + /// The '0's will be replaced by calls of AddToken(). + + const INT16 A_nTopStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht, 0,wht,wht, 0,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // ... 31 + wht,awd,awd,awd,awd,awd,awd,awd,awd,awd, 0,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 63 + 0,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd // ... 127 + }; + + const INT16 A_nWhitespaceStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht,fwh,wht,wht,fwh,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // ... 31 + wht,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, // ... 63 + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, // ... 95 + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh // ... 127 + }; + + const INT16 A_nWordStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {faw,err,err,err,err,err,err,err,err,faw,faw,faw,faw,faw,err,err, + err,err,err,err,err,err,err,err,err,err,faw,err,err,err,err,err, // ... 31 + faw,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 63 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd // ... 127 + }; + + const INT16 A_nAtTagDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {faw,err,err,err,err,err,err,err,err,faw,faw,faw,faw,faw,err,err, + err,err,err,err,err,err,err,err,err,err,faw,err,err,err,err,err, // ... 31 + faw,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 63 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd // ... 127 + }; + + const INT16 A_nPunctDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 16 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 48 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 80 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err // 112 ... + }; + + DYN StmArrayStatus * dpStatusTop + = new StmArrayStatus( C_nStatusSize, A_nTopStatus, 0, true); + DYN StmArrayStatus * dpStatusWhite + = new StmArrayStatus( C_nStatusSize, A_nWhitespaceStatus, 0, true); + DYN StmArrayStatus * dpStatusWord + = new StmArrayStatus( C_nStatusSize, A_nWordStatus, TCF_DocWord, true); + + DYN StmBoundsStatus * dpBst_goto_CheckStar + = new StmBoundsStatus( *this, *pCx_CheckStar, nF_goto_CheckStar, true ); + DYN StmBoundsStatus * dpBst_goto_AtTag + = new StmBoundsStatus( *this, *pCx_AtTagCompletion, nF_goto_AtTag, true ); + + DYN StmBoundsStatus * dpBst_finError + = new StmBoundsStatus( *this, TkpContext::Null_(), nF_fin_Error, true ); + DYN StmBoundsStatus * dpBst_finIgnore + = new StmBoundsStatus( *this, *this, nF_fin_Ignore, true); + DYN StmBoundsStatus * dpBst_finEol + = new StmBoundsStatus( *this, *pCx_LineStart, nF_fin_Eol, false); + DYN StmBoundsStatus * dpBst_finEof + = new StmBoundsStatus( *this, TkpContext::Null_(), nF_fin_Eof, false); + DYN StmBoundsStatus * dpBst_finAnyWord + = new StmBoundsStatus( *this, *this, nF_fin_AnyWord, true); + DYN StmBoundsStatus * dpBst_finWhitespace + = new StmBoundsStatus( *this, *this, nF_fin_Whitespace, true); + + // dpMain aufbauen: + aStateMachine.AddStatus(dpStatusTop); + aStateMachine.AddStatus(dpStatusWhite); + aStateMachine.AddStatus(dpStatusWord); + + aStateMachine.AddStatus(dpBst_goto_CheckStar); + aStateMachine.AddStatus(dpBst_goto_AtTag); + + aStateMachine.AddStatus(dpBst_finError); + aStateMachine.AddStatus(dpBst_finIgnore); + aStateMachine.AddStatus(dpBst_finEol); + aStateMachine.AddStatus(dpBst_finEof); + aStateMachine.AddStatus(dpBst_finAnyWord); + aStateMachine.AddStatus(dpBst_finWhitespace); + + aStateMachine.AddToken( "*", 0, A_nPunctDefStatus, goto_CheckStar ); + aStateMachine.AddToken( "@ATT", TCF_atstd_ATT, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@att", TCF_atstd_ATT, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@ATTENTION", + TCF_atstd_ATT, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@attention", + TCF_atstd_ATT, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@author", TCF_atstd_author, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@change", TCF_atstd_change, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@collab", TCF_atstd_collab, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@collaborator", + TCF_atstd_collab, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@contact", TCF_atstd_contact, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@copyright",TCF_atstd_copyright, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@descr", TCF_atstd_descr, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@docdate", TCF_atstd_docdate, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@derive", TCF_atstd_derive, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@instance",TCF_atstd_instance, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@life", TCF_atstd_life, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@lifecycle", + TCF_atstd_life, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@multi", TCF_atstd_multi, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@multiplicity", + TCF_atstd_multi, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@onerror", TCF_atstd_onerror, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@persist", TCF_atstd_persist, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@postcond",TCF_atstd_postcond,A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@precond", TCF_atstd_precond, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@resp", TCF_atstd_responsibility, + A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@responsibility", + TCF_atstd_return, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@return", TCF_atstd_return, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@short", TCF_atstd_short, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@todo", TCF_atstd_todo, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@version", TCF_atstd_version, A_nAtTagDefStatus, goto_AtTag ); + + aStateMachine.AddToken( "@base", TCF_at_base, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@exception",TCF_at_exception, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@impl", TCF_at_impl, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@key", TCF_at_key, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@param", TCF_at_param, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@see", TCF_at_see, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@seealso", TCF_at_see, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@tpl", TCF_at_template, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@tplparam", + TCF_at_template, A_nAtTagDefStatus, goto_AtTag ); + + aStateMachine.AddToken( "@interface",TCF_at_interface, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@internal",TCF_at_internal, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@obsolete",TCF_at_obsolete, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@deprecated",TCF_at_obsolete, A_nAtTagDefStatus, goto_AtTag ); + + aStateMachine.AddToken( "@module", TCF_at_module, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@file", TCF_at_file, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@gloss", TCF_at_gloss, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@global#", TCF_at_global, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@include#",TCF_at_include, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@#", TCF_at_label, A_nAtTagDefStatus, goto_AtTag ); + + aStateMachine.AddToken( "@HTML", TCF_at_HTML, A_nAtTagDefStatus, goto_AtTag ); + aStateMachine.AddToken( "@NOHTML", TCF_at_NOHTML, A_nAtTagDefStatus, goto_AtTag ); + + aStateMachine.AddToken( "\r\n", 0, A_nPunctDefStatus, finEol ); + aStateMachine.AddToken( "\n", 0, A_nPunctDefStatus, finEol ); + aStateMachine.AddToken( "\r", 0, A_nPunctDefStatus, finEol ); +}; + +void +Context_AdocStd::SetMode_IsMultiLine( bool i_bTrue ) +{ + bIsMultiline = i_bTrue; +} + +DYN TextToken * +TCF_Whitespace(const char * i_sText) +{ + UINT8 nSize = strlen(i_sText); + for ( const char * pTab = strchr(i_sText,'\t'); + pTab != 0; + pTab = strchr(pTab+1,'\t') ) + { + nSize += 3; + } + + return new Tok_Whitespace(nSize); +} + + +} // namespace adoc + + +/* +@ATT[ENTION] +@author +@change[s] +@collab[orators] +@contact +@copyright +@descr +@devstat[e] +@docdate +@derive +@instance +@life[cycle] +@multi[plicity] +@onerror +@persist[ence] +@postcond +@precond +@return +@short +@todo + +@module +@file +@gloss[ary] + + +@base <BasisklassenName> +@exception <ExceptionName> +@impl[ements] <IDL-Construct> +@key[words]|[s] +@param <FunctionParameterName> [<Range of valid values>] +@see[also] +@templ[ate] <FormalTemplateParameterName> + +@internal +@obsolete + +@#<Label> + +@global#<Label> Global comment. +@include#<Label> + + +*/ + diff --git a/autodoc/source/parser/adoc/cx_a_sub.cxx b/autodoc/source/parser/adoc/cx_a_sub.cxx new file mode 100644 index 000000000000..7ae11ff4c179 --- /dev/null +++ b/autodoc/source/parser/adoc/cx_a_sub.cxx @@ -0,0 +1,354 @@ +/************************************************************************* + * + * $RCSfile: cx_a_sub.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <adoc/cx_a_sub.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <tokens/parseinc.hxx> +#include <x_parse.hxx> +#include <adoc/tk_docw.hxx> + + +namespace adoc { + +//************************ Cx_LineStart ************************// + +Cx_LineStart::Cx_LineStart( TkpContext & i_rFollowUpContext ) + : pDealer(0), + pFollowUpContext(&i_rFollowUpContext) +{ +} + +void +Cx_LineStart::ReadCharChain( CharacterSource & io_rText ) +{ + uintt nCount = 0; + for ( char cNext = io_rText.CurChar(); cNext == 32 OR cNext == 9; cNext = io_rText.MoveOn() ) + { + if (cNext == 32) + nCount++; + else if (cNext == 9) + nCount += 4; + } + io_rText.CutToken(); + + if (nCount < 50) + pNewToken = new Tok_LineStart(UINT8(nCount)); + else + pNewToken = new Tok_LineStart(0); +} + +bool +Cx_LineStart::PassNewToken() +{ + if (pNewToken) + { + pNewToken.Release()->DealOut(*pDealer); + return true; + } + return false; +} + +TkpContext & +Cx_LineStart::FollowUpContext() +{ + return *pFollowUpContext; +} + + +//************************ Cx_CheckStar ************************// + +Cx_CheckStar::Cx_CheckStar( TkpContext & i_rFollowUpContext ) + : pDealer(0), + pFollowUpContext(&i_rFollowUpContext), + pEnd_FollowUpContext(0), + bCanBeEnd(false), + bEndTokenFound(false) +{ +} + + +void +Cx_CheckStar::ReadCharChain( CharacterSource & io_rText ) +{ + bEndTokenFound = false; + if (bCanBeEnd) + { + char cNext = jumpOver(io_rText,'*'); + if ( NULCH == cNext ) + throw X_Parser(X_Parser::x_UnexpectedEOF, "", udmstri::Null_(), 0); + if (cNext == '/') + { + io_rText.MoveOn(); + pNewToken = new Tok_EoDocu; + bEndTokenFound = true; + } + else + { + pNewToken = new Tok_DocWord(io_rText.CutToken()); + } + } + else + { + jumpToWhite(io_rText); + pNewToken = new Tok_DocWord(io_rText.CutToken()); + } +} + +bool +Cx_CheckStar::PassNewToken() +{ + if (pNewToken) + { + pNewToken.Release()->DealOut(*pDealer); + return true; + } + return false; +} + +TkpContext & +Cx_CheckStar::FollowUpContext() +{ + if (bEndTokenFound) + return *pEnd_FollowUpContext; + else + return *pFollowUpContext; +} + + +//************************ Cx_AtTagCompletion ************************// + +Cx_AtTagCompletion::Cx_AtTagCompletion( TkpContext & i_rFollowUpContext ) + : pDealer(0), + pFollowUpContext(&i_rFollowUpContext) +{ +} + +void +Cx_AtTagCompletion::ReadCharChain( CharacterSource & io_rText ) +{ + jumpToWhite(io_rText); + csv_assert(fCur_TokenCreateFunction != 0); + pNewToken = (*fCur_TokenCreateFunction)(io_rText.CutToken()); +} + +bool +Cx_AtTagCompletion::PassNewToken() +{ + if (pNewToken) + { + pNewToken.Release()->DealOut(*pDealer); + return true; + } + return false; +} + +TkpContext & +Cx_AtTagCompletion::FollowUpContext() +{ + return *pFollowUpContext; +} + + + +/* +bool +Cx_Base::PassNewToken() +{ + if (pNewToken) + { + rReceiver.Receive(*pNewToken.Release()); + return true; + } + return false; +} + +TkpContext & +Cx_Base::FollowUpContext() +{ + csv_assert(pFollowUpContext != 0); + return *pFollowUpContext; +} + + +void +Cx_EoHtml::ReadCharChain( CharacterSource & io_rText ) +{ + if ( NULCH == jumpTo(io_rText,'>') ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + io_rText.MoveOn(); + SetToken(new Tok_HtmlTag(io_rText.CutToken(),bToken_IsStartOfParagraph)); +} + +void +Cx_EoXmlConst::ReadCharChain( CharacterSource & io_rText ) +{ + if ( NULCH == jumpTo(io_rText,'>') ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(new Tok_XmlConst(eTokenId)); +} + +void +Cx_EoXmlLink_BeginTag::ReadCharChain( CharacterSource & io_rText ) +{ + udmstri sScope; + + switch ( jumpTo(io_rText,'"','>') ) + { + case '"': + io_rText.MoveOn(); + io_rText.CutToken(); + if ( NULCH == jumpTo(io_rText,'"') ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + sScope = io_rText.CutToken(); + if ( NULCH == jumpTo(io_rText,'>') ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + break; + case '>': + break; + default: + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + } + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(new Tok_XmlLink_BeginTag(eTokenId,sScope)); +} + +void +Cx_EoXmlLink_EndTag::ReadCharChain( CharacterSource & io_rText ) +{ + if ( NULCH == jumpTo(io_rText,'>') ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(new Tok_XmlLink_EndTag(eTokenId)); +} + +void +Cx_EoXmlFormat_BeginTag::ReadCharChain( CharacterSource & io_rText ) +{ + if ( NULCH == jumpTo(io_rText,'>') ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(new Tok_XmlFormat_BeginTag(eTokenId)); +} + +void +Cx_EoXmlFormat_EndTag::ReadCharChain( CharacterSource & io_rText ) +{ + if ( NULCH == jumpTo(io_rText,'>') ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(new Tok_XmlFormat_EndTag(eTokenId)); +} + +void +Cx_CheckStar::ReadCharChain( CharacterSource & io_rText ) +{ + bEndTokenFound = false; + if (bIsEnd) + { + char cNext = jumpOver(io_rText,'*'); + if ( NULCH == cNext ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + if (cNext == '/') + { + io_rText.MoveOn(); + SetToken(new Tok_DocuEnd); + bEndTokenFound = true; + } + else + { + SetToken( new Tok_Word(io_rText.CutToken()) ); + } + } + else + { + jumpToWhite(io_rText); + SetToken( new Tok_Word(io_rText.CutToken()) ); + } +} + +TkpContext & +Cx_CheckStar::FollowUpContext() +{ + if (bEndTokenFound) + return *pEnd_FollowUpContext; + else + return Cx_Base::FollowUpContext(); +} +*/ + +} // namespace adoc + + + + + + + + diff --git a/autodoc/source/parser/adoc/docu_pe.cxx b/autodoc/source/parser/adoc/docu_pe.cxx new file mode 100644 index 000000000000..67ca8448857d --- /dev/null +++ b/autodoc/source/parser/adoc/docu_pe.cxx @@ -0,0 +1,430 @@ +/************************************************************************* + * + * $RCSfile: docu_pe.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include <adoc/docu_pe.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/info/codeinfo.hxx> +#include <ary/info/ci_attag.hxx> +#include <ary/info/ci_text.hxx> +#include <adoc/adoc_tok.hxx> +#include <adoc/tk_attag.hxx> +#include <adoc/tk_docw.hxx> + + +namespace adoc { + + +inline bool +Adoc_PE::UsesHtmlInDocuText() +{ + return bUsesHtmlInDocuText; +} + + + + +Adoc_PE::Adoc_PE() + : // pCurDocu; + pCurAtTag(0), + nLineCountInDocu(0), + nCurSpecialMeaningTokens(0), + nCurSubtractFromLineStart(0), + eCurTagState(ts_new), + eDocuState(ds_wait_for_short), + bIsComplete(false), + bUsesHtmlInDocuText(false) +{ +} + +Adoc_PE::~Adoc_PE() +{ +} + +void +Adoc_PE::Hdl_at_std( const Tok_at_std & i_rTok ) +{ + InstallAtTag( + CurDocu().Create_StdTag(i_rTok.Id()) ); +} + +void +Adoc_PE::Hdl_at_base( const Tok_at_base & i_rTok ) +{ + InstallAtTag( + CurDocu().CheckIn_BaseTag() ); +} + +void +Adoc_PE::Hdl_at_exception( const Tok_at_exception & i_rTok ) +{ + InstallAtTag( + CurDocu().CheckIn_ExceptionTag() ); +} + +void +Adoc_PE::Hdl_at_impl( const Tok_at_impl & i_rTok ) +{ + InstallAtTag( + CurDocu().Create_ImplementsTag() ); +} + +void +Adoc_PE::Hdl_at_key( const Tok_at_key & i_rTok ) +{ + InstallAtTag( + CurDocu().Create_KeywordTag() ); +} + +void +Adoc_PE::Hdl_at_param( const Tok_at_param & i_rTok ) +{ + InstallAtTag( + CurDocu().CheckIn_ParameterTag() ); +} + +void +Adoc_PE::Hdl_at_see( const Tok_at_see & i_rTok ) +{ + InstallAtTag( + CurDocu().CheckIn_SeeTag() ); +} + +void +Adoc_PE::Hdl_at_template( const Tok_at_template & i_rTok ) +{ + InstallAtTag( + CurDocu().CheckIn_TemplateTag() ); +} + +void +Adoc_PE::Hdl_at_interface( const Tok_at_interface & i_rTok ) +{ + CurDocu().Set_Interface(); +} + +void +Adoc_PE::Hdl_at_internal( const Tok_at_internal & i_rTok ) +{ + CurDocu().Set_Internal(); +} + +void +Adoc_PE::Hdl_at_obsolete( const Tok_at_obsolete & i_rTok ) +{ + CurDocu().Set_Obsolete(); +} + +void +Adoc_PE::Hdl_at_module( const Tok_at_module & i_rTok ) +{ + // KORR + +// pCurAtTag = CurDocu().Assign2_ModuleTag(); +// nCurSpecialMeaningTokens = pCurAtTag->NrOfSpecialMeaningTokens(); +} + +void +Adoc_PE::Hdl_at_file( const Tok_at_file & i_rTok ) +{ + // KORR + +// pCurAtTag = CurDocu().Assign2_FileTag(); +// nCurSpecialMeaningTokens = pCurAtTag->NrOfSpecialMeaningTokens(); +} + +void +Adoc_PE::Hdl_at_gloss( const Tok_at_gloss & i_rTok ) +{ + // KORR + +// Create_GlossaryEntry(); +} + +void +Adoc_PE::Hdl_at_global( const Tok_at_global & i_rTok ) +{ + // KORR +// Create_GlobalTextComponent(); +} + +void +Adoc_PE::Hdl_at_include( const Tok_at_include & i_rTok ) +{ + // KORR +} + +void +Adoc_PE::Hdl_at_label( const Tok_at_label & i_rTok ) +{ + InstallAtTag( + CurDocu().Create_LabelTag() ); +} + +void +Adoc_PE::Hdl_at_HTML( const Tok_at_HTML & ) +{ + bUsesHtmlInDocuText = true; +} + +void +Adoc_PE::Hdl_at_NOHTML( const Tok_at_NOHTML & ) +{ + bUsesHtmlInDocuText = false; +} + +void +Adoc_PE::Hdl_DocWord( const Tok_DocWord & i_rTok ) +{ + bool bIsSpecial = false; + if ( nCurSpecialMeaningTokens > 0 ) + { + bIsSpecial = CurAtTag().Add_SpecialMeaningToken( + i_rTok.Text(), + CurAtTag().NrOfSpecialMeaningTokens() + - (--nCurSpecialMeaningTokens) ); + } + + if ( NOT bIsSpecial ) + { + if ( eDocuState == ds_wait_for_short OR eDocuState == ds_1newline_after_short ) + eDocuState = ds_in_short; + if (nLineCountInDocu == 0) + nLineCountInDocu = 1; + + uintt nLength = i_rTok.Length(); + if ( nLength > 2 ) + { + bool bMaybeGlobalLink = strncmp( "::", i_rTok.Text(), 2 ) == 0; + bool bMayBeFunction = *(i_rTok.Text() + nLength - 2) == '(' + AND *(i_rTok.Text() + nLength - 1) == ')'; + if ( bMaybeGlobalLink OR bMayBeFunction ) + { + CurAtTag().Add_PotentialLink( i_rTok.Text(), + bMaybeGlobalLink, + bMayBeFunction ); + return; + } + } + + CurAtTag().Add_Token( i_rTok.Text() ); + eCurTagState = ts_std; + } +} + +void +Adoc_PE::Hdl_Whitespace( const Tok_Whitespace & i_rTok ) +{ + if ( eCurTagState == ts_std ) + { + + CurAtTag().Add_Whitespace(i_rTok.Size()); + } +} + +void +Adoc_PE::Hdl_LineStart( const Tok_LineStart & i_rTok ) +{ + if ( pCurAtTag == 0 ) + return; + + if ( nLineCountInDocu == 2 ) + { + nCurSubtractFromLineStart = i_rTok.Size(); + eCurTagState = ts_std; + } + else if ( nLineCountInDocu > 2 ) + { + if ( i_rTok.Size() > nCurSubtractFromLineStart ) + { + CurAtTag().Add_Whitespace( i_rTok.Size() + - nCurSubtractFromLineStart ); + } + // else do nothing, because there is no whitespace. + } +} + +void +Adoc_PE::Hdl_Eol( const Tok_Eol & ) +{ + if ( pCurAtTag == 0 ) + return; + + nLineCountInDocu++; + + if ( nCurSpecialMeaningTokens == 0 ) + { + CurAtTag().Add_Eol(); + + switch ( eDocuState ) + { + case ds_wait_for_short: break; + case ds_in_short: if ( nLineCountInDocu < 4 ) + eDocuState = ds_1newline_after_short; + else + { + RenameCurShortTag(); + eDocuState = ds_in_descr; + } + break; + case ds_1newline_after_short: FinishCurShortTag(); + eDocuState = ds_in_descr; + break; + default: + ; // Do noting. + } + } + else + { + nCurSpecialMeaningTokens = 0; + } + + +} + +void +Adoc_PE::Hdl_EoDocu( const Tok_EoDocu & i_rTok ) +{ + bIsComplete = true; +} + +DYN ary::Documentation * +Adoc_PE::ReleaseJustParsedDocu() +{ + pCurAtTag = 0; + nLineCountInDocu = 0; + nCurSpecialMeaningTokens = 0; + nCurSubtractFromLineStart = 0; + eCurTagState = ts_new; + eDocuState = ds_wait_for_short; + bIsComplete = false; + return pCurDocu.Release(); +} + +void +Adoc_PE::InstallAtTag( DYN ary::info::AtTag * let_dpTag, + bool i_bImplicit ) +{ + pCurAtTag = let_dpTag; + if ( pCurAtTag != 0 ) + { + nCurSpecialMeaningTokens = pCurAtTag->NrOfSpecialMeaningTokens(); + pCurAtTag->Set_HtmlUseInDocuText( bUsesHtmlInDocuText ); + } + + eCurTagState = ts_new; + if ( NOT i_bImplicit ) + eDocuState = ds_std; +} + +ary::info::CodeInfo & +Adoc_PE::CurDocu() +{ + if (NOT pCurDocu) + pCurDocu = new ary::info::CodeInfo; + return *pCurDocu; +} + +ary::info::AtTag & +Adoc_PE::CurAtTag() +{ + if (NOT pCurAtTag) + { + if ( int(eDocuState) < int(ds_in_descr) ) + { + InstallAtTag( + CurDocu().Create_StdTag(ary::info::atid_short), + true ); + } + else + { + InstallAtTag( + CurDocu().Create_StdTag(ary::info::atid_descr), + true ); + } + } + return *pCurAtTag; +} + +void +Adoc_PE::RenameCurShortTag() +{ + CurDocu().Replace_AtShort_By_AtDescr(); +} + +void +Adoc_PE::FinishCurShortTag() +{ + InstallAtTag( + CurDocu().Create_StdTag(ary::info::atid_descr), + true ); +} + + +} // namespace adoc + + + + + diff --git a/autodoc/source/parser/adoc/makefile.mk b/autodoc/source/parser/adoc/makefile.mk new file mode 100644 index 000000000000..63c659db5b63 --- /dev/null +++ b/autodoc/source/parser/adoc/makefile.mk @@ -0,0 +1,97 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: np $ $Date: 2002-03-08 14:45:28 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=parser_adoc + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/adoc_tok.obj \ + $(OBJ)$/a_rdocu.obj \ + $(OBJ)$/cx_a_std.obj \ + $(OBJ)$/cx_a_sub.obj \ + $(OBJ)$/docu_pe.obj \ + $(OBJ)$/prs_adoc.obj \ + $(OBJ)$/tk_attag.obj \ + $(OBJ)$/tk_docw.obj + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser/adoc/prs_adoc.cxx b/autodoc/source/parser/adoc/prs_adoc.cxx new file mode 100644 index 000000000000..d419c6a91f8d --- /dev/null +++ b/autodoc/source/parser/adoc/prs_adoc.cxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * $RCSfile: prs_adoc.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <adoc/prs_adoc.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <adoc/cx_a_std.hxx> + + + +namespace adoc +{ + +DocuParser_AutodocStyle::DocuParser_AutodocStyle() +{ +} + +DocuParser_AutodocStyle::~DocuParser_AutodocStyle() +{ +} + +DYN autodoc::TkpDocuContext * +DocuParser_AutodocStyle::Create_DocuContext() const +{ + return new Context_AdocStd; +} + +} // namespace adoc + + + diff --git a/autodoc/source/parser/adoc/tk_attag.cxx b/autodoc/source/parser/adoc/tk_attag.cxx new file mode 100644 index 000000000000..c3f25e3c246c --- /dev/null +++ b/autodoc/source/parser/adoc/tk_attag.cxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * $RCSfile: tk_attag.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <adoc/tk_attag.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <adoc/tokintpr.hxx> + +INSTANCIATE_ENUM(adoc::E_AtTagId); + + +namespace adoc { + +#if 0 +#define EV_AtTagId( val, tex ) ENUM_VALUE(E_AtTagId, eATTAGID_##val, val, tex ) + +EV_AtTagId(atid_ATT, "ATTENTION" ); +EV_AtTagId(atid_author, "Author" ); +EV_AtTagId(atid_change, "Change" ); +EV_AtTagId(atid_collab, "Collaborators" ); +EV_AtTagId(atid_contact, "Contact" ); +EV_AtTagId(atid_copyright, "Copyright (c)" ); +EV_AtTagId(atid_descr, "Description" ); +EV_AtTagId(atid_devstat, "Development State" ); +EV_AtTagId(atid_docdate, "Date of Documentation" ); +EV_AtTagId(atid_derive, "How to Derive from this class" ); +EV_AtTagId(atid_instance, "Instances" ); +EV_AtTagId(atid_life, "Lifecycle" ); +EV_AtTagId(atid_multi, "Multiplicity" ); +EV_AtTagId(atid_onerror, "On Error" ); +EV_AtTagId(atid_persist, "Persistence" ); +EV_AtTagId(atid_postcond, "Postcondition" ); +EV_AtTagId(atid_precond, "Precondition" ); +EV_AtTagId(atid_return, "Return" ); +EV_AtTagId(atid_short, "Summary" ); +EV_AtTagId(atid_since, "Valid Since" ); +EV_AtTagId(atid_todo, "Todo" ); +EV_AtTagId(atid_version, "Version" ); +#endif // 0 + +void +Tok_at_std::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Hdl_at_std(*this); +} + +const char * +Tok_at_std::Text() const +{ + // KORR + return "Ein Tag"; + +// return eId.Text(); +} + + +#define DEFINE_TOKEN_CLASS(name, text) \ +void \ +Tok_##name::Trigger( TokenInterpreter & io_rInterpreter ) const \ +{ io_rInterpreter.Hdl_##name(*this); } \ +const char * \ +Tok_##name::Text() const \ +{ return text; } + +DEFINE_TOKEN_CLASS(at_base, "Base Classes") +DEFINE_TOKEN_CLASS(at_exception, "Exceptions") +DEFINE_TOKEN_CLASS(at_impl, "Implements") +DEFINE_TOKEN_CLASS(at_key, "Keywords") +DEFINE_TOKEN_CLASS(at_param, "Parameters") +DEFINE_TOKEN_CLASS(at_see, "See Also") +DEFINE_TOKEN_CLASS(at_template, "Template Parameters") +DEFINE_TOKEN_CLASS(at_interface, "Interface") +DEFINE_TOKEN_CLASS(at_internal, "[ INTERNAL ]") +DEFINE_TOKEN_CLASS(at_obsolete, "[ DEPRECATED ]") +DEFINE_TOKEN_CLASS(at_module, "Module") +DEFINE_TOKEN_CLASS(at_file, "File") +DEFINE_TOKEN_CLASS(at_gloss, "Glossary") +DEFINE_TOKEN_CLASS(at_global, "<global doc text>") +DEFINE_TOKEN_CLASS(at_include, "<included text>") +DEFINE_TOKEN_CLASS(at_label, "Label") +DEFINE_TOKEN_CLASS(at_HTML, "") +DEFINE_TOKEN_CLASS(at_NOHTML, "") + +} // namespace adoc + diff --git a/autodoc/source/parser/adoc/tk_docw.cxx b/autodoc/source/parser/adoc/tk_docw.cxx new file mode 100644 index 000000000000..c81d9e18cd8d --- /dev/null +++ b/autodoc/source/parser/adoc/tk_docw.cxx @@ -0,0 +1,162 @@ +/************************************************************************* + * + * $RCSfile: tk_docw.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <adoc/tk_docw.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <adoc/tokintpr.hxx> + + + +namespace adoc { + + + static const char C_sSpace[300] = + " " + " " + " " + " " + " " + " "; + + +//*********************** Tok_DocWord ******************// + +void +Tok_DocWord::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Hdl_DocWord(*this); +} + +const char * +Tok_DocWord::Text() const +{ + return sText; +} + +//*********************** Tok_Whitespace ******************// + + +void +Tok_Whitespace::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Hdl_Whitespace(*this); +} + +const char * +Tok_Whitespace::Text() const +{ + return C_sSpace + 299 - nSize; +} + + + +//*********************** Tok_LineStart ******************// + + +void +Tok_LineStart::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Hdl_LineStart(*this); +} + +const char * +Tok_LineStart::Text() const +{ + return C_sSpace + 299 - nSize; +} + + +//*********************** Tok_Eol ******************// + +void +Tok_Eol::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Hdl_Eol(*this); +} + +const char * +Tok_Eol::Text() const +{ + return "\n"; +} + + + +//*********************** Tok_EoDocu ******************// + +void +Tok_EoDocu::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Hdl_EoDocu(*this); +} + +const char * +Tok_EoDocu::Text() const +{ + return "*/"; +} + +} // namespace adoc + + diff --git a/autodoc/source/parser/cpp/all_toks.cxx b/autodoc/source/parser/cpp/all_toks.cxx new file mode 100644 index 000000000000..5a4b5490b48c --- /dev/null +++ b/autodoc/source/parser/cpp/all_toks.cxx @@ -0,0 +1,187 @@ +/************************************************************************* + * + * $RCSfile: all_toks.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:28 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include <all_toks.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cpp/ctokdeal.hxx> +#include "tokintpr.hxx" + + + +namespace cpp { + + +void +Token::DealOut( ::TokenDealer & o_rDealer ) +{ + dynamic_cast< cpp::TokenDealer& >(o_rDealer).Deal_CppCode(*this); +} + + +#define DEF_TOKEN_CLASS(name) \ +void \ +Tok_##name::Trigger( TokenInterpreter & io_rInterpreter ) const \ +{ io_rInterpreter.Hdl_##name(*this); } \ +INT16 \ +Tok_##name::TypeId() const { return Tid_##name; } \ +const char * \ +Tok_##name::Text() const { return #name; } + +#define DEF_TOKEN_CLASS_WITHTEXT(name, text ) \ +void \ +Tok_##name::Trigger( TokenInterpreter & io_rInterpreter ) const \ +{ io_rInterpreter.Hdl_##name(*this); } \ +INT16 \ +Tok_##name::TypeId() const { return Tid_##name; } \ +const char * \ +Tok_##name::Text() const { return text; } + + +DEF_TOKEN_CLASS_WITHTEXT(Identifier,sText) +DEF_TOKEN_CLASS_WITHTEXT(Operator,sText) + +DEF_TOKEN_CLASS(operator) +DEF_TOKEN_CLASS(class) +DEF_TOKEN_CLASS(struct) +DEF_TOKEN_CLASS(union) +DEF_TOKEN_CLASS(enum) +DEF_TOKEN_CLASS(typedef) +DEF_TOKEN_CLASS(public) +DEF_TOKEN_CLASS(protected) +DEF_TOKEN_CLASS(private) +DEF_TOKEN_CLASS(template) +DEF_TOKEN_CLASS(virtual) +DEF_TOKEN_CLASS(friend) +DEF_TOKEN_CLASS_WITHTEXT(Tilde,"~") +DEF_TOKEN_CLASS(const) +DEF_TOKEN_CLASS(volatile) +DEF_TOKEN_CLASS(extern) +DEF_TOKEN_CLASS(static) +DEF_TOKEN_CLASS(mutable) +DEF_TOKEN_CLASS(register) +DEF_TOKEN_CLASS(inline) +DEF_TOKEN_CLASS(explicit) +DEF_TOKEN_CLASS(namespace) +DEF_TOKEN_CLASS(using) +DEF_TOKEN_CLASS(throw) +DEF_TOKEN_CLASS_WITHTEXT(SwBracket_Left,"{") +DEF_TOKEN_CLASS_WITHTEXT(SwBracket_Right,"}") +DEF_TOKEN_CLASS_WITHTEXT(ArrayBracket_Left,"[") +DEF_TOKEN_CLASS_WITHTEXT(ArrayBracket_Right,"]") +DEF_TOKEN_CLASS_WITHTEXT(Bracket_Left,"(") +DEF_TOKEN_CLASS_WITHTEXT(Bracket_Right,")") +DEF_TOKEN_CLASS_WITHTEXT(DoubleColon,"::") +DEF_TOKEN_CLASS_WITHTEXT(Semicolon,";") +DEF_TOKEN_CLASS_WITHTEXT(Comma,",") +DEF_TOKEN_CLASS_WITHTEXT(Colon,":") +DEF_TOKEN_CLASS_WITHTEXT(Assign,"=") +DEF_TOKEN_CLASS_WITHTEXT(Less,"<") +DEF_TOKEN_CLASS_WITHTEXT(Greater,">") +DEF_TOKEN_CLASS_WITHTEXT(Asterix,"*") +DEF_TOKEN_CLASS_WITHTEXT(AmpersAnd,"&") +DEF_TOKEN_CLASS_WITHTEXT(Ellipse,"...") + +DEF_TOKEN_CLASS_WITHTEXT(DefineName,sText) +DEF_TOKEN_CLASS_WITHTEXT(MacroName,sText) +DEF_TOKEN_CLASS_WITHTEXT(MacroParameter,sText) +// DEF_TOKEN_CLASS_WITHTEXT(PreProDefinition,sText) + +void +Tok_PreProDefinition::Trigger( TokenInterpreter & io_rInterpreter ) const +{ io_rInterpreter.Hdl_PreProDefinition(*this); } + +INT16 +Tok_PreProDefinition::TypeId() const { return Tid_PreProDefinition; } + +const char * +Tok_PreProDefinition::Text() const +{ + return sText; +} + + + +DEF_TOKEN_CLASS_WITHTEXT(BuiltInType,sText) +DEF_TOKEN_CLASS_WITHTEXT(TypeSpecializer,sText) +DEF_TOKEN_CLASS_WITHTEXT(Constant,sText) + +const char * +Tok_UnblockMacro::Text() const +{ + return sMacroName; +} + +void +Tok_UnblockMacro::DealOut( ::TokenDealer & o_rDealer ) +{ + dynamic_cast< cpp::TokenDealer& >(o_rDealer).Deal_Cpp_UnblockMacro(*this); +} + +} // namespace cpp + + + + + diff --git a/autodoc/source/parser/cpp/all_toks.hxx b/autodoc/source/parser/cpp/all_toks.hxx new file mode 100644 index 000000000000..75454a37dd07 --- /dev/null +++ b/autodoc/source/parser/cpp/all_toks.hxx @@ -0,0 +1,344 @@ +/************************************************************************* + * + * $RCSfile: all_toks.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_ALL_TOKS_HXX +#define ADC_CPP_ALL_TOKS_HXX + +// USED SERVICES + // BASE CLASSES +#include "cpp_tok.hxx" + // COMPONENTS + // PARAMETERS + +namespace cpp { + +class Tok_Identifier : public cpp::Token +{ + public: + Tok_Identifier( + const char * i_sText ) : sText(i_sText) {} + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual INT16 TypeId() const; + virtual const char * + Text() const; + private: + udmstri sText; +}; +const INT16 Tid_Identifier = 1; + +/** == != <= >= && || ! + + new delete sizeof typeid + + - / % ^ | << >> + . -> ? + += -= *= /= %= &= |= ^= <<= >>= +*/ +class Tok_Operator : public cpp::Token +{ + public: + Tok_Operator( + const char * i_sText ) : sText(i_sText) {} + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual INT16 TypeId() const; + virtual const char * + Text() const; + private: + udmstri sText; +}; +const INT16 Tid_Operator = 2; + + + +#define DECL_TOKEN_CLASS(name,tid) \ +class Tok_##name : public cpp::Token \ +{ public: \ + virtual void Trigger( \ + TokenInterpreter & io_rInterpreter ) const; \ + virtual INT16 TypeId() const; \ + virtual const char * \ + Text() const; \ +}; \ +const INT16 Tid_##name = tid + +DECL_TOKEN_CLASS(operator,3); +DECL_TOKEN_CLASS(class,4); +DECL_TOKEN_CLASS(struct,5); +DECL_TOKEN_CLASS(union,6); +DECL_TOKEN_CLASS(enum,7); +DECL_TOKEN_CLASS(typedef,8); +DECL_TOKEN_CLASS(public,9); +DECL_TOKEN_CLASS(protected,10); +DECL_TOKEN_CLASS(private,11); +DECL_TOKEN_CLASS(template,12); +DECL_TOKEN_CLASS(virtual,13); +DECL_TOKEN_CLASS(friend,14); +DECL_TOKEN_CLASS(Tilde,15); +DECL_TOKEN_CLASS(const,16); +DECL_TOKEN_CLASS(volatile,17); +DECL_TOKEN_CLASS(extern,18); +DECL_TOKEN_CLASS(static,19); +DECL_TOKEN_CLASS(mutable,20); +DECL_TOKEN_CLASS(register,21); +DECL_TOKEN_CLASS(inline,22); +DECL_TOKEN_CLASS(explicit,23); +DECL_TOKEN_CLASS(namespace,24); +DECL_TOKEN_CLASS(using,25); +DECL_TOKEN_CLASS(throw,26); +DECL_TOKEN_CLASS(SwBracket_Left,27); +DECL_TOKEN_CLASS(SwBracket_Right,28); +DECL_TOKEN_CLASS(ArrayBracket_Left,29); +DECL_TOKEN_CLASS(ArrayBracket_Right,30); +DECL_TOKEN_CLASS(Bracket_Left,31); +DECL_TOKEN_CLASS(Bracket_Right,32); +DECL_TOKEN_CLASS(DoubleColon,33); +DECL_TOKEN_CLASS(Semicolon,34); +DECL_TOKEN_CLASS(Comma,35); +DECL_TOKEN_CLASS(Colon,36); +DECL_TOKEN_CLASS(Assign,37); +DECL_TOKEN_CLASS(Less,38); +DECL_TOKEN_CLASS(Greater,39); +DECL_TOKEN_CLASS(Asterix,40); +DECL_TOKEN_CLASS(AmpersAnd,41); +DECL_TOKEN_CLASS(Ellipse,42); + +#undef DECL_TOKEN_CLASS + +#define DECL_TOKEN_CLASS_WITHTEXT(name,tid) \ +class Tok_##name : public cpp::Token \ +{ public: \ + Tok_##name( \ + const char * i_sText ) : sText(i_sText) {} \ + virtual void Trigger( \ + TokenInterpreter & io_rInterpreter ) const; \ + virtual INT16 TypeId() const; \ + virtual const char * \ + Text() const; \ + private: \ + udmstri sText; \ +}; \ +const INT16 Tid_##name = tid + +DECL_TOKEN_CLASS_WITHTEXT(DefineName,43); +DECL_TOKEN_CLASS_WITHTEXT(MacroName,44); +DECL_TOKEN_CLASS_WITHTEXT(MacroParameter,45); +DECL_TOKEN_CLASS_WITHTEXT(PreProDefinition,46); + + + +/** char short int long float double wchar_t size_t +*/ +DECL_TOKEN_CLASS_WITHTEXT(BuiltInType, 47); +/** signed unsigned +*/ +DECL_TOKEN_CLASS_WITHTEXT(TypeSpecializer, 48); +DECL_TOKEN_CLASS_WITHTEXT(Constant, 49); + + + +#if 0 +/** char short int long float double wchar_t size_t +*/ +class Tok_BuiltInType : public cpp::Token +{ + public: + Tok_BuiltInType( + const char * i_sText ) : sText(i_sText) {} + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual INT16 TypeId() const; + virtual const char * + Text() const; + private: + udmstri sText; +}; +const INT16 Tid_BuiltInType = 47; + +/** signed unsigned +*/ +class Tok_TypeSpecializer : public cpp::Token +{ + public: + Tok_TypeSpecializer( + const char * i_sText ) : sText(i_sText) {} + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual INT16 TypeId() const; + virtual const char * + Text() const; + private: + udmstri sText; +}; +const INT16 Tid_TypeSpecializer = 48; + + +class Tok_Constant : public cpp::Token +{ + public: + Tok_Constant( + const char * i_sText ) : sText(i_sText) {} + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual INT16 TypeId() const; + virtual const char * + Text() const; + private: + udmstri sText; +}; +const INT16 Tid_Constant = 49; + +#endif // 0 + + +/** This token does nothing in C++ code. It is added by the + internal macro-replacer to mark the position, where a + define or macro becomes valid again, which was until then + invalid, because the text was a replacement of this macro. + ( Avoiding endless recursive macro replacement. ) +*/ +class Tok_UnblockMacro : public ::TextToken +{ + public: + Tok_UnblockMacro( + const char * i_sMacroName ) : sMacroName(i_sMacroName) {} + virtual const char* Text() const; + + virtual void DealOut( + ::TokenDealer & o_rDealer ); + private: + udmstri sMacroName; +}; + + + + +#if 0 // These tokens will not be created, but just ignored. +/// auto typename __cdecl __stdcall __fastcall +class Tok_Ignore : public cpp::Token +{ + public: + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; +}; +#endif // 0 + + + + + + +#if 0 // These tokens will not be created, but just ignored. +/// /* // /** /// # +class Tok_ContextChanger : public cpp::Token +{ + public: + enum E_Id { id_ml_comment, id_sl_comment, id_ml_docu, id_sl_docu, id_preprocessor }; + typedef udm::Enum<E_Id> Ec_Id; + + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; + Ec_Id Id() const { return eId; } + + private: + Ec_Id eId; +}; +#endif // 0 + + +#if 0 // just for viewing: +class Tok_TypeKey : public cpp::Token // file-><type-PE> +class Tok_Template : public cpp::Token // file +class Tok_Namespace : public cpp::Token // file +class Tok_Bracket : public cpp::Token // ueberall +class Tok_Separator : public cpp::Token // ueberall + +class Tok_Identifier : public cpp::Token // ueberall +class Tok_NameSeparator : public cpp::Token // Type, Name +class Tok_BuiltInType : public cpp::Token // ueberall +class Tok_ConVol : public cpp::Token // class-><FuVa> +class Tok_StorageClass : public cpp::Token // file-><type>,<FuVa> +class Tok_OperatorFunctionName : public cpp::Token // class + +class Tok_Protection : public cpp::Token // class +class Tok_Virtual : public cpp::Token // class +class Tok_Friend : public cpp::Token // class +class Tok_Tilde : public cpp::Token // class, expression + +class Tok_Ellipse : public cpp::Token // function-ParaList +class Tok_Assignment : public cpp::Token // VariableDeclaraton, Function, Parameter +class Tok_Throw : public cpp::Token // function +class Tok_LessMore : public cpp::Token +class Tok_Operator : public cpp::Token // expression + +class Tok_Ignore : public cpp::Token +class Tok_ContextChanger : public cpp::Token +#endif // 0 + + +} // namespace cpp + +#endif + diff --git a/autodoc/source/parser/cpp/c_dealer.cxx b/autodoc/source/parser/cpp/c_dealer.cxx new file mode 100644 index 000000000000..92acaaa78a90 --- /dev/null +++ b/autodoc/source/parser/cpp/c_dealer.cxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * $RCSfile: c_dealer.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "c_dealer.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <ary/cpp/c_rwgate.hxx> +#include <ary/cpp/crwg_grp.hxx> +#include <ary/cpp/cg_proj.hxx> +#include <ary/loc/l_rwgate.hxx> +#include <ary/loc/loc_root.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/docu.hxx> +#include <adoc/a_rdocu.hxx> +#include "all_toks.hxx" +#include "c_rcode.hxx" + + + +namespace ary +{ + namespace cpp + { + class ProjectGroup; + } + + namespace loc + { + class LocationRoot; + } + + class Documentation; +} + + + + +namespace cpp +{ + +Distributor::Distributor( ary::cpp::RwGate & io_rAryGate ) + : // aCppPreProcessor, + aCodeExplorer(io_rAryGate), + // aDocuExplorer, + pGate(&io_rAryGate), + pFileEventHandler(0), + pDocuDistributor(0) +{ + pFileEventHandler = & aCodeExplorer.FileEventHandler(); + pDocuDistributor = & aCodeExplorer.DocuDistributor(); +} + +void +Distributor::AssignPartners( CharacterSource & io_rSourceText, + const MacroMap & i_rValidMacros ) +{ + aCppPreProcessor.AssignPartners(aCodeExplorer, io_rSourceText, i_rValidMacros); +} + +Distributor::~Distributor() +{ +} + +void +Distributor::StartNewProject( const udmstri & i_sProjectName, + const csv::ploc::Path & i_rProjectRootDirectory ) +{ + ary::loc::LocationRoot & rRoot + = pGate->Locations().CheckIn_Root( i_rProjectRootDirectory ); + ary::cpp::ProjectGroup & rProject + = pGate->Groups().CheckIn_ProjectGroup( i_sProjectName, rRoot.Id() ); + pFileEventHandler->SetCurProject(rProject); +} + +void +Distributor::StartNewFile( const udmstri & i_sFileName, + const csv::ploc::DirectoryChain & i_rFileSubPath ) +{ + ary::loc::SourceCodeFile & rFile + = pGate->Locations().CheckIn_File( + i_sFileName, + i_rFileSubPath, + pFileEventHandler->CurProject().RootDir() ); + ary::cpp::FileGroup & rCurFile + = pGate->Groups().CheckIn_FileGroup( + rFile.Id(), + pFileEventHandler->CurProject().Id_Group(), + i_sFileName ); + pFileEventHandler->SetCurFile(rCurFile, i_sFileName); + + aCodeExplorer.StartNewFile(); + + csv_assert( pDocuDistributor != 0 ); + aDocuExplorer.StartNewFile(*pDocuDistributor); +} + + +void +Distributor::Deal_Eol() +{ + pFileEventHandler->Event_IncrLineCount(); +} + +void +Distributor::Deal_Eof() +{ + // Do nothing yet. +} + +void +Distributor::Deal_Cpp_UnblockMacro( Tok_UnblockMacro & let_drToken ) +{ + aCppPreProcessor.UnblockMacro(let_drToken.Text()); + delete &let_drToken; +} + +void +Distributor::Deal_CppCode( cpp::Token & let_drToken ) +{ + aCppPreProcessor.Process_Token(let_drToken); +} + +void +Distributor::Deal_AdcDocu( adoc::Token & let_drToken ) +{ + aDocuExplorer.Process_Token(let_drToken); +} + + + + + + +} // namespace cpp + + diff --git a/autodoc/source/parser/cpp/c_dealer.hxx b/autodoc/source/parser/cpp/c_dealer.hxx new file mode 100644 index 000000000000..58a7262450c7 --- /dev/null +++ b/autodoc/source/parser/cpp/c_dealer.hxx @@ -0,0 +1,152 @@ +/************************************************************************* + * + * $RCSfile: c_dealer.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_C_DEALER_HXX +#define ADC_CPP_C_DEALER_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <cpp/ctokdeal.hxx> +#include <adoc/atokdeal.hxx> +#include <ary/info/docstore.hxx> + // COMPONENTS +#include "preproc.hxx" +#include "c_rcode.hxx" +#include <adoc/a_rdocu.hxx> + // PARAMETERS + +namespace csv +{ + namespace ploc + { + class Path; + class DirectoryChain; + } +} + + +class TokenParser; + + +namespace cpp +{ + +class PE_File; +class DefineDescription; + + +class Distributor : public cpp::TokenDealer, /// Handle C++ code tokens. + public adoc::TokenDealer /// Handle Autodoc documentation tokens. +{ + public: + typedef std::map< udmstri, DefineDescription* > MacroMap; + + // LIFECYCLE + Distributor( + ary::cpp::RwGate & io_rGate ); + ~Distributor(); + // OPERATIONS + void AssignPartners( + CharacterSource & io_rSourceText, + const MacroMap & i_rValidMacros ); + void StartNewProject( + const udmstri & i_sProjectName, + const csv::ploc::Path & + i_rProjectRootDirectory ); + void StartNewFile( + const udmstri & i_sFileName, + const csv::ploc::DirectoryChain & + i_rFileSubPath ); + virtual void Deal_Eol(); + virtual void Deal_Eof(); + + virtual void Deal_CppCode( + cpp::Token & let_drToken ); + virtual void Deal_Cpp_UnblockMacro( + Tok_UnblockMacro & let_drToken ); + + virtual void Deal_AdcDocu( + adoc::Token & let_drToken ); + private: + // DATA + PreProcessor aCppPreProcessor; + CodeExplorer aCodeExplorer; + adoc::DocuExplorer aDocuExplorer; + ary::cpp::RwGate * pGate; + FileScope_EventHandler * + pFileEventHandler; + DocuDealer * pDocuDistributor; +}; + + + +// IMPLEMENTATION + + + +} // namespace cpp + + + +#endif + diff --git a/autodoc/source/parser/cpp/c_rcode.cxx b/autodoc/source/parser/cpp/c_rcode.cxx new file mode 100644 index 000000000000..79af6eddb6fc --- /dev/null +++ b/autodoc/source/parser/cpp/c_rcode.cxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * $RCSfile: c_rcode.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "c_rcode.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <ary/cpp/c_rwgate.hxx> +#include <ary/cpp/c_namesp.hxx> +// #include <ary/cpp/c_groups.hxx> +#include <ary/loc/l_rwgate.hxx> +#include "cpp_pe.hxx" +#include <adc_cl.hxx> +#include <x_parse.hxx> +#include "pe_file.hxx" + + + +const uintt C_nNO_TRY = uintt(-1); + + +namespace cpp { + + +CodeExplorer::CodeExplorer( ary::cpp::RwGate & io_rAryGate ) + : aGlobalParseContext(io_rAryGate), + // aEnvironments, + pPE_File(0), + pGate(&io_rAryGate), + dpCurToken(0) +{ + pPE_File = new PE_File( aGlobalParseContext ); +} + +CodeExplorer::~CodeExplorer() +{ +} + +void +CodeExplorer::StartNewFile() +{ + csv::erase_container(aEnvironments); + + aEnvironments.push_back( pPE_File.MutablePtr() ); + pPE_File->Enter(push); +} + +void +CodeExplorer::Process_Token( DYN cpp::Token & let_drToken ) +{ +if (DEBUG_ShowTokens()) +{ + Cout() << let_drToken.Text() << Endl(); +} + dpCurToken = &let_drToken; + aGlobalParseContext.ResetResult(); + + do { + CurToken().Trigger( CurEnv() ); + AcknowledgeResult(); + } while ( dpCurToken ); +} + +void +CodeExplorer::AcknowledgeResult() +{ + if (CurResult().eDone == done) + dpCurToken = 0; + + switch ( CurResult().eStackAction ) + { + case stay: + break; + case push: + CurEnv().Leave(push); + aEnvironments.push_back( &PushEnv() ); + PushEnv().Enter(push); + break; + case pop_success: + CurEnv().Leave(pop_success); + aEnvironments.pop_back(); + CurEnv().Enter(pop_success); + break; + case pop_failure: + { + Cpp_PE * pRecover = 0; + do { + CurEnv().Leave(pop_failure); + aEnvironments.pop_back(); + if ( aEnvironments.empty() ) + break; + pRecover = CurEnv().Handle_ChildFailure(); + } while ( pRecover == 0 ); + if ( pRecover != 0 ) + { + aEnvironments.push_back(pRecover); + pRecover->Enter(push); + } + else + { + throw X_Parser( X_Parser::x_UnexpectedToken, CurToken().Text(), aGlobalParseContext.CurFileName(), aGlobalParseContext.LineCount() ); + } + } break; + default: + csv_assert(false); + } // end switch(CurResult().eStackAction) +} + +ary::Cid +CodeExplorer::CurFile() const +{ + // KORR + return 0; +} + +const Token & +CodeExplorer::CurToken() const +{ + csv_assert(dpCurToken); + + return *dpCurToken; +} + +Cpp_PE & +CodeExplorer::CurEnv() const +{ + csv_assert(aEnvironments.size() > 0); + csv_assert(aEnvironments.back() != 0); + + return *aEnvironments.back(); +} + +Cpp_PE & +CodeExplorer::PushEnv() const +{ + TokenProcessing_Result & rCurResult = const_cast< TokenProcessing_Result& >(aGlobalParseContext.CurResult()); + Cpp_PE * ret = dynamic_cast< Cpp_PE* >(rCurResult.pEnv2Push); + csv_assert( ret != 0 ); + return *ret; +} + + + +} // namespace cpp + diff --git a/autodoc/source/parser/cpp/c_rcode.hxx b/autodoc/source/parser/cpp/c_rcode.hxx new file mode 100644 index 000000000000..b5559be6337f --- /dev/null +++ b/autodoc/source/parser/cpp/c_rcode.hxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * $RCSfile: c_rcode.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_C_RCODE_HXX +#define ADC_CPP_C_RCODE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <tokens/tokproct.hxx> + // COMPONENTS +#include <cosv/ploc.hxx> +#include "cxt2ary.hxx" + // PARAMETERS +#include <ary/ids.hxx> + + + +namespace ary +{ + namespace cpp + { + class RwGate; + } + + class Documentation; +} + +namespace cpp +{ + + class PE_File; + class Token; + class Cpp_PE; + +class CodeExplorer : private TokenProcessing_Types + +{ + public: + CodeExplorer( + ary::cpp::RwGate & io_rAryGate ); + ~CodeExplorer(); + + void StartNewFile(); + void Process_Token( + DYN cpp::Token & let_drToken ); + ary::Cid CurFile() const; + + // ACCESS + FileScope_EventHandler & + FileEventHandler() { return aGlobalParseContext; } + DocuDealer & DocuDistributor() { return aGlobalParseContext; } + + private: + typedef std::vector< cpp::Cpp_PE* > EnvironmentStack; + + void AcknowledgeResult(); + const Token & CurToken() const; + Cpp_PE & CurEnv() const; + Cpp_PE & PushEnv() const; + TokenProcessing_Result & + CurResult() { return aGlobalParseContext.CurResult(); } + + // DATA + ContextForAry aGlobalParseContext; + + EnvironmentStack aEnvironments; + Dyn<PE_File> pPE_File; + + ary::cpp::RwGate * pGate; + cpp::Token * dpCurToken; +}; + + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/cpp_pe.cxx b/autodoc/source/parser/cpp/cpp_pe.cxx new file mode 100644 index 000000000000..6fd305c5a8ed --- /dev/null +++ b/autodoc/source/parser/cpp/cpp_pe.cxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * $RCSfile: cpp_pe.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include "cpp_pe.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/info/codeinfo.hxx> +#include "cpp_tok.hxx" + + + + +namespace cpp { + +void +Cpp_PE::SetTokenResult( E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push ) +{ + rMyEnv.SetTokenResult( i_eDone, + i_eWhat2DoWithEnvStack, + i_pParseEnv2Push ); +} + +Cpp_PE::Cpp_PE( Cpp_PE * io_pParent ) + : ParseEnvironment( io_pParent ), + rMyEnv( io_pParent->Env() ) +{ + csv_assert(io_pParent != 0); +} + +Cpp_PE::Cpp_PE( EnvData & i_rEnv ) + : ParseEnvironment(0), + rMyEnv(i_rEnv) +{ +} + +void +Cpp_PE::StdHandlingOfSyntaxError( const char * i_sText ) +{ +// GlobalHandlingOfSyntaxError(i_sText, Env().CurFileName(), Env().LineCount()); + + SetTokenResult(not_done, pop_failure); +} + + +Cpp_PE * +Cpp_PE::Handle_ChildFailure() +{ + return 0; +} + +} // namespace cpp + diff --git a/autodoc/source/parser/cpp/cpp_pe.hxx b/autodoc/source/parser/cpp/cpp_pe.hxx new file mode 100644 index 000000000000..5c15a088afc6 --- /dev/null +++ b/autodoc/source/parser/cpp/cpp_pe.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * $RCSfile: cpp_pe.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_CPP_PE_HXX +#define ADC_CPP_CPP_PE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <semantic/parseenv.hxx> +#include "tokintpr.hxx" + // COMPONENTS +#include "pev.hxx" + // PARAMETERS +#include <ary/ids.hxx> + + +namespace cpp { + +class Cpp_PE : public ::ParseEnvironment, + public TokenInterpreter +{ + public: + typedef cpp::PeEnvironment EnvData; + + void SetTokenResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push = 0 ); + + virtual Cpp_PE * Handle_ChildFailure(); // Defaulted to 0. + + protected: + Cpp_PE( + Cpp_PE * io_pParent ); + Cpp_PE( + EnvData & i_rEnv ); + + EnvData & Env() const; + + void StdHandlingOfSyntaxError( + const char * i_sText ); + + private: + // DATA + EnvData & rMyEnv; +}; + +inline Cpp_PE::EnvData & +Cpp_PE::Env() const + { return rMyEnv; } + +} // namespace cpp + +#endif + diff --git a/autodoc/source/parser/cpp/cpp_tok.hxx b/autodoc/source/parser/cpp/cpp_tok.hxx new file mode 100644 index 000000000000..e54fbca64db1 --- /dev/null +++ b/autodoc/source/parser/cpp/cpp_tok.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * $RCSfile: cpp_tok.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_TOK_HXX +#define ADC_CPP_TOK_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/token.hxx> + // COMPONENTS + // PARAMETERS + + +namespace cpp { + + +class TokenInterpreter; + + +class Token : public TextToken +{ + public: + // LIFECYCLE + virtual ~Token() {} + + // OPERATIONS + virtual INT16 TypeId() const = 0; + virtual void DealOut( + ::TokenDealer & o_rDealer ); + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const = 0; +}; + + +} // namespace cpp + +#endif + + diff --git a/autodoc/source/parser/cpp/cx_base.cxx b/autodoc/source/parser/cpp/cx_base.cxx new file mode 100644 index 000000000000..a01e14013690 --- /dev/null +++ b/autodoc/source/parser/cpp/cx_base.cxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * $RCSfile: cx_base.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "cx_base.hxx" + +// NOT FULLY DECLARED SERVICES +#include <tokens/token.hxx> +#include "c_dealer.hxx" + + + +namespace cpp { + + + +Cx_Base::Cx_Base( TkpContext * io_pFollowUpContext ) + : pDealer(0), + pFollowUpContext(io_pFollowUpContext) + // pNewToken +{ +} + +bool +Cx_Base::PassNewToken() +{ + if (pNewToken) + { + pNewToken.Release()->DealOut(Dealer()); + return true; + } + return false; +} + +TkpContext & +Cx_Base::FollowUpContext() +{ + csv_assert(pFollowUpContext != 0); + return *pFollowUpContext; +} + +void +Cx_Base::AssignDealer( Distributor & o_rDealer ) +{ + pDealer = &o_rDealer; +} + + +} // namespace cpp + + + + diff --git a/autodoc/source/parser/cpp/cx_base.hxx b/autodoc/source/parser/cpp/cx_base.hxx new file mode 100644 index 000000000000..3bf0fa31747d --- /dev/null +++ b/autodoc/source/parser/cpp/cx_base.hxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * $RCSfile: cx_base.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_CX_BASE_HXX +#define ADC_CPP_CX_BASE_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> + // COMPONENTS + // PARAMETERS + + +class TextToken; + + +namespace cpp +{ + +class Distributor; + + +class Cx_Base : public ::TkpContext +{ + public: + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); + + virtual void AssignDealer( + Distributor & o_rDealer ); + protected: + // LIFECYCLE + Cx_Base( + TkpContext * io_pFollowUpContext ); + + void SetNewToken( + DYN ::TextToken * let_dpToken ); + void SetFollowUpContext( + TkpContext * io_pContext ); + + Distributor & Dealer() const; + + private: + // DATA + Distributor * pDealer; + TkpContext * pFollowUpContext; + Dyn< ::TextToken > pNewToken; +}; + + + + +inline void +Cx_Base::SetNewToken( DYN ::TextToken * let_dpToken ) + { pNewToken = let_dpToken; } +inline void +Cx_Base::SetFollowUpContext( TkpContext * io_pContext ) + { pFollowUpContext = io_pContext; } +inline Distributor & +Cx_Base::Dealer() const + { csv_assert(pDealer != 0); + return *pDealer; } + + + + + +} // namespace cpp + +#endif + diff --git a/autodoc/source/parser/cpp/cx_c_pp.cxx b/autodoc/source/parser/cpp/cx_c_pp.cxx new file mode 100644 index 000000000000..bad7d8d0917d --- /dev/null +++ b/autodoc/source/parser/cpp/cx_c_pp.cxx @@ -0,0 +1,229 @@ +/************************************************************************* + * + * $RCSfile: cx_c_pp.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "cx_c_pp.hxx" + + + +// NOT FULLY DECLARED SERVICES +#include "c_dealer.hxx" +#include <tokens/parseinc.hxx> +#include <x_parse.hxx> +#include "all_toks.hxx" + + +namespace cpp +{ + +Context_Preprocessor::Context_Preprocessor( TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext), + pContext_Parent(&i_rFollowUpContext), + pContext_PP_MacroParams( 0 ), + pContext_PP_Definition( new Context_PP_Definition(i_rFollowUpContext) ) +{ + pContext_PP_MacroParams = new Context_PP_MacroParams(*pContext_PP_Definition); +} + +void +Context_Preprocessor::ReadCharChain( CharacterSource & io_rText ) +{ + int o_rCount_BackslashedLineBreaks = 0; + + jumpOverWhite( io_rText ); + jumpToWhite( io_rText ); + const char * sPP_Keyword = io_rText.CutToken(); + if ( strcmp(sPP_Keyword, "define") == 0 ) + ReadDefine(io_rText); + else + ReadDefault(io_rText); +} + +void +Context_Preprocessor::AssignDealer( Distributor & o_rDealer ) +{ + Cx_Base::AssignDealer(o_rDealer); + pContext_PP_MacroParams->AssignDealer(o_rDealer); + pContext_PP_Definition->AssignDealer(o_rDealer); +} + +void +Context_Preprocessor::ReadDefault( CharacterSource & io_rText ) +{ + int o_rCount_BackslashedLineBreaks = 0; + jumpToEol(io_rText,o_rCount_BackslashedLineBreaks); + for ( ; o_rCount_BackslashedLineBreaks > 0; --o_rCount_BackslashedLineBreaks ) + Dealer().Deal_Eol(); + + if (io_rText.CurChar() != NULCH) + jumpOverEol(io_rText); + io_rText.CutToken(); + Dealer().Deal_Eol(); + SetNewToken(0); + SetFollowUpContext( pContext_Parent ); +} + +void +Context_Preprocessor::ReadDefine( CharacterSource & io_rText ) +{ + jumpOverWhite( io_rText ); + + char cNext = '\0'; + for ( cNext = io_rText.CurChar(); + static_cast<UINT8>(cNext) > 32 AND cNext != '('; + cNext = io_rText.MoveOn() ) + { } + + bool bMacro = cNext == '('; + + if ( NOT bMacro ) + { + SetNewToken( new Tok_DefineName(io_rText.CutToken()) ); + SetFollowUpContext( pContext_PP_Definition.Ptr() ); + } + else + { + SetNewToken( new Tok_MacroName(io_rText.CutToken()) ); + io_rText.MoveOn(); + io_rText.CutToken(); + SetFollowUpContext( pContext_PP_MacroParams.Ptr() ); + } +} + + +#if 0 // Version Autodoc before 2.0 +void +Context_Preprocessor::ReadCharChain( CharacterSource & io_rText ) +{ + int o_rCount_BackslashedLineBreaks = 0; + jumpToEol(io_rText,o_rCount_BackslashedLineBreaks); + for ( ; o_rCount_BackslashedLineBreaks > 0; --o_rCount_BackslashedLineBreaks ) + Dealer().Deal_Eol(); + + if (io_rText.CurChar() != NULCH) + jumpOverEol(io_rText); + io_rText.CutToken(); + Dealer().Deal_Eol(); + SetNewToken(0); +} +#endif + +Context_PP_MacroParams::Context_PP_MacroParams( Cx_Base & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext), + pContext_PP_Definition(&i_rFollowUpContext) +{ +} + +void +Context_PP_MacroParams::ReadCharChain( CharacterSource & io_rText ) +{ + jumpOverWhite( io_rText ); + // KORR_FUTURE Handling line breaks within macro parameters: + char cSeparator = jumpTo( io_rText, ',', ')' ); + csv_assert( cSeparator != 0 ); + + static char cBuf[100]; + strcpy( cBuf, io_rText.CutToken() ); + for ( uintt nLen = strlen(cBuf); + nLen > 0 AND cBuf[nLen-1] < 33; + --nLen ) + { } + cBuf[nLen] = '\0'; + SetNewToken( new Tok_MacroParameter(cBuf) ); + + io_rText.MoveOn(); + io_rText.CutToken(); + if ( cSeparator == ',') + SetFollowUpContext( this ); + else // Must be ')' + SetFollowUpContext( pContext_PP_Definition ); +} + +Context_PP_Definition::Context_PP_Definition( TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext), + pContext_Parent(&i_rFollowUpContext) +{ +} + +void +Context_PP_Definition::ReadCharChain( CharacterSource & io_rText ) +{ + int o_rCount_BackslashedLineBreaks = 0; + jumpToEol(io_rText,o_rCount_BackslashedLineBreaks); + for ( ; o_rCount_BackslashedLineBreaks > 0; --o_rCount_BackslashedLineBreaks ) + Dealer().Deal_Eol(); + SetNewToken( new Tok_PreProDefinition(io_rText.CutToken()) ); + if (io_rText.CurChar() != NULCH) + jumpOverEol(io_rText); + Dealer().Deal_Eol(); +} + + +} // namespace cpp + + + + + + + + + diff --git a/autodoc/source/parser/cpp/cx_c_pp.hxx b/autodoc/source/parser/cpp/cx_c_pp.hxx new file mode 100644 index 000000000000..d27fdc80b644 --- /dev/null +++ b/autodoc/source/parser/cpp/cx_c_pp.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * $RCSfile: cx_c_pp.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_CX_C_PP_HXX +#define ADC_CPP_CX_C_PP_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> +#include "cx_base.hxx" + // COMPONENTS + // PARAMETERS + + +namespace cpp +{ + +class Context_Preprocessor : public Cx_Base +{ + public: + Context_Preprocessor( + TkpContext & i_rFollowUpContext ); + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual void AssignDealer( + Distributor & o_rDealer ); + private: + // Locals + void ReadDefault( + CharacterSource & io_rText ); + void ReadDefine( + CharacterSource & io_rText ); + + // DATA + TkpContext * pContext_Parent; + Dyn<Cx_Base> pContext_PP_MacroParams; + Dyn<Cx_Base> pContext_PP_Definition; +}; + +class Context_PP_MacroParams : public Cx_Base +{ + public: + Context_PP_MacroParams( + Cx_Base & i_rFollowUpContext ); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + private: + // DATA + Cx_Base * pContext_PP_Definition; +}; + +class Context_PP_Definition : public Cx_Base +{ + public: + Context_PP_Definition( + TkpContext & i_rFollowUpContext ); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + + private: + // DATA + TkpContext * pContext_Parent; +}; + + +} // namespace cpp + +#endif + diff --git a/autodoc/source/parser/cpp/cx_c_std.cxx b/autodoc/source/parser/cpp/cx_c_std.cxx new file mode 100644 index 000000000000..586021b0b27a --- /dev/null +++ b/autodoc/source/parser/cpp/cx_c_std.cxx @@ -0,0 +1,564 @@ +/************************************************************************* + * + * $RCSfile: cx_c_std.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "cx_c_std.hxx" + + +// NOT FULLY DECLARED SERVICES +#include "all_toks.hxx" +#include "cx_c_pp.hxx" +#include "cx_c_sub.hxx" +#include <tools/tkpchars.hxx> +#include <tokens/tkpstama.hxx> +#include <x_parse.hxx> +#include "c_dealer.hxx" + + +namespace cpp { + + +const intt C_nCppInitialNrOfStati = 600; +const intt C_nStatusSize = 128; + + + +const uintt nF_fin_Error = 1; +const uintt nF_fin_CreateWithoutText = 2; +const uintt nF_fin_CreateWithText = 3; +const uintt nF_fin_Ignore = 4; +const uintt nF_fin_EOL = 5; +const uintt nF_fin_EOF = 6; +const uintt nF_fin_Bezeichner = 7; + +const uintt nF_goto_Preprocessor = 10; +const uintt nF_goto_Comment = 11; +const uintt nF_goto_Docu = 12; +const uintt nF_goto_Const = 13; +const uintt nF_goto_UnblockMacro = 14; + +// Token create functions for the state machine: +DYN TextToken * TCF_Identifier(const char * text) { return new Tok_Identifier(text); } + +DYN TextToken * TCF_operator(const char *) { return new Tok_operator; } +DYN TextToken * TCF_class(const char *) { return new Tok_class; } +DYN TextToken * TCF_struct(const char *) { return new Tok_struct; } +DYN TextToken * TCF_union(const char *) { return new Tok_union; } +DYN TextToken * TCF_enum(const char *) { return new Tok_enum; } +DYN TextToken * TCF_typedef(const char *) { return new Tok_typedef; } +DYN TextToken * TCF_public(const char *) { return new Tok_public; } +DYN TextToken * TCF_protected(const char *) { return new Tok_protected; } +DYN TextToken * TCF_private(const char *) { return new Tok_private; } +DYN TextToken * TCF_template(const char *) { return new Tok_template; } +DYN TextToken * TCF_virtual(const char *) { return new Tok_virtual; } +DYN TextToken * TCF_friend(const char *) { return new Tok_friend; } +DYN TextToken * TCF_Tilde(const char *) { return new Tok_Tilde; } +DYN TextToken * TCF_const(const char *) { return new Tok_const; } +DYN TextToken * TCF_volatile(const char *) { return new Tok_volatile; } +DYN TextToken * TCF_extern(const char *) { return new Tok_extern; } +DYN TextToken * TCF_static(const char *) { return new Tok_static; } +DYN TextToken * TCF_mutable(const char *) { return new Tok_mutable; } +DYN TextToken * TCF_register(const char *) { return new Tok_register; } +DYN TextToken * TCF_inline(const char *) { return new Tok_inline; } +DYN TextToken * TCF_explicit(const char *) { return new Tok_explicit; } +DYN TextToken * TCF_namespace(const char *) { return new Tok_namespace; } +DYN TextToken * TCF_using(const char *) { return new Tok_using; } +DYN TextToken * TCF_throw(const char *) { return new Tok_throw; } +DYN TextToken * TCF_SwBracketOpen(const char *) { return new Tok_SwBracket_Left; } +DYN TextToken * TCF_SwBracketClose(const char *) { return new Tok_SwBracket_Right; } +DYN TextToken * TCF_ArBracketOpen(const char *) { return new Tok_ArrayBracket_Left; } +DYN TextToken * TCF_ArBracketClose(const char *) { return new Tok_ArrayBracket_Right; } +DYN TextToken * TCF_BracketOpen(const char *) { return new Tok_Bracket_Left; } +DYN TextToken * TCF_BracketClose(const char *) { return new Tok_Bracket_Right; } +DYN TextToken * TCF_DblColon(const char *) { return new Tok_DoubleColon; } +DYN TextToken * TCF_Semikolon(const char *) { return new Tok_Semicolon; } +DYN TextToken * TCF_Komma(const char *) { return new Tok_Comma; } +DYN TextToken * TCF_Colon(const char *) { return new Tok_Colon; } +DYN TextToken * TCF_Zuweisung(const char *) { return new Tok_Assign; } +DYN TextToken * TCF_Smaller(const char *) { return new Tok_Less; } +DYN TextToken * TCF_Bigger(const char *) { return new Tok_Greater; } +DYN TextToken * TCF_Stern(const char *) { return new Tok_Asterix; } +DYN TextToken * TCF_Ampersand(const char *) { return new Tok_AmpersAnd; } +DYN TextToken * TCF_Ellipse(const char *) { return new Tok_Ellipse; } + + // Operators +DYN TextToken * TCF_Operator(const char * text) { return new Tok_Operator(text); } + +DYN TextToken * TCF_BuiltInType(const char * text) { return new Tok_BuiltInType(text); } +DYN TextToken * TCF_TypeModifier(const char * text) { return new Tok_TypeSpecializer(text); } + +DYN TextToken * TCF_Eof(const char *) { return new Tok_Eof; } + + + +Context_CppStd::Context_CppStd( DYN autodoc::TkpDocuContext & let_drContext_Docu ) + : Cx_Base(0), + aStateMachine(C_nStatusSize,C_nCppInitialNrOfStati), + pDocuContext(&let_drContext_Docu), + pContext_Comment(0), + pContext_Preprocessor(0), + pContext_ConstString(0), + pContext_ConstChar(0), + pContext_ConstNumeric(0), + pContext_UnblockMacro(0) +{ + pDocuContext->SetParentContext(*this,"*/"); + + pContext_Comment = new Context_Comment(*this); + pContext_Preprocessor = new Context_Preprocessor(*this); + pContext_ConstString = new Context_ConstString(*this); + pContext_ConstChar = new Context_ConstChar(*this); + pContext_ConstNumeric = new Context_ConstNumeric(*this); + pContext_UnblockMacro = new Context_UnblockMacro(*this); + + SetupStateMachine(); +} + +Context_CppStd::~Context_CppStd() +{ +} + +void +Context_CppStd::ReadCharChain( CharacterSource & io_rText ) +{ + SetNewToken(0); + + TextToken::F_CRTOK fTokenCreateFunction = 0; + StmBoundsStatus & rBound = aStateMachine.GetCharChain(fTokenCreateFunction, io_rText); + + // !!! + // The order of the next two lines is essential, because + // pFollowUpContext may be changed by PerformStatusFunction() also, + // which then MUST override the previous assignment. + SetFollowUpContext(rBound.FollowUpContext()); + PerformStatusFunction(rBound.StatusFunctionNr(), fTokenCreateFunction, io_rText); +} + +void +Context_CppStd::AssignDealer( Distributor & o_rDealer ) +{ + Cx_Base::AssignDealer(o_rDealer); + + pDocuContext->AssignDealer(o_rDealer); + pContext_Comment->AssignDealer(o_rDealer); + pContext_Preprocessor->AssignDealer(o_rDealer); + pContext_ConstString->AssignDealer(o_rDealer); + pContext_ConstChar->AssignDealer(o_rDealer); + pContext_ConstNumeric->AssignDealer(o_rDealer); + pContext_UnblockMacro->AssignDealer(o_rDealer); +} + +void +Context_CppStd::PerformStatusFunction( uintt i_nStatusSignal, + F_CRTOK i_fTokenCreateFunction, + CharacterSource & io_rText ) +{ + switch (i_nStatusSignal) + { + case nF_fin_CreateWithoutText: + io_rText.CutToken(); + csv_assert(i_fTokenCreateFunction != 0); + SetNewToken( (*i_fTokenCreateFunction)(0) ); + break; + case nF_fin_CreateWithText: + csv_assert(i_fTokenCreateFunction != 0); + SetNewToken( (*i_fTokenCreateFunction)(io_rText.CutToken()) ); + break; + case nF_fin_Ignore: + io_rText.CutToken(); + SetNewToken(0); + break; + case nF_fin_EOL: + io_rText.CutToken(); + SetNewToken(0); + Dealer().Deal_Eol(); + break; + case nF_fin_EOF: + io_rText.CutToken(); + SetNewToken( TCF_Eof(0) ); + break; + case nF_fin_Bezeichner: + SetNewToken( TCF_Identifier(io_rText.CutToken()) ); + break; + + case nF_goto_Preprocessor: + io_rText.CutToken(); + SetNewToken(0); + break; + case nF_goto_Comment: + SetNewToken(0); + pContext_Comment->SetMode_IsMultiLine( io_rText.CutToken()[1] == '*' ); + break; + case nF_goto_Docu: + SetNewToken(0); + pDocuContext->SetMode_IsMultiLine( io_rText.CutToken()[1] == '*' ); + break; + case nF_goto_Const: + SetNewToken(0); + break; + case nF_goto_UnblockMacro: + SetNewToken(0); + break; + + case nF_fin_Error: + default: + { + udmstri sCurChar( &io_rText.CurChar(), 1 ); + throw X_Parser( X_Parser::x_InvalidChar, sCurChar, udmstri::Null_(), 0 ); + } + } // end switch (i_nStatusSignal) +} + +void +Context_CppStd::SetupStateMachine() +{ + // Besondere Array-Stati (kein Tokenabschluss oder Kontextwechsel): + const INT16 top = 0; // Top-Status + const INT16 wht = 1; // Whitespace-berlese-Status + const INT16 bez = 2; // Bezeichner-lese-Status + + // Tokenfinish-Stati: + const INT16 finError = 3; + const INT16 finIgnore = 4; + const INT16 finBezeichner = 5; + const INT16 finKeyword = 6; + const INT16 finPunctuation = 7; + const INT16 finBiType = 8; + const INT16 finTypeModifier = 9; + const INT16 finEOL = 10; + const INT16 finEOF = 11; + + // Kontextwechsel-Stati: + const INT16 gotoComment = 12; + const INT16 gotoDocu = 13; + const INT16 gotoPreprocessor = 14; + const INT16 gotoConstString = 15; + const INT16 gotoConstChar = 16; + const INT16 gotoConstNumeric = 17; + const INT16 gotoUnblockMacro = 18; + + // Abbreviations to be used in status tables: + const INT16 err = finError; + const INT16 fig = finIgnore; + const INT16 fbz = finBezeichner; + const INT16 fof = finEOF; + const INT16 cst = gotoConstString; + const INT16 cch = gotoConstChar; + const INT16 cnr = gotoConstNumeric; + + + /// Zeros - '0' - will be replaced by AddToken(). + + const INT16 A_nTopStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht, 0,wht,wht, 0,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // 16 ... + wht, 0,cst, 0,err, 0, 0,cch, 0, 0, 0, 0, 0, 0, 0, 0, + cnr,cnr,cnr,cnr,cnr,cnr,cnr,cnr,cnr,cnr, 0, 0, 0, 0, 0, 0, // 48 ... + 0,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 0, 0, 0, 0,bez, // 80 ... + 0,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 0, 0, 0, 0,err, // 80 ... + }; + + const INT16 A_nWhitespaceStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht,fig,wht,wht,fig,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // 16 ... + wht,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, // 48 ... + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, // 80 ... + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,err + }; + + const INT16 A_nBezeichnerStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fbz,err,err,err,err,err,err,err,err,fbz,fbz,fbz,fbz,fbz,err,err, + err,err,err,err,err,err,err,err,err,err,fbz,err,err,err,err,err, // 16 ... + fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,fbz,fbz, // 48 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,bez, // 80 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,err + }; + + + const INT16 A_nOperatorDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 16 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 48 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 80 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err + }; + + const INT16 A_nBezDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fbz,err,err,err,err,err,err,err,err,fbz,fbz,fbz,fbz,fbz,err,err, + err,err,err,err,err,err,err,err,err,err,fbz,err,err,err,err,err, // 16 ... + fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,fbz,fbz, // 48 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,bez, // 80 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,err + }; + + DYN StmArrayStatus * dpStatusTop + = new StmArrayStatus( C_nStatusSize, A_nTopStatus, 0, true); + DYN StmArrayStatus * dpStatusWhite + = new StmArrayStatus( C_nStatusSize, A_nWhitespaceStatus, 0, true); + DYN StmArrayStatus * dpStatusBez + = new StmArrayStatus( C_nStatusSize, A_nBezeichnerStatus, TCF_Identifier, true); + + DYN StmBoundsStatus * dpBst_finError + = new StmBoundsStatus( *this, TkpContext::Null_(), nF_fin_Error, true ); + DYN StmBoundsStatus * dpBst_finIgnore + = new StmBoundsStatus( *this, *this, nF_fin_Ignore, true ); + DYN StmBoundsStatus * dpBst_finBezeichner + = new StmBoundsStatus( *this, *this, nF_fin_Bezeichner, true ); + DYN StmBoundsStatus * dpBst_finKeyword + = new StmBoundsStatus( *this, *this, nF_fin_CreateWithoutText, false ); + DYN StmBoundsStatus * dpBst_finPunctuation + = new StmBoundsStatus( *this, *this, nF_fin_CreateWithText, false ); + DYN StmBoundsStatus * dpBst_finBiType + = new StmBoundsStatus( *this, *this, nF_fin_CreateWithText, false ); + DYN StmBoundsStatus * dpBst_finTypeModifier + = new StmBoundsStatus( *this, *this, nF_fin_CreateWithText, false ); + DYN StmBoundsStatus * dpBst_finEOL + = new StmBoundsStatus( *this, *this, nF_fin_EOL, false ); + DYN StmBoundsStatus * dpBst_finEOF + = new StmBoundsStatus( *this, TkpContext::Null_(), nF_fin_EOF, false ); + + DYN StmBoundsStatus * dpBst_gotoComment + = new StmBoundsStatus( *this, *pContext_Comment, nF_goto_Comment, false ); + DYN StmBoundsStatus * dpBst_gotoDocu + = new StmBoundsStatus( *this, *pDocuContext, nF_goto_Docu, false ); + DYN StmBoundsStatus * dpBst_gotoPreprocessor + = new StmBoundsStatus( *this, *pContext_Preprocessor, nF_goto_Preprocessor, false ); + DYN StmBoundsStatus * dpBst_gotoConstString + = new StmBoundsStatus( *this, *pContext_ConstString, nF_goto_Const, false ); + DYN StmBoundsStatus * dpBst_gotoConstChar + = new StmBoundsStatus( *this, *pContext_ConstChar, nF_goto_Const, false ); + DYN StmBoundsStatus * dpBst_gotoConstNumeric + = new StmBoundsStatus( *this, *pContext_ConstNumeric, nF_goto_Const, false ); + DYN StmBoundsStatus * dpBst_gotoUnblockMacro + = new StmBoundsStatus( *this, *pContext_UnblockMacro, nF_goto_UnblockMacro, false ); + + // dpMain aufbauen: + aStateMachine.AddStatus(dpStatusTop); + + aStateMachine.AddStatus(dpStatusWhite); + aStateMachine.AddStatus(dpStatusBez); + + aStateMachine.AddStatus(dpBst_finError); + aStateMachine.AddStatus(dpBst_finIgnore); + aStateMachine.AddStatus(dpBst_finBezeichner); + aStateMachine.AddStatus(dpBst_finKeyword); + aStateMachine.AddStatus(dpBst_finPunctuation); + aStateMachine.AddStatus(dpBst_finBiType); + aStateMachine.AddStatus(dpBst_finTypeModifier); + aStateMachine.AddStatus(dpBst_finEOL); + aStateMachine.AddStatus(dpBst_finEOF); + + aStateMachine.AddStatus(dpBst_gotoComment); + aStateMachine.AddStatus(dpBst_gotoDocu); + aStateMachine.AddStatus(dpBst_gotoPreprocessor); + aStateMachine.AddStatus(dpBst_gotoConstString); + aStateMachine.AddStatus(dpBst_gotoConstChar); + aStateMachine.AddStatus(dpBst_gotoConstNumeric); + aStateMachine.AddStatus(dpBst_gotoUnblockMacro); + + // Identifier + + // Keywords and other unique Tokens + aStateMachine.AddToken("operator",TCF_operator,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("class",TCF_class,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("struct",TCF_struct,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("union",TCF_union,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("enum",TCF_enum,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("typedef",TCF_typedef,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("public",TCF_public,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("protected",TCF_protected,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("private",TCF_private,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("template",TCF_template,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("virtual",TCF_virtual,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("friend",TCF_friend,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("~",TCF_Tilde,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("const",TCF_const,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("volatile",TCF_volatile,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("extern",TCF_extern,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("static",TCF_static,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("mutable",TCF_mutable,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("register",TCF_register,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("inline",TCF_inline,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("explicit",TCF_explicit,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("namespace",TCF_namespace,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("using",TCF_using,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("throw",TCF_throw,A_nBezDefStatus,finKeyword); + aStateMachine.AddToken("{",TCF_SwBracketOpen,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("}",TCF_SwBracketClose,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("[",TCF_ArBracketOpen,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("]",TCF_ArBracketClose,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("(",TCF_BracketOpen,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken(")",TCF_BracketClose,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("::",TCF_DblColon,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken(";",TCF_Semikolon,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken(",",TCF_Komma,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken(":",TCF_Colon,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("=",TCF_Zuweisung,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("<",TCF_Smaller,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken(">",TCF_Bigger,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("*",TCF_Stern,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("&",TCF_Ampersand,A_nOperatorDefStatus,finKeyword); + aStateMachine.AddToken("...",TCF_Ellipse,A_nOperatorDefStatus,finKeyword); + + // Operators + aStateMachine.AddToken("==",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("!=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("<=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken(">=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("&&",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("||",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("!",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("new",TCF_Operator,A_nBezDefStatus,finPunctuation); + aStateMachine.AddToken("delete",TCF_Operator,A_nBezDefStatus,finPunctuation); + aStateMachine.AddToken("sizeof",TCF_Operator,A_nBezDefStatus,finPunctuation); + aStateMachine.AddToken("typeid",TCF_Operator,A_nBezDefStatus,finPunctuation); + aStateMachine.AddToken("+",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("-",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("/",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("%",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("^",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("|",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("<<",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken(">>",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken(".",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("->",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("?",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("+=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("-=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("*=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("/=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("%=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("&=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("|=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("^=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken("<<=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + aStateMachine.AddToken(">>=",TCF_Operator,A_nOperatorDefStatus,finPunctuation); + + // Builtin types + aStateMachine.AddToken("char", TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("short", TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("int", TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("long", TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("float", TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("double",TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("wchar_t",TCF_BuiltInType, A_nBezDefStatus, finBiType); + aStateMachine.AddToken("size_t",TCF_BuiltInType, A_nBezDefStatus, finBiType); + + // Type modifiers + aStateMachine.AddToken("signed", TCF_TypeModifier, A_nBezDefStatus, finTypeModifier); + aStateMachine.AddToken("unsigned", TCF_TypeModifier, A_nBezDefStatus, finTypeModifier); + + // To ignore + aStateMachine.AddToken("auto", 0, A_nBezDefStatus, finIgnore); + aStateMachine.AddToken("typename", 0, A_nBezDefStatus, finIgnore); + aStateMachine.AddToken("_cdecl", 0, A_nBezDefStatus, finIgnore); + aStateMachine.AddToken("__cdecl", 0, A_nBezDefStatus, finIgnore); + aStateMachine.AddToken("__stdcall", 0, A_nBezDefStatus, finIgnore); + aStateMachine.AddToken("__fastcall",0, A_nBezDefStatus, finIgnore); + aStateMachine.AddToken("/**/", 0, A_nOperatorDefStatus,finIgnore); + + // Context changers + aStateMachine.AddToken("#", 0, A_nOperatorDefStatus, gotoPreprocessor); + aStateMachine.AddToken("#undef",0, A_nOperatorDefStatus, gotoPreprocessor); + aStateMachine.AddToken("#unblock-", + 0, A_nOperatorDefStatus, gotoUnblockMacro); + aStateMachine.AddToken("/*", 0, A_nOperatorDefStatus, gotoComment); + aStateMachine.AddToken("//", 0, A_nOperatorDefStatus, gotoComment); + aStateMachine.AddToken("/**", 0, A_nOperatorDefStatus, gotoDocu); + aStateMachine.AddToken("///", 0, A_nOperatorDefStatus, gotoDocu); + + // Line ends + // regular + aStateMachine.AddToken("\r\n", 0, A_nOperatorDefStatus, finEOL); + aStateMachine.AddToken("\n", 0, A_nOperatorDefStatus, finEOL); + aStateMachine.AddToken("\r", 0, A_nOperatorDefStatus, finEOL); + // To ignore in some cases(may be only at preprocessor?), but + // linecount has to be incremented. + aStateMachine.AddToken("\\\r\n",0, A_nOperatorDefStatus, finEOL); + aStateMachine.AddToken("\\\n", 0, A_nOperatorDefStatus, finEOL); + aStateMachine.AddToken("\\\r", 0, A_nOperatorDefStatus, finEOL); +}; + + +} // namespace cpp + + + + diff --git a/autodoc/source/parser/cpp/cx_c_std.hxx b/autodoc/source/parser/cpp/cx_c_std.hxx new file mode 100644 index 000000000000..799bfa73cbd7 --- /dev/null +++ b/autodoc/source/parser/cpp/cx_c_std.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * $RCSfile: cx_c_std.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_CX_C_STD_HXX +#define ADC_CPP_CX_C_STD_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> +#include "cx_base.hxx" + // COMPONENTS +#include <tokens/tkpstama.hxx> + // PARAMETERS + + + +namespace cpp { + +class Context_Comment; + +/** +*/ +class Context_CppStd : public Cx_Base, + private StateMachineContext +{ + public: + // LIFECYCLE + Context_CppStd( + DYN autodoc::TkpDocuContext & + let_drContext_Docu ); + ~Context_CppStd(); + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual void AssignDealer( + Distributor & o_rDealer ); + private: + // SERVICE FUNCTIONS + void PerformStatusFunction( + uintt i_nStatusSignal, + StmArrayStatus::F_CRTOK + i_fTokenCreateFunction, + CharacterSource & io_rText ); + void SetupStateMachine(); + + // DATA + StateMachine aStateMachine; + + // Contexts + Dyn<autodoc::TkpDocuContext> + pDocuContext; + + Dyn<Context_Comment> + pContext_Comment; + Dyn<Cx_Base> pContext_Preprocessor; + Dyn<Cx_Base> pContext_ConstString; + Dyn<Cx_Base> pContext_ConstChar; + Dyn<Cx_Base> pContext_ConstNumeric; + Dyn<Cx_Base> pContext_UnblockMacro; +}; + + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/cx_c_sub.cxx b/autodoc/source/parser/cpp/cx_c_sub.cxx new file mode 100644 index 000000000000..99fc8953b213 --- /dev/null +++ b/autodoc/source/parser/cpp/cx_c_sub.cxx @@ -0,0 +1,198 @@ +/************************************************************************* + * + * $RCSfile: cx_c_sub.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "cx_c_sub.hxx" + + + +// NOT FULLY DECLARED SERVICES +#include "c_dealer.hxx" +#include <tokens/parseinc.hxx> +#include <x_parse.hxx> +#include "all_toks.hxx" + + +namespace cpp { + + + +void +Context_Comment::ReadCharChain( CharacterSource & io_rText ) +{ + // KORR + // Counting of lines must be implemented. + if (bCurrentModeIsMultiline) + { + char cNext = NULCH; + + do { + do { + cNext = jumpTo( io_rText,'*',char(10) ); + if (cNext == NULCH) + throw X_Parser( X_Parser::x_UnexpectedEOF, "", udmstri::Null_(), 0 ); + else if ( cNext == char(10) ) + { + jumpOverEol(io_rText); + Dealer().Deal_Eol(); + } + } while ( cNext != '*'); + cNext = jumpOver(io_rText,'*'); + if (cNext == NULCH) + throw X_Parser( X_Parser::x_UnexpectedEOF, "", udmstri::Null_(), 0 ); + } while (cNext != '/'); + io_rText.MoveOn(); + io_rText.CutToken(); + SetNewToken(0); + } + else // + { + int o_rCount_BackslashedLineBreaks = 0; + jumpToEol(io_rText,o_rCount_BackslashedLineBreaks); + for ( ; o_rCount_BackslashedLineBreaks > 0; --o_rCount_BackslashedLineBreaks ) + Dealer().Deal_Eol(); + + if (io_rText.CurChar() != NULCH) + jumpOverEol(io_rText); + io_rText.CutToken(); + Dealer().Deal_Eol(); + SetNewToken(0); + } // endif +} + + +void +Context_ConstString::ReadCharChain( CharacterSource & io_rText ) +{ + char cNext = io_rText.MoveOn(); + + while (cNext != '"') + { // Get one complete string constant: "...." + while (cNext != '"' AND cNext != '\\') + { // Get string till next '\\' + cNext = io_rText.MoveOn(); + } + if (cNext == '\\') + { + io_rText.MoveOn(); + cNext = io_rText.MoveOn(); + } + } + io_rText.MoveOn(); + SetNewToken(new Tok_Constant(io_rText.CutToken())); +} + +void +Context_ConstChar::ReadCharChain( CharacterSource & io_rText ) +{ + char cNext = io_rText.MoveOn(); + + while (cNext != '\'') + { // Get one complete char constant: "...." + while (cNext != '\'' AND cNext != '\\') + { // Get string till next '\\' + cNext = io_rText.MoveOn(); + } + if (cNext == '\\') + { + io_rText.MoveOn(); + cNext = io_rText.MoveOn(); + } + } + io_rText.MoveOn(); + SetNewToken(new Tok_Constant(io_rText.CutToken())); +} + +void +Context_ConstNumeric::ReadCharChain(CharacterSource & io_rText) +{ + char cNext = 0; + + do { + do { + cNext = tolower(io_rText.MoveOn()); + } while (cNext != 'e' AND isalnum(cNext) OR cNext == '.'); + if (cNext == 'e') + { + cNext = io_rText.MoveOn(); + if (cNext == '+' OR cNext == '-') + cNext = io_rText.MoveOn(); + } // endif + } while (isalnum(cNext) OR cNext == '.'); // Reicht aus, wenn Zahlen korrekt geschrieben sind + SetNewToken(new Tok_Constant(io_rText.CutToken())); +} + +void +Context_UnblockMacro::ReadCharChain(CharacterSource & io_rText) +{ + char cNext = jumpToWhite(io_rText); + SetNewToken(new Tok_UnblockMacro( io_rText.CutToken() + strlen("#unblock-") )); +} + +} // namespace cpp + + + + + + + + diff --git a/autodoc/source/parser/cpp/cx_c_sub.hxx b/autodoc/source/parser/cpp/cx_c_sub.hxx new file mode 100644 index 000000000000..32705f98517d --- /dev/null +++ b/autodoc/source/parser/cpp/cx_c_sub.hxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * $RCSfile: cx_c_sub.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_CX_C_SUB_HXX +#define ADC_CPP_CX_C_SUB_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> +#include "cx_base.hxx" + // COMPONENTS + // PARAMETERS + + +namespace cpp { + + +class Context_Comment : public Cx_Base +{ + public: + Context_Comment( + TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetMode_IsMultiLine( + bool i_bTrue ) + { bCurrentModeIsMultiline = i_bTrue; } + private: + bool bCurrentModeIsMultiline; +}; + +class Context_ConstString : public Cx_Base +{ + public: + Context_ConstString( + TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + +class Context_ConstChar : public Cx_Base +{ + public: + Context_ConstChar( + TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + +class Context_ConstNumeric : public Cx_Base +{ + public: + Context_ConstNumeric( + TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + +class Context_UnblockMacro : public Cx_Base +{ + public: + Context_UnblockMacro( + TkpContext & i_rFollowUpContext ) + : Cx_Base(&i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/cxt2ary.cxx b/autodoc/source/parser/cpp/cxt2ary.cxx new file mode 100644 index 000000000000..35835ab62e80 --- /dev/null +++ b/autodoc/source/parser/cpp/cxt2ary.cxx @@ -0,0 +1,405 @@ +/************************************************************************* + * + * $RCSfile: cxt2ary.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include "cxt2ary.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/re.hxx> +#include <ary/docu.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_define.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_enuval.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_macro.hxx> +#include <ary/cpp/c_rwgate.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/info/docstore.hxx> +#include "icprivow.hxx" + +// Implementationheader, only to be used in this file! +#include "sfscope.hxx" +#include "sownstck.hxx" +#include "sdocdist.hxx" +#include "srecover.hxx" + + + + + +namespace cpp +{ + +using ary::cpp::E_Protection; + +ContextForAry::ContextForAry( ary::cpp::RwGate & io_rAryGate ) + : pGate(&io_rAryGate), + // aTokenResult, + pFileScopeInfo( new S_FileScopeInfo ), + pOwnerStack( new S_OwnerStack ), + pDocuDistributor( new S_DocuDistributor ), + pRecoveryGuard( new S_RecoveryGuard ) +{ + OpenNamespace( pGate->GlobalNamespace() ); +} + +ContextForAry::~ContextForAry() +{ +} + +ary::cpp::ProjectGroup & +ContextForAry::inq_CurProjectGroup() const +{ + csv_assert(pFileScopeInfo->pCurProject != 0); + + return *pFileScopeInfo->pCurProject; +} + +ary::cpp::FileGroup & +ContextForAry::inq_CurFileGroup() const +{ + csv_assert(pFileScopeInfo->pCurFile != 0); + + return *pFileScopeInfo->pCurFile; +} + +ary::cpp::Namespace & +ContextForAry::inq_CurNamespace() const +{ + return pOwnerStack->CurNamespace(); +} + +ary::cpp::Class * +ContextForAry::inq_CurClass() const +{ + return pOwnerStack->CurClass(); +} + +ary::cpp::Enum * +ContextForAry::inq_CurEnum() const +{ + return pOwnerStack->CurEnum(); +} + + +ary::cpp::InputContext::Owner & +ContextForAry::inq_CurOwner() const +{ + return pOwnerStack->CurOwner(); +} + +E_Protection +ContextForAry::inq_CurProtection() const +{ + return pOwnerStack->CurProtection(); +} + +void +ContextForAry::do_SetTokenResult( E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push ) +{ + aTokenResult.eDone = i_eDone; + aTokenResult.eStackAction = i_eWhat2DoWithEnvStack; + aTokenResult.pEnv2Push = i_pParseEnv2Push; +} + +void +ContextForAry::do_OpenNamespace( ary::cpp::Namespace & io_rOpenedNamespace ) +{ + pOwnerStack->OpenNamespace( io_rOpenedNamespace ); +} + +void +ContextForAry::do_OpenExternC( bool i_bOnlyForOneDeclaration ) +{ + pOwnerStack->OpenExternC(); + // KORR + // use i_bOnlyForOneDeclaration +} + +void +ContextForAry::do_OpenClass( ary::cpp::Class & io_rOpenedClass ) +{ + pOwnerStack->OpenClass(io_rOpenedClass); + pDocuDistributor->SetCurrentlyStoredRe(io_rOpenedClass); +} + +void +ContextForAry::do_OpenEnum( ary::cpp::Enum & io_rOpenedEnum ) +{ + pOwnerStack->OpenEnum(io_rOpenedEnum); + pDocuDistributor->SetCurrentlyStoredRe(io_rOpenedEnum); +} + +void +ContextForAry::do_CloseBlock() +{ + pOwnerStack->CloseBlock(); +} + +void +ContextForAry::do_CloseClass() +{ + pOwnerStack->CloseClass(); +} + +void +ContextForAry::do_CloseEnum() +{ + pOwnerStack->CloseEnum(); +} + +void +ContextForAry::do_SetCurProtection( ary::cpp::E_Protection i_eProtection ) +{ + pOwnerStack->SetCurProtection(i_eProtection); +} + +void +ContextForAry::do_OpenTemplate( const StringVector & i_rParameters ) +{ + pFileScopeInfo->pCurTemplateParameters = new StringVector(i_rParameters); +} + +DYN StringVector * +ContextForAry::do_Get_CurTemplateParameters() +{ + return pFileScopeInfo->pCurTemplateParameters.Release(); +} + +void +ContextForAry::do_Event_Class_FinishedBase( const udmstri & i_sBaseName ) +{ + // KORR_FUTURE +} + +void +ContextForAry::do_Event_Store_Typedef( ary::cpp::Typedef & io_rTypedef ) +{ + pDocuDistributor->SetCurrentlyStoredRe(io_rTypedef); +} + +void +ContextForAry::do_Event_Store_EnumValue( ary::cpp::EnumValue & io_rEnumValue ) +{ + pDocuDistributor->SetCurrentlyStoredRe(io_rEnumValue); +} + +void +ContextForAry::do_Event_Store_CppDefinition( ary::cpp::CppDefinition & io_rDefinition ) +{ + pDocuDistributor->SetCurrentlyStoredRe(io_rDefinition); +} + +void +ContextForAry::do_Event_EnterFunction_ParameterList() +{ + // KORR_FUTURE + // Inform pDocuDistributor about possibility of parameters' inline documentation. +} + +void +ContextForAry::do_Event_Function_FinishedParameter( const udmstri & i_sParameterName ) +{ + // KORR_FUTURE +} + +void +ContextForAry::do_Event_LeaveFunction_ParameterList() +{ + // KORR_FUTURE +} + +void +ContextForAry::do_Event_EnterFunction_Implementation() +{ + // KORR_FUTURE +} + +void +ContextForAry::do_Event_LeaveFunction_Implementation() +{ + // KORR_FUTURE +} + +void +ContextForAry::do_Event_Store_Function( ary::cpp::Function & io_rFunction ) +{ + pDocuDistributor->SetCurrentlyStoredRe(io_rFunction); +} + + +void +ContextForAry::do_Event_Store_Variable( ary::cpp::Variable & io_rVariable ) +{ + pDocuDistributor->SetCurrentlyStoredRe(io_rVariable); +} + +void +ContextForAry::do_TakeDocu( DYN ary::Documentation & let_drInfo ) +{ + let_drInfo.Store2(*pDocuDistributor); +} + +void +ContextForAry::do_StartWaitingFor_Recovery() +{ + pRecoveryGuard->StartWaitingFor_Recovery(); +} + +ary::cpp::RwGate & +ContextForAry::inq_AryGate() const +{ + return * const_cast< ary::cpp::RwGate* >(pGate); +} + +const ary::cpp::InputContext & +ContextForAry::inq_Context() const +{ + return *this; +} + +udmstri +ContextForAry::inq_CurFileName() const +{ + return pFileScopeInfo->sCurFileName; +} + +uintt +ContextForAry::inq_LineCount() const +{ + return pFileScopeInfo->nLineCount; +} + +bool +ContextForAry::inq_IsWaitingFor_Recovery() const +{ + return pRecoveryGuard->IsWithinRecovery(); +} + +bool +ContextForAry::inq_IsExternC() const +{ + return pOwnerStack->IsExternC(); +} + +void +ContextForAry::do_SetCurProject( ary::cpp::ProjectGroup & io_rCurProject ) +{ + pFileScopeInfo->pCurProject = &io_rCurProject; +} + +void +ContextForAry::do_SetCurFile( ary::cpp::FileGroup & io_rCurFile, + const udmstri & i_sFileName ) +{ + pFileScopeInfo->pCurFile = &io_rCurFile; + pFileScopeInfo->sCurFileName = i_sFileName; + pFileScopeInfo->nLineCount = 0; + pFileScopeInfo->pCurTemplateParameters = 0; + + pOwnerStack->Reset(); + pDocuDistributor->Reset(); + pRecoveryGuard->Reset(); +} + +void +ContextForAry::do_Event_IncrLineCount() +{ + ++pFileScopeInfo->nLineCount; + pDocuDistributor->Event_LineBreak(); +} + +void +ContextForAry::do_Event_SwBracketOpen() +{ + pRecoveryGuard->Hdl_SwBracketOpen(); +} + +void +ContextForAry::do_Event_SwBracketClose() +{ + pRecoveryGuard->Hdl_SwBracketClose(); +} + +void +ContextForAry::do_Event_Semicolon() +{ + pRecoveryGuard->Hdl_Semicolon(); +} + +ary::cpp::ProjectGroup & +ContextForAry::inq_CurProject() const +{ + csv_assert( pFileScopeInfo->pCurProject != 0 ); + + return *pFileScopeInfo->pCurProject; +} + + +} // namespace cpp + + diff --git a/autodoc/source/parser/cpp/cxt2ary.hxx b/autodoc/source/parser/cpp/cxt2ary.hxx new file mode 100644 index 000000000000..30e85b2eef76 --- /dev/null +++ b/autodoc/source/parser/cpp/cxt2ary.hxx @@ -0,0 +1,231 @@ +/************************************************************************* + * + * $RCSfile: cxt2ary.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_CTX2ARY_HXX +#define ADC_CPP_CTX2ARY_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <ary/cpp/inpcontx.hxx> +#include <doc_deal.hxx> +#include "pev.hxx" +#include "fevnthdl.hxx" + // COMPONENTS + // PARAMETERS + +namespace cpp +{ + + +/** @descr + This class provides information about the context of an + CodeEntity, which is going to be stored in the repository. + The information is used mainly by class ary::cpp::RwGate. + + Also it provides information for the parser about actual + state of several public variables. + + @todo + Include events, which allow correct storing of inline + documentation after enum values, parameters, + base classes. +*/ +class ContextForAry : public ary::cpp::InputContext, + public cpp::PeEnvironment, + public cpp::FileScope_EventHandler, + public DocuDealer +{ + public: + // LIFECYCLE + ContextForAry( + ary::cpp::RwGate & io_rAryGate ); + virtual ~ContextForAry(); + + // OPERATIONS + void ResetResult() { aTokenResult.Reset(); } + + // INQUIRY + const TokenProcessing_Result & + CurResult() const { return aTokenResult; } + // ACCESS + TokenProcessing_Result & + CurResult() { return aTokenResult; } + + private: + // Interface ary::cpp::InputContext: + virtual ary::cpp::ProjectGroup & + inq_CurProjectGroup() const; + virtual ary::cpp::FileGroup & + inq_CurFileGroup() const; + + virtual ary::cpp::Namespace & + inq_CurNamespace() const; + virtual ary::cpp::Class * + inq_CurClass() const; + virtual ary::cpp::Enum * + inq_CurEnum() const; + + virtual Owner & inq_CurOwner() const; + virtual ary::cpp::E_Protection + inq_CurProtection() const; + + // Interface PeEnvironment + virtual void do_SetTokenResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push ); + virtual void do_OpenNamespace( + ary::cpp::Namespace & + io_rOpenedNamespace ); + virtual void do_OpenExternC( + bool i_bOnlyForOneDeclaration ); + virtual void do_OpenClass( + ary::cpp::Class & io_rOpenedClass ); + virtual void do_OpenEnum( + ary::cpp::Enum & io_rOpenedEnum ); + virtual void do_CloseBlock(); + virtual void do_CloseClass(); + virtual void do_CloseEnum(); + virtual void do_SetCurProtection( + ary::cpp::E_Protection + i_eProtection ); + virtual void do_OpenTemplate( + const StringVector & + i_rParameters ); + virtual DYN StringVector * + do_Get_CurTemplateParameters(); + virtual void do_Event_Class_FinishedBase( + const udmstri & i_sBaseName ); + + virtual void do_Event_Store_Typedef( + ary::cpp::Typedef & io_rTypedef ); + virtual void do_Event_Store_EnumValue( + ary::cpp::EnumValue & + io_rEnumValue ); + virtual void do_Event_Store_CppDefinition( + ary::cpp::CppDefinition & + io_rDefinition ); + virtual void do_Event_EnterFunction_ParameterList(); + virtual void do_Event_Function_FinishedParameter( + const udmstri & i_sParameterName ); + virtual void do_Event_LeaveFunction_ParameterList(); + virtual void do_Event_EnterFunction_Implementation(); + virtual void do_Event_LeaveFunction_Implementation(); + virtual void do_Event_Store_Function( + ary::cpp::Function & + io_rFunction ); + virtual void do_Event_Store_Variable( + ary::cpp::Variable & + io_rVariable ); + virtual void do_TakeDocu( + DYN ary::Documentation & + let_drInfo ); + virtual void do_StartWaitingFor_Recovery(); + virtual ary::cpp::RwGate & + inq_AryGate() const; + virtual const ary::cpp::InputContext & + inq_Context() const; + virtual udmstri inq_CurFileName() const; + virtual uintt inq_LineCount() const; + virtual bool inq_IsWaitingFor_Recovery() const; + virtual bool inq_IsExternC() const; + + // Interface FileScope_EventHandler + virtual void do_SetCurProject( + ary::cpp::ProjectGroup & + io_rCurProject ); + virtual void do_SetCurFile( + ary::cpp::FileGroup & + io_rCurFile, + const udmstri & i_sFileName ); + virtual void do_Event_IncrLineCount(); + virtual void do_Event_SwBracketOpen(); + virtual void do_Event_SwBracketClose(); + virtual void do_Event_Semicolon(); + virtual ary::cpp::ProjectGroup & + inq_CurProject() const; + + // Local types + struct S_FileScopeInfo; + struct S_OwnerStack; + struct S_DocuDistributor; + struct S_RecoveryGuard; + + // DATA + ary::cpp::RwGate * pGate; + TokenProcessing_Result + aTokenResult; + Dyn<S_FileScopeInfo> + pFileScopeInfo; + Dyn<S_OwnerStack> pOwnerStack; + Dyn<S_DocuDistributor> + pDocuDistributor; + Dyn<S_RecoveryGuard> + pRecoveryGuard; +}; + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/defdescr.cxx b/autodoc/source/parser/cpp/defdescr.cxx new file mode 100644 index 000000000000..a7c4e032fefc --- /dev/null +++ b/autodoc/source/parser/cpp/defdescr.cxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * $RCSfile: defdescr.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include "defdescr.hxx" + + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/prpr.hxx> + + +#if 0 // should be obsolete +bool CheckForOperator( + bool & o_bStringify, + bool & o_bConcatenate, + const udmstri & i_sTextItem ); +void Do_bConcatenate( + csv::StreamStr & o_rText, + bool & io_bConcatenate ); +inline void Do_bStringify_begin( + csv::StreamStr & o_rText, + bool i_bStringify ); +inline void Do_bStringify_end( + csv::StreamStr & o_rText, + bool & io_bStringify ); +inline bool HandleOperatorsBeforeTextItem( /// @return true, if text item is done here + csv::StreamStr & o_rText, + bool & io_bStringify, + bool & io_bConcatenate, + const udmstri & i_sTextItem ); + +inline void +Do_bStringify_begin( csv::StreamStr & o_rText, + bool i_bStringify ) +{ + if ( i_bStringify ) + { + o_rText << "\""; + } +} + +inline void +Do_bStringify_end( csv::StreamStr & o_rText, + bool & io_bStringify ) +{ + if ( io_bStringify ) + { + o_rText << "\""; + io_bStringify = false; + } +} + + +inline bool +HandleOperatorsBeforeTextItem( csv::StreamStr & o_rText, + bool & io_bStringify, + bool & io_bConcatenate, + const udmstri & i_sTextItem ) +{ + if ( CheckForOperator( io_bStringify, + io_bConcatenate, + i_sTextItem) ) + { + return true; + } + Do_bConcatenate(o_rText, io_bConcatenate); + Do_bStringify_begin(o_rText, io_bStringify); + + return false; +} +#endif // 0, obsolete + + + +namespace cpp +{ + + + + +DefineDescription::DefineDescription( const udmstri & i_sName, + const str_vector & i_rDefinition ) + : sName(i_sName), + // aParams, + aDefinition(i_rDefinition), + eDefineType(type_define) +{ +} + +DefineDescription::DefineDescription( const udmstri & i_sName, + const str_vector & i_rParams, + const str_vector & i_rDefinition ) + : sName(i_sName), + aParams(i_rParams), + aDefinition(i_rDefinition), + eDefineType(type_macro) +{ +} + +DefineDescription::~DefineDescription() +{ +} + +void +DefineDescription::GetDefineText( csv::StreamStr & o_rText ) const +{ + if ( aDefinition.begin() == aDefinition.end() OR eDefineType != type_define ) + return; + + + bool bSwitch_Stringify = false; + bool bSwitch_Concatenate = false; + + for ( str_vector::const_iterator it = aDefinition.begin(); + it != aDefinition.end(); + ++it ) + { + if ( HandleOperatorsBeforeTextItem( o_rText, + bSwitch_Stringify, + bSwitch_Concatenate, + *it ) ) + { + continue; + } + + o_rText << (*it); + + Do_bStringify_end(o_rText, bSwitch_Stringify); + o_rText << " "; + } + o_rText.seekp(-1, csv::cur); +} + +void +DefineDescription::GetMacroText( csv::StreamStr & o_rText, + const StringVector & i_rGivenArguments ) const +{ + bool bSwitch_Stringify = false; + bool bSwitch_Concatenate = false; + intt nActiveParamNr = -1; + + if ( aDefinition.begin() == aDefinition.end() OR eDefineType != type_macro ) + return; + + for ( str_vector::const_iterator it = aDefinition.begin(); + it != aDefinition.end(); + ++it ) + { + if ( HandleOperatorsBeforeTextItem( o_rText, + bSwitch_Stringify, + bSwitch_Concatenate, + *it ) ) + { + continue; + } + + for ( str_vector::const_iterator param_it = aParams.begin(); + param_it != aParams.end() AND nActiveParamNr == -1; + ++param_it ) + { + if ( strcmp(*it, *param_it) == 0 ) + nActiveParamNr = param_it - aParams.begin(); + } + if ( nActiveParamNr == -1 ) + { + o_rText << (*it); + } + else + { + o_rText << i_rGivenArguments[nActiveParamNr]; + nActiveParamNr = -1; + } + + Do_bStringify_end(o_rText, bSwitch_Stringify); + o_rText << " "; + } + o_rText.seekp(-1, csv::cur); +} + + + +} // end namespace cpp + + + + + diff --git a/autodoc/source/parser/cpp/defdescr.hxx b/autodoc/source/parser/cpp/defdescr.hxx new file mode 100644 index 000000000000..b5606c3fb974 --- /dev/null +++ b/autodoc/source/parser/cpp/defdescr.hxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * $RCSfile: defdescr.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_DEFDESCR_HXX +#define ADC_CPP_DEFDESCR_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + + +namespace cpp +{ + +/** Describes a C/C++ #define statement. May be a define or a macro, for which + two cases the two different constructors are to be used. + + This class is used by cpp::PreProcessor. +*/ +class DefineDescription +{ + public: + enum E_DefineType + { + type_define, + type_macro + }; + typedef StringVector str_vector; + + DefineDescription( /// Used for: #define DEFINE xyz + const udmstri & i_sName, + const str_vector & i_rDefinition ); + DefineDescription( /// Used for: #define MACRO(...) abc + const udmstri & i_sName, + const str_vector & i_rParams, + const str_vector & i_rDefinition ); + ~DefineDescription(); + + /// Only vaild if (eDefineType == type_define) else returns "". + void GetDefineText( + csv::StreamStr & o_rText ) const; + + /// Only vaild if (eDefineType == type_macro) else returns "". + void GetMacroText( + csv::StreamStr & o_rText, + const StringVector & + i_rGivenArguments ) const; + + uintt ParamCount() const; + E_DefineType DefineType() const; + + private: + // DATA + udmstri sName; + str_vector aParams; + str_vector aDefinition; + E_DefineType eDefineType; +}; + + + +// IMPLEMENTATION + +inline uintt +DefineDescription::ParamCount() const + { return aParams.size(); } +inline DefineDescription::E_DefineType +DefineDescription::DefineType() const + { return eDefineType; } + + +} // end namespace cpp + + + +#endif + + diff --git a/autodoc/source/parser/cpp/fevnthdl.hxx b/autodoc/source/parser/cpp/fevnthdl.hxx new file mode 100644 index 000000000000..e8455c53a837 --- /dev/null +++ b/autodoc/source/parser/cpp/fevnthdl.hxx @@ -0,0 +1,168 @@ +/************************************************************************* + * + * $RCSfile: fevnthdl.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_FEVNTHDL_HXX +#define ADC_CPP_FEVNTHDL_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + + +namespace ary +{ + namespace cpp + { + class ProjectGroup; + class FileGroup; + } + namespace loc + { + class LocationRoot; + } +} + + + + +namespace cpp +{ + + +/** This is an interface, which accepts the file scope events that may + be important for parsing. It is implementation-dependant, where to + put or what to do with them. +*/ +class FileScope_EventHandler +{ + public: + // LIFECYCLE + virtual ~FileScope_EventHandler() {} + + // OPERATIONS + void SetCurProject( + ary::cpp::ProjectGroup & + io_rCurProject ); + void SetCurFile( + ary::cpp::FileGroup & + io_rCurFile, + const udmstri & i_sFileName ); + void Event_IncrLineCount(); + void Event_SwBracketOpen(); + void Event_SwBracketClose(); + void Event_Semicolon(); + + // INQUIRY + ary::cpp::ProjectGroup & + CurProject() const; + private: + virtual void do_SetCurProject( + ary::cpp::ProjectGroup & + io_rCurProject ) = 0; + virtual void do_SetCurFile( + ary::cpp::FileGroup & + io_rCurFile, + const udmstri & i_sFileName ) = 0; + virtual void do_Event_IncrLineCount() = 0; + virtual void do_Event_SwBracketOpen() = 0; + virtual void do_Event_SwBracketClose() = 0; + virtual void do_Event_Semicolon() = 0; + + virtual ary::cpp::ProjectGroup & + inq_CurProject() const = 0; +}; + + +// IMPLEMENTATION + +inline void +FileScope_EventHandler::SetCurProject( ary::cpp::ProjectGroup & io_rCurProject ) + { do_SetCurProject(io_rCurProject); } +inline void +FileScope_EventHandler::SetCurFile( ary::cpp::FileGroup & io_rCurFile, + const udmstri & i_sFileName ) + { do_SetCurFile(io_rCurFile,i_sFileName); } +inline void +FileScope_EventHandler::Event_IncrLineCount() + { do_Event_IncrLineCount(); } +inline void +FileScope_EventHandler::Event_SwBracketOpen() + { do_Event_SwBracketOpen(); } +inline void +FileScope_EventHandler::Event_SwBracketClose() + { do_Event_SwBracketClose(); } +inline void +FileScope_EventHandler::Event_Semicolon() + { do_Event_Semicolon(); } +inline ary::cpp::ProjectGroup & +FileScope_EventHandler::CurProject() const + { return inq_CurProject(); } + + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/icprivow.cxx b/autodoc/source/parser/cpp/icprivow.cxx new file mode 100644 index 000000000000..7b0afff3e7d6 --- /dev/null +++ b/autodoc/source/parser/cpp/icprivow.cxx @@ -0,0 +1,220 @@ +/************************************************************************* + * + * $RCSfile: icprivow.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:29 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include <icprivow.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_class.hxx> + + + +namespace cpp +{ + + + +//****************** Owner_Namespace ********************// +Owner_Namespace::Owner_Namespace() + : pScope(0) +{ +} + +void +Owner_Namespace::SetAnotherNamespace( ary::cpp::Namespace & io_rScope ) +{ + pScope = &io_rScope; +} + +void +Owner_Namespace::do_Add_Class( const udmstri & i_sLocalName, + Cid i_nId ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalClass(i_sLocalName, i_nId); +} + +void +Owner_Namespace::do_Add_Enum( const udmstri & i_sLocalName, + Cid i_nId ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalEnum(i_sLocalName, i_nId); +} + +void +Owner_Namespace::do_Add_Typedef( const udmstri & i_sLocalName, + Cid i_nId ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalTypedef(i_sLocalName, i_nId); +} + +void +Owner_Namespace::do_Add_Operation( const udmstri & i_sLocalName, + OSid i_nSignature, + Cid i_nId, + bool i_bIsStatic ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalOperation(i_sLocalName, i_nSignature, i_nId); +} + +void +Owner_Namespace::do_Add_Variable( const udmstri & i_sLocalName, + Cid i_nId, + bool i_bIsConst, + bool i_bIsStatic ) +{ + csv_assert(pScope != 0); + if (i_bIsConst) + pScope->Add_LocalConstant(i_sLocalName, i_nId); + else + pScope->Add_LocalVariable(i_sLocalName, i_nId); +} + + +Cid +Owner_Namespace::inq_Id() const +{ + csv_assert(pScope != 0); + return pScope->Id(); +} + + +//****************** Owner_Class ********************// + +Owner_Class::Owner_Class() + : pScope(0) +{ +} + +void +Owner_Class::SetAnotherClass( ary::cpp::Class & io_rScope ) +{ + pScope = &io_rScope; +} + +void +Owner_Class::do_Add_Class( const udmstri & i_sLocalName, + Cid i_nId ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalClass(i_sLocalName, i_nId); +} + +void +Owner_Class::do_Add_Enum( const udmstri & i_sLocalName, + Cid i_nId ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalEnum(i_sLocalName, i_nId); +} + +void +Owner_Class::do_Add_Typedef( const udmstri & i_sLocalName, + Cid i_nId ) +{ + csv_assert(pScope != 0); + pScope->Add_LocalTypedef(i_sLocalName, i_nId); +} + +void +Owner_Class::do_Add_Operation( const udmstri & i_sLocalName, + OSid i_nSignature, + Cid i_nId, + bool i_bIsStatic ) +{ + csv_assert(pScope != 0); + if (i_bIsStatic) + pScope->Add_LocalStaticOperation(i_sLocalName, i_nSignature, i_nId); + else + pScope->Add_LocalOperation(i_sLocalName, i_nSignature, i_nId); +} + +void +Owner_Class::do_Add_Variable( const udmstri & i_sLocalName, + Cid i_nId, + bool i_bIsConst, + bool i_bIsStatic ) +{ + csv_assert(pScope != 0); + if (i_bIsStatic) + pScope->Add_LocalStaticData(i_sLocalName, i_nId); + else + pScope->Add_LocalData(i_sLocalName, i_nId); +} + +Cid +Owner_Class::inq_Id() const +{ + csv_assert(pScope != 0); + return pScope->Id(); +} + + + + + +} // namespace cpp diff --git a/autodoc/source/parser/cpp/icprivow.hxx b/autodoc/source/parser/cpp/icprivow.hxx new file mode 100644 index 000000000000..98136d1acb0a --- /dev/null +++ b/autodoc/source/parser/cpp/icprivow.hxx @@ -0,0 +1,154 @@ +/************************************************************************* + * + * $RCSfile: icprivow.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ARY_CPP_ICPRIVOW_HXX +#define ARY_CPP_ICPRIVOW_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <ary/cpp/inpcontx.hxx> + // COMPONENTS + // PARAMETERS + +namespace cpp +{ + + + +using ary::Cid; +using ary::OSid; + +class Owner_Namespace : public ary::cpp::InputContext::Owner +{ + public: + Owner_Namespace(); + void SetAnotherNamespace( + ary::cpp::Namespace & + io_rScope ); + + private: + virtual void do_Add_Class( + const udmstri & i_sLocalName, + Cid i_nId ); + virtual void do_Add_Enum( + const udmstri & i_sLocalName, + Cid i_nId ); + virtual void do_Add_Typedef( + const udmstri & i_sLocalName, + Cid i_nId ); + virtual void do_Add_Operation( + const udmstri & i_sLocalName, + OSid i_nSignature, + Cid i_nId, + bool i_bIsStatic ); + virtual void do_Add_Variable( + const udmstri & i_sLocalName, + Cid i_nId, + bool i_bIsConst, + bool i_bIsStatic ); + virtual Cid inq_Id() const; + + // DATA + ary::cpp::Namespace * + pScope; +}; + +class Owner_Class : public ary::cpp::InputContext::Owner +{ + public: + Owner_Class(); + void SetAnotherClass( + ary::cpp::Class & io_rScope ); + private: + virtual void do_Add_Class( + const udmstri & i_sLocalName, + Cid i_nId ); + virtual void do_Add_Enum( + const udmstri & i_sLocalName, + Cid i_nId ); + virtual void do_Add_Typedef( + const udmstri & i_sLocalName, + Cid i_nId ); + virtual void do_Add_Operation( + const udmstri & i_sLocalName, + OSid i_nSignature, + Cid i_nId, + bool i_bIsStatic ); + virtual void do_Add_Variable( + const udmstri & i_sLocalName, + Cid i_nId, + bool i_bIsConst, + bool i_bIsStatic ); + virtual Cid inq_Id() const; + + // DATA + ary::cpp::Class * pScope; +}; + + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/makefile.mk b/autodoc/source/parser/cpp/makefile.mk new file mode 100644 index 000000000000..76d6ae4018a8 --- /dev/null +++ b/autodoc/source/parser/cpp/makefile.mk @@ -0,0 +1,123 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=parser_cpp + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + + +OBJFILES= \ + $(OBJ)$/all_toks.obj \ + $(OBJ)$/c_dealer.obj \ + $(OBJ)$/c_rcode.obj \ + $(OBJ)$/cpp_pe.obj \ + $(OBJ)$/cx_base.obj \ + $(OBJ)$/cx_c_pp.obj \ + $(OBJ)$/cx_c_std.obj \ + $(OBJ)$/cx_c_sub.obj \ + $(OBJ)$/cxt2ary.obj \ + $(OBJ)$/defdescr.obj \ + $(OBJ)$/icprivow.obj \ + $(OBJ)$/pe_base.obj \ + $(OBJ)$/pe_class.obj \ + $(OBJ)$/pe_defs.obj \ + $(OBJ)$/pe_expr.obj \ + $(OBJ)$/pe_enum.obj \ + $(OBJ)$/pe_enval.obj \ + $(OBJ)$/pe_file.obj \ + $(OBJ)$/pe_funct.obj \ + $(OBJ)$/pe_ignor.obj \ + $(OBJ)$/pe_namsp.obj \ + $(OBJ)$/pe_param.obj \ + $(OBJ)$/pe_tpltp.obj \ + $(OBJ)$/pe_type.obj \ + $(OBJ)$/pe_tydef.obj \ + $(OBJ)$/pe_vafu.obj \ + $(OBJ)$/pe_vari.obj \ + $(OBJ)$/preproc.obj \ + $(OBJ)$/prs_cpp.obj \ + $(OBJ)$/tkp_cpp.obj \ + $(OBJ)$/tokintpr.obj + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser/cpp/pe_base.cxx b/autodoc/source/parser/cpp/pe_base.cxx new file mode 100644 index 000000000000..f82bc2e6ac08 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_base.cxx @@ -0,0 +1,256 @@ +/************************************************************************* + * + * $RCSfile: pe_base.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "pe_base.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <cosv/template/tpltools.hxx> +#include <ary/cpp/c_rwgate.hxx> +#include <ary/cpp/ca_type.hxx> +#include "pe_type.hxx" + + + + +namespace cpp { + +static const PE_Base::Base aNullBase_; + + +PE_Base::PE_Base( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati(new PeStatusArray<PE_Base>) + // aBaseIds, + // pSpType, + // pSpuBaseName +{ + Setup_StatusFunctions(); + aBaseIds.reserve(4); + + pSpType = new SP_Type(*this); + pSpuBaseName = new SPU_BaseName(*pSpType, 0, &PE_Base::SpReturn_BaseName); +} + + +PE_Base::~PE_Base() +{ +} + +void +PE_Base::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Base::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Base>::F_Tok F_Tok; + static F_Tok stateF_startOfNext[] = { On_startOfNext_Identifier, + On_startOfNext_public, + On_startOfNext_protected, + On_startOfNext_private, + On_startOfNext_virtual, + On_startOfNext_DoubleColon }; + static INT16 stateT_startOfNext[] = { Tid_Identifier, + Tid_public, + Tid_protected, + Tid_private, + Tid_virtual, + Tid_DoubleColon }; + static F_Tok stateF_inName[] = { On_inName_Identifier, + On_inName_virtual, + On_inName_SwBracket_Left, + On_inName_DoubleColon, + On_inName_Comma }; + static INT16 stateT_inName[] = { Tid_Identifier, + Tid_virtual, + Tid_SwBracket_Left, + Tid_DoubleColon, + Tid_Comma }; + + SEMPARSE_CREATE_STATUS(PE_Base, startOfNext, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Base, inName, Hdl_SyntaxError); +} + +void +PE_Base::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Base::InitData() +{ + pStati->SetCur(startOfNext); + csv::erase_container(aBaseIds); + aBaseIds.push_back(aNullBase_); +} + +void +PE_Base::TransferData() +{ + // Does nothing. +} + +void +PE_Base::SpReturn_BaseName() +{ + CurObject().nId = pSpuBaseName->Child().Result_Type().Id(); + + static StreamStr aBaseName(100); + aBaseName.seekp(0); + pSpuBaseName->Child().Result_Type().Get_Text( aBaseName, Env().AryGate().RoGate() ); + + Env().Event_Class_FinishedBase(aBaseName.c_str()); +} + +void +PE_Base::On_startOfNext_public(const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(inName); + + CurObject().eProtection = ary::cpp::PROTECT_public; +} + +void +PE_Base::On_startOfNext_protected(const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(inName); + + CurObject().eProtection = ary::cpp::PROTECT_protected; +} + +void +PE_Base::On_startOfNext_private(const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(inName); + + CurObject().eProtection = ary::cpp::PROTECT_private; +} + +void +PE_Base::On_startOfNext_virtual(const char *) +{ + SetTokenResult(done, stay); + + CurObject().eVirtuality = ary::cpp::VIRTUAL_virtual; +} + +void +PE_Base::On_startOfNext_Identifier(const char * i_sText) +{ + pSpuBaseName->Push(not_done); +} + +void +PE_Base::On_startOfNext_DoubleColon(const char *) +{ + pSpuBaseName->Push(not_done); +} + +void +PE_Base::On_inName_Identifier(const char * i_sText) +{ + pSpuBaseName->Push(not_done); +} + +void +PE_Base::On_inName_virtual(const char *) +{ + SetTokenResult(done, stay); + + CurObject().eVirtuality = ary::cpp::VIRTUAL_virtual; +} + +void +PE_Base::On_inName_DoubleColon(const char *) +{ + pSpuBaseName->Push(not_done); +} + +void +PE_Base::On_inName_Comma(const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(startOfNext); + + aBaseIds.push_back( aNullBase_ ); +} + +void +PE_Base::On_inName_SwBracket_Left(const char *) +{ + SetTokenResult(not_done, pop_success); +} + + +} // namespace cpp + + + + + diff --git a/autodoc/source/parser/cpp/pe_base.hxx b/autodoc/source/parser/cpp/pe_base.hxx new file mode 100644 index 000000000000..093c78995f30 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_base.hxx @@ -0,0 +1,163 @@ +/************************************************************************* + * + * $RCSfile: pe_base.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef ADC_CPP_PE_BASE_HXX +#define ADC_CPP_PE_BASE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS +#include <ary/cpp/c_etypes.hxx> +// #include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_idlist.hxx> + + +namespace cpp { + +class PE_Type; + +class PE_Base : public Cpp_PE +{ + public: + enum E_State + { + startOfNext, + inName, + size_of_states + }; + + typedef ary::cpp::List_Bases BaseList; + typedef ary::cpp::S_Classes_Base Base; + + PE_Base( + Cpp_PE * i_pParent ); + ~PE_Base(); + + const BaseList & Result_BaseIds() const; + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + private: + typedef SubPe< PE_Base, PE_Type > SP_Type; + typedef SubPeUse< PE_Base, PE_Type> SPU_BaseName; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void SpReturn_BaseName(); + + void On_startOfNext_Identifier(const char *); + void On_startOfNext_public(const char *); + void On_startOfNext_protected(const char *); + void On_startOfNext_private(const char *); + void On_startOfNext_virtual(const char *); + void On_startOfNext_DoubleColon(const char *); + + void On_inName_Identifier(const char *); + void On_inName_virtual(const char *); + void On_inName_SwBracket_Left(const char *); + void On_inName_DoubleColon(const char *); + void On_inName_Comma(const char *); + + Base & CurObject(); + + // DATA + Dyn< PeStatusArray<PE_Base> > + pStati; + + Dyn<SP_Type> pSpType; /// till "{" incl. + Dyn<SPU_BaseName> pSpuBaseName; + + BaseList aBaseIds; +}; + + + +// IMPLEMENTATION + +inline const PE_Base::BaseList & +PE_Base::Result_BaseIds() const + { return aBaseIds; } + + +inline PE_Base::Base & +PE_Base::CurObject() + { return aBaseIds.back(); } + + +} // namespace cpp + + + + +#endif + + diff --git a/autodoc/source/parser/cpp/pe_class.cxx b/autodoc/source/parser/cpp/pe_class.cxx new file mode 100644 index 000000000000..7f9b13722b4e --- /dev/null +++ b/autodoc/source/parser/cpp/pe_class.cxx @@ -0,0 +1,511 @@ +/************************************************************************* + * + * $RCSfile: pe_class.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "pe_class.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <cosv/template/tpltools.hxx> +#include <ary/cpp/c_rwgate.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <all_toks.hxx> +#include "pe_base.hxx" +#include "pe_enum.hxx" +#include "pe_tydef.hxx" +#include "pe_vafu.hxx" +#include "pe_ignor.hxx" + + +namespace cpp { + +// using ary::Cid; + +PE_Class::PE_Class(Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Class> ), + // pSpBase, + // pSpTypedef, + // pSpVarFunc, + // pSpIgnore, + // pSpuBase, + // pSpuTypedef, + // pSpuVarFunc, + // pSpuUsing, + // pSpuIgnoreFailure, + // sLocalName, + eClassKey(ary::cpp::CK_class), + pCurObject(0), + // aBases, + eResult_KindOf(is_declaration) +{ + Setup_StatusFunctions(); + + pSpBase = new SP_Base(*this); + pSpTypedef = new SP_Typedef(*this); + pSpVarFunc = new SP_VarFunc(*this); + pSpIgnore = new SP_Ignore(*this); + + pSpuBase = new SPU_Base(*pSpBase, 0, &PE_Class::SpReturn_Base); + pSpuTypedef = new SPU_Typedef(*pSpTypedef, 0, 0); + pSpuVarFunc = new SPU_VarFunc(*pSpVarFunc, 0, 0); + + pSpuTemplate= new SPU_Ignore(*pSpIgnore, 0, 0); + pSpuUsing = new SPU_Ignore(*pSpIgnore, 0, 0); + pSpuIgnoreFailure + = new SPU_Ignore(*pSpIgnore, 0, 0); +} + + +PE_Class::~PE_Class() +{ +} + +void +PE_Class::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +Cpp_PE * +PE_Class::Handle_ChildFailure() +{ + SetCurSPU(pSpuIgnoreFailure.Ptr()); + return &pSpuIgnoreFailure->Child(); +} + +void +PE_Class::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Class>::F_Tok F_Tok; + + static F_Tok stateF_start[] = { On_start_class, + On_start_struct, + On_start_union }; + static INT16 stateT_start[] = { Tid_class, + Tid_struct, + Tid_union }; + + static F_Tok stateF_expectName[] = { On_expectName_Identifier, + On_expectName_SwBracket_Left, + On_expectName_Colon + }; + static INT16 stateT_expectName[] = { Tid_Identifier, + Tid_SwBracket_Left, + Tid_Colon + }; + + static F_Tok stateF_gotName[] = { On_gotName_SwBracket_Left, + On_gotName_Semicolon, + On_gotName_Colon }; + static INT16 stateT_gotName[] = { Tid_SwBracket_Left, + Tid_Semicolon, + Tid_Colon }; + + static F_Tok stateF_bodyStd[] = { On_bodyStd_VarFunc, + On_bodyStd_VarFunc, + On_bodyStd_ClassKey, + On_bodyStd_ClassKey, + On_bodyStd_ClassKey, + + On_bodyStd_enum, + On_bodyStd_typedef, + On_bodyStd_public, + On_bodyStd_protected, + On_bodyStd_private, + + On_bodyStd_template, + On_bodyStd_VarFunc, + On_bodyStd_friend, + On_bodyStd_VarFunc, + On_bodyStd_VarFunc, + + On_bodyStd_VarFunc, + On_bodyStd_VarFunc, + On_bodyStd_VarFunc, + On_bodyStd_VarFunc, + On_bodyStd_VarFunc, + + On_bodyStd_using, + On_bodyStd_SwBracket_Right, + On_bodyStd_VarFunc, + On_bodyStd_VarFunc, + On_bodyStd_VarFunc }; + static INT16 stateT_bodyStd[] = { Tid_Identifier, + Tid_operator, + Tid_class, + Tid_struct, + Tid_union, + + Tid_enum, + Tid_typedef, + Tid_public, + Tid_protected, + Tid_private, + + Tid_template, + Tid_virtual, + Tid_friend, + Tid_Tilde, + Tid_const, + + Tid_volatile, + Tid_static, + Tid_mutable, + Tid_inline, + Tid_explicit, + + Tid_using, + Tid_SwBracket_Right, + Tid_DoubleColon, + Tid_BuiltInType, + Tid_TypeSpecializer }; + + static F_Tok stateF_inProtection[] = { On_inProtection_Colon }; + static INT16 stateT_inProtection[] = { Tid_Colon }; + + static F_Tok stateF_afterDecl[] = { On_afterDecl_Semicolon }; + static INT16 stateT_afterDecl[] = { Tid_Semicolon }; + + SEMPARSE_CREATE_STATUS(PE_Class, start, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Class, expectName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Class, gotName, On_gotName_Return2Type); + SEMPARSE_CREATE_STATUS(PE_Class, bodyStd, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Class, inProtection, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Class, afterDecl, On_afterDecl_Return2Type); + +#if 0 + static F_Tok stateF_inFriend[] = { On_inFriend_class, + On_inFriend_struct, + On_inFriend_union }; + // Default: On_inFriend_Function + static INT16 stateT_inFriend[] = { Tid_class, + Tid_struct, + Tid_union }; +#endif // 0 +} + +void +PE_Class::InitData() +{ + pStati->SetCur(start); + sLocalName.clear(); + eClassKey = ary::cpp::CK_class; + pCurObject = 0; + csv::erase_container(aBases); + eResult_KindOf = is_declaration; +} + +void +PE_Class::TransferData() +{ + pStati->SetCur(size_of_states); +} + +void +PE_Class::Hdl_SyntaxError( const char * i_sText) +{ + if ( *i_sText == ';' ) + { + Cerr() << Env().CurFileName() << ", line " + << Env().LineCount() + << ": Sourcecode error: ';' as a toplevel declaration is deprecated." + << Endl(); + SetTokenResult(done,stay); + return; + } + + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Class::Init_CurObject() +{ + // KORR_FUTURE + // This will have to be done before parsing base classes, because of + // possible inline documentation for base classes. + pCurObject = & Env().AryGate().Store_Class( Env().Context(), sLocalName, eClassKey ); + + for ( PE_Base::BaseList::const_iterator it = aBases.begin(); + it != aBases.end(); + ++it ) + { + pCurObject->Add_BaseClass( *it ); + } // end for + + Dyn< StringVector > + pTplParams( Env().Get_CurTemplateParameters() ); + if ( pTplParams ) + { + for ( StringVector::const_iterator it = pTplParams->begin(); + it != pTplParams->end(); + ++it ) + { + pCurObject->Add_TemplateParameterType( *it, 0 ); + } // end for + } +} + +void +PE_Class::SpReturn_Base() +{ + aBases = pSpuBase->Child().Result_BaseIds(); + pStati->SetCur(gotName); +} + +void +PE_Class::On_start_class( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(expectName); + eClassKey = ary::cpp::CK_class; +} + +void +PE_Class::On_start_struct( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(expectName); + eClassKey = ary::cpp::CK_struct; +} + +void +PE_Class::On_start_union( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(expectName); + eClassKey = ary::cpp::CK_union; +} + +void +PE_Class::On_expectName_Identifier( const char * i_sText ) +{ + SetTokenResult(done, stay); + pStati->SetCur(gotName); + sLocalName = i_sText; +} + +void +PE_Class::On_expectName_SwBracket_Left( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(bodyStd); + + sLocalName = ""; + Init_CurObject(); + sLocalName = pCurObject->LocalName(); + + Env().OpenClass(*pCurObject); +} + +void +PE_Class::On_expectName_Colon( const char * ) +{ + pStati->SetCur(gotName); + sLocalName = ""; + + pSpuBase->Push(done); +} + +void +PE_Class::On_gotName_SwBracket_Left( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(bodyStd); + + Init_CurObject(); + if ( sLocalName.empty() ) + sLocalName = pCurObject->LocalName(); + + Env().OpenClass(*pCurObject); +} + +void +PE_Class::On_gotName_Semicolon( const char * ) +{ + SetTokenResult(not_done, pop_success); + + eResult_KindOf = is_predeclaration; +} + +void +PE_Class::On_gotName_Colon( const char * ) +{ + pSpuBase->Push(done); +} + +void +PE_Class::On_gotName_Return2Type( const char * ) +{ + SetTokenResult(not_done, pop_success); + + eResult_KindOf = is_qualified_typename; +} + +void +PE_Class::On_bodyStd_VarFunc( const char * ) +{ + pSpuVarFunc->Push(not_done); +} + +void +PE_Class::On_bodyStd_ClassKey( const char * ) +{ + pSpuVarFunc->Push(not_done); // This is correct, + // classes are parsed via PE_Type. +} + +void +PE_Class::On_bodyStd_enum( const char * ) +{ + pSpuVarFunc->Push(not_done); // This is correct, + // enums are parsed via PE_Type. +} + +void +PE_Class::On_bodyStd_typedef( const char * ) +{ + pSpuTypedef->Push(not_done); +} + +void +PE_Class::On_bodyStd_public( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(inProtection); + + Env().SetCurProtection(ary::cpp::PROTECT_public); +} + +void +PE_Class::On_bodyStd_protected( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(inProtection); + + Env().SetCurProtection(ary::cpp::PROTECT_protected); +} + +void +PE_Class::On_bodyStd_private( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(inProtection); + + Env().SetCurProtection(ary::cpp::PROTECT_private); +} + +void +PE_Class::On_bodyStd_template( const char * ) +{ + pSpuTemplate->Push(done); +} + +void +PE_Class::On_bodyStd_friend( const char * ) +{ + // KORR_FUTURE + pSpuUsing->Push(done); +} + +void +PE_Class::On_bodyStd_using( const char * ) +{ + pSpuUsing->Push(done); +} + +void +PE_Class::On_bodyStd_SwBracket_Right( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterDecl); + + Env().CloseClass(); +} + +void +PE_Class::On_inProtection_Colon( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(bodyStd); +} + +void +PE_Class::On_afterDecl_Semicolon( const char * ) +{ + SetTokenResult(not_done, pop_success); + eResult_KindOf = is_declaration; +} + +void +PE_Class::On_afterDecl_Return2Type( const char * ) +{ + SetTokenResult(not_done, pop_success); + eResult_KindOf = is_implicit_declaration; +} + + +} // namespace cpp + + + + diff --git a/autodoc/source/parser/cpp/pe_class.hxx b/autodoc/source/parser/cpp/pe_class.hxx new file mode 100644 index 000000000000..e52d1669d07d --- /dev/null +++ b/autodoc/source/parser/cpp/pe_class.hxx @@ -0,0 +1,283 @@ +/************************************************************************* + * + * $RCSfile: pe_class.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_PE_CLASS_HXX +#define ADC_CPP_PE_CLASS_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> +#include <ary/cpp/c_etypes.hxx> +#include <ary/cpp/c_idlist.hxx> + // PARAMETERS +#include "all_toks.hxx" + +namespace ary +{ +namespace cpp +{ + class Class; +} +} + + +namespace cpp +{ + + +using ary::cpp::E_Protection; +using ary::cpp::E_Virtuality; + + +class PE_Base; +class PE_Enum; +class PE_Typedef; +class PE_VarFunc; +class PE_Ignore; + + +class PE_Class : public cpp::Cpp_PE +{ + public: + enum E_State + { + start, /// before class, struct or union + expectName, /// after class, struct or union + gotName, /// after name, before : or { + bodyStd, /// after { + inProtection, /// after public, protected or private and before ":" + afterDecl, /// after ending } + size_of_states + }; + + enum E_KindOfResult + { + is_declaration, // normal + is_implicit_declaration, // like in: class Abc { public int n; } aAbc; + is_predeclaration, // like: class Abc; + is_qualified_typename // like in: class Abc * fx(); + + }; + + PE_Class( + Cpp_PE * i_pParent ); + ~PE_Class(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + virtual Cpp_PE * Handle_ChildFailure(); + + E_KindOfResult Result_KindOf() const; + const udmstri & Result_LocalName() const; + const udmstri & Result_FirstNameSegment() const; + + private: + typedef SubPe< PE_Class, PE_Base > SP_Base; +// typedef SubPe< PE_Class, PE_Enum> SP_Enum; + typedef SubPe< PE_Class, PE_Typedef> SP_Typedef; + typedef SubPe< PE_Class, PE_VarFunc> SP_VarFunc; + typedef SubPe< PE_Class, PE_Ignore > SP_Ignore; + + typedef SubPeUse< PE_Class, PE_Base> SPU_Base; +// typedef SubPeUse< PE_Class, PE_Enum> SPU_Enum; + typedef SubPeUse< PE_Class, PE_Typedef> SPU_Typedef; + typedef SubPeUse< PE_Class, PE_VarFunc> SPU_VarFunc; + typedef SubPeUse< PE_Class, PE_Ignore> SPU_Ignore; + + typedef ary::cpp::List_Bases BaseList; + typedef ary::cpp::S_Classes_Base Base; + typedef ary::cpp::E_Protection E_Protection; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + void Init_CurObject(); + + void SpReturn_Base(); + + void On_start_class( const char * ); + void On_start_struct( const char * ); + void On_start_union( const char * ); + + void On_expectName_Identifier( const char * ); + void On_expectName_SwBracket_Left( const char * ); + void On_expectName_Colon( const char * ); + + void On_gotName_SwBracket_Left( const char * ); + void On_gotName_Semicolon( const char * ); + void On_gotName_Colon( const char * ); + void On_gotName_Return2Type( const char * ); + + void On_bodyStd_VarFunc( const char * ); + void On_bodyStd_ClassKey( const char * ); + void On_bodyStd_enum( const char * ); + void On_bodyStd_typedef( const char * ); + void On_bodyStd_public( const char * ); + void On_bodyStd_protected( const char * ); + void On_bodyStd_private( const char * ); + void On_bodyStd_template( const char * ); + void On_bodyStd_friend( const char * ); + void On_bodyStd_using( const char * ); + void On_bodyStd_SwBracket_Right( const char * ); + + void On_inProtection_Colon( const char * ); + + void On_afterDecl_Semicolon( const char * ); + void On_afterDecl_Return2Type( const char * ); + + // DATA + Dyn< PeStatusArray<PE_Class> > + pStati; + + Dyn<SP_Base> pSpBase; +// Dyn<SP_Enum> pSpEnum; + Dyn<SP_Typedef> pSpTypedef; + Dyn<SP_VarFunc> pSpVarFunc; + Dyn<SP_Ignore> pSpIgnore; + + Dyn<SPU_Base> pSpuBase; +// Dyn<SPU_Enum> pSpuEnum; + Dyn<SPU_Typedef> pSpuTypedef; + Dyn<SPU_VarFunc> pSpuVarFunc; + + Dyn<SPU_Ignore> pSpuTemplate; + Dyn<SPU_Ignore> pSpuUsing; + Dyn<SPU_Ignore> pSpuIgnoreFailure; + + + udmstri sLocalName; + ary::cpp::E_ClassKey + eClassKey; + ary::cpp::Class * pCurObject; + BaseList aBases; + + E_KindOfResult eResult_KindOf; +}; + + + +// IMPLEMENTATION + +inline PE_Class::E_KindOfResult +PE_Class::Result_KindOf() const +{ + return eResult_KindOf; +} + +inline const udmstri & +PE_Class::Result_LocalName() const +{ + return sLocalName; +} + +inline const udmstri & +PE_Class::Result_FirstNameSegment() const +{ + return sLocalName; +} + + + + +} // namespace cpp + + +#if 0 // Branches + +class struct union + -> Class + -> Predeclaration + +typedef + -> Typedef + +enum + -> Enum + +TypeDeclaration + -> Function In Class + -> Variable + +public, protected, private + -> Protection declaration + +friend + -> Friend Class + -> Friend Function + +virtual + -> Function In Class + +using + -> Using Declaration + + +#endif // 0 + + +#endif + diff --git a/autodoc/source/parser/cpp/pe_defs.cxx b/autodoc/source/parser/cpp/pe_defs.cxx new file mode 100644 index 000000000000..58ae56e55b5a --- /dev/null +++ b/autodoc/source/parser/cpp/pe_defs.cxx @@ -0,0 +1,211 @@ +/************************************************************************* + * + * $RCSfile: pe_defs.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "pe_defs.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <cosv/template/tpltools.hxx> +#include <ary/cpp/c_rwgate.hxx> +#include <ary/cpp/c_define.hxx> +#include <ary/cpp/c_macro.hxx> +#include <ary/cpp/crwg_def.hxx> +#include "all_toks.hxx" + + +namespace cpp +{ + + +PE_Defines::PE_Defines( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Defines> ), + // sName, + // aParameters, + // sDefinition, + bIsMacro(false) +{ + Setup_StatusFunctions(); +} + + +PE_Defines::~PE_Defines() +{ +} + +void +PE_Defines::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Defines::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Defines>::F_Tok F_Tok; + static F_Tok stateF_expectName[] = { On_expectName_DefineName, + On_expectName_MacroName + }; + static INT16 stateT_expectName[] = { Tid_DefineName, + Tid_MacroName + }; + + static F_Tok stateF_gotDefineName[] = { On_gotDefineName_PreProDefinition }; + static INT16 stateT_gotDefineName[] = { Tid_PreProDefinition }; + + static F_Tok stateF_expectMacroParameters[] = + { On_expectMacroParameters_MacroParameter, + On_expectMacroParameters_PreProDefinition + }; + static INT16 stateT_expectMacroParameters[] = + { Tid_MacroParameter, + Tid_PreProDefinition + }; + + SEMPARSE_CREATE_STATUS(PE_Defines, expectName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Defines, gotDefineName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Defines, expectMacroParameters, Hdl_SyntaxError); +} + +void +PE_Defines::InitData() +{ + pStati->SetCur(expectName); + + sName.clear(); + csv::erase_container( aParameters ); + csv::erase_container( aDefinition ); + bIsMacro = false; +} + +void +PE_Defines::TransferData() +{ + if (NOT bIsMacro) + { + ary::cpp::Define & + rNew = Env().AryGate().Defines().Store_Define( + Env().Context(), sName, aDefinition ); + Env().Event_Store_CppDefinition(rNew); + } + else + { + ary::cpp::Macro & + rNew = Env().AryGate().Defines().Store_Macro( + Env().Context(), sName, aParameters, aDefinition ); + Env().Event_Store_CppDefinition(rNew); + } + pStati->SetCur(size_of_states); +} + +void +PE_Defines::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Defines::On_expectName_DefineName( const char * i_sText ) +{ + SetTokenResult(done, stay); + pStati->SetCur(gotDefineName); + + sName = i_sText; + bIsMacro = false; +} + +void +PE_Defines::On_expectName_MacroName( const char * i_sText ) +{ + SetTokenResult(done, stay); + pStati->SetCur(expectMacroParameters); + + sName = i_sText; + bIsMacro = true; +} + +void +PE_Defines::On_gotDefineName_PreProDefinition( const char * i_sText ) +{ + SetTokenResult(done, pop_success); + + aDefinition.push_back( udmstri(i_sText) ); +} + +void +PE_Defines::On_expectMacroParameters_MacroParameter( const char * i_sText ) +{ + SetTokenResult(done, stay); + aParameters.push_back( udmstri(i_sText) ); +} + +void +PE_Defines::On_expectMacroParameters_PreProDefinition( const char * i_sText ) +{ + SetTokenResult(done, pop_success); + + aDefinition.push_back( udmstri(i_sText) ); +} + + +} // namespace cpp + diff --git a/autodoc/source/parser/cpp/pe_defs.hxx b/autodoc/source/parser/cpp/pe_defs.hxx new file mode 100644 index 000000000000..2b612c65a630 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_defs.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * $RCSfile: pe_defs.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_PE_DEFS_HXX +#define ADC_CPP_PE_DEFS_HXX + + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS + + +namespace cpp +{ + + + +class PE_Defines : public cpp::Cpp_PE +{ + public: + enum E_State + { + expectName, + gotDefineName, + expectMacroParameters, + size_of_states + }; + + PE_Defines( + Cpp_PE * i_pParent ); + ~PE_Defines(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + private: + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void On_expectName_DefineName( const char * ); + void On_expectName_MacroName( const char * ); + + void On_gotDefineName_PreProDefinition( const char * ); + + void On_expectMacroParameters_MacroParameter( const char * ); + void On_expectMacroParameters_PreProDefinition( const char * ); + + // DATA + Dyn< PeStatusArray<PE_Defines> > + pStati; + + udmstri sName; + StringVector aParameters; + StringVector aDefinition; + bool bIsMacro; +}; + + + +// IMPLEMENTATION + +} //namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/pe_enum.cxx b/autodoc/source/parser/cpp/pe_enum.cxx new file mode 100644 index 000000000000..ae3024a34fce --- /dev/null +++ b/autodoc/source/parser/cpp/pe_enum.cxx @@ -0,0 +1,222 @@ +/************************************************************************* + * + * $RCSfile: pe_enum.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "pe_enum.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <ary/cpp/c_rwgate.hxx> +#include <ary/cpp/c_enum.hxx> +#include <all_toks.hxx> +#include "pe_enval.hxx" + + +namespace cpp { + + +PE_Enum::PE_Enum(Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Enum> ), + // pSpValue, + // pSpuValue, + // sLocalName, + pCurObject(0), + eResult_KindOf(is_declaration) +{ + Setup_StatusFunctions(); + + pSpValue = new SP_EnumValue(*this); + pSpuValue = new SPU_EnumValue(*pSpValue, 0, 0); +} + + +PE_Enum::~PE_Enum() +{ +} + +void +PE_Enum::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Enum::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Enum>::F_Tok F_Tok; + static F_Tok stateF_expectName[] = { On_expectName_Identifier, + On_expectName_SwBracket_Left + }; + static INT16 stateT_expectName[] = { Tid_Identifier, + Tid_SwBracket_Left + }; + + static F_Tok stateF_gotName[] = { On_gotName_SwBracket_Left }; + static INT16 stateT_gotName[] = { Tid_SwBracket_Left }; + + static F_Tok stateF_bodyStd[] = { On_bodyStd_Identifier, + On_bodyStd_SwBracket_Right }; + static INT16 stateT_bodyStd[] = { Tid_Identifier, + Tid_SwBracket_Right }; + + static F_Tok stateF_afterBlock[] = { On_afterBlock_Semicolon }; + static INT16 stateT_afterBlock[] = { Tid_Semicolon }; + + SEMPARSE_CREATE_STATUS(PE_Enum, expectName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Enum, gotName, On_gotName_Return2Type); + SEMPARSE_CREATE_STATUS(PE_Enum, bodyStd, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Enum, afterBlock, On_afterBlock_Return2Type); +} + +void +PE_Enum::InitData() +{ + pStati->SetCur(expectName); + pCurObject = 0; + sLocalName.clear(); + eResult_KindOf = is_declaration; +} + +void +PE_Enum::TransferData() +{ + pStati->SetCur(size_of_states); +} + +void +PE_Enum::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Enum::On_expectName_Identifier( const char * i_sText ) +{ + SetTokenResult(done, stay); + pStati->SetCur(gotName); + + sLocalName = i_sText; + pCurObject = & Env().AryGate().Store_Enum( Env().Context(), sLocalName ); +} + +void +PE_Enum::On_expectName_SwBracket_Left( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(bodyStd); + + sLocalName = ""; + pCurObject = & Env().AryGate().Store_Enum( Env().Context(), sLocalName ); + sLocalName = pCurObject->LocalName(); + + Env().OpenEnum(*pCurObject); +} + +void +PE_Enum::On_gotName_SwBracket_Left( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(bodyStd); + Env().OpenEnum(*pCurObject); +} + +void +PE_Enum::On_gotName_Return2Type( const char * ) +{ + SetTokenResult(not_done, pop_success); + + eResult_KindOf = is_qualified_typename; +} + +void +PE_Enum::On_bodyStd_Identifier( const char * i_sText ) +{ + pSpuValue->Push(not_done); +} + +void +PE_Enum::On_bodyStd_SwBracket_Right( const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterBlock); + + Env().CloseEnum(); +} + +void +PE_Enum::On_afterBlock_Semicolon( const char * ) +{ + SetTokenResult(not_done, pop_success); + eResult_KindOf = is_declaration; +} + +void +PE_Enum::On_afterBlock_Return2Type( const char * ) +{ + SetTokenResult(not_done, pop_success); + eResult_KindOf = is_implicit_declaration; +} + +} // namespace cpp + + + diff --git a/autodoc/source/parser/cpp/pe_enum.hxx b/autodoc/source/parser/cpp/pe_enum.hxx new file mode 100644 index 000000000000..4a81a52d4f32 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_enum.hxx @@ -0,0 +1,172 @@ +/************************************************************************* + * + * $RCSfile: pe_enum.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_PE_ENUM_HXX +#define ADC_CPP_PE_ENUM_HXX + + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS +// #include "all_toks.hxx" + + +namespace cpp { + + +class PE_EnumValue; + +class PE_Enum : public cpp::Cpp_PE +{ + public: + enum E_State + { + expectName, /// after "enum" + gotName, /// after name, before : or { + bodyStd, /// after { + afterBlock, /// after ending } + size_of_states + }; + + enum E_KindOfResult + { + is_declaration, // normal + is_implicit_declaration, // like in: enum Abc { rot, gelb, blau } aAbc; + is_qualified_typename // like in: enum Abc * fx(); + + }; + PE_Enum( + Cpp_PE * i_pParent ); + ~PE_Enum(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + E_KindOfResult Result_KindOf() const; + const udmstri & Result_LocalName() const; + const udmstri & Result_FirstNameSegment() const; + + private: + typedef SubPe< PE_Enum, PE_EnumValue > SP_EnumValue; + typedef SubPeUse< PE_Enum, PE_EnumValue> SPU_EnumValue; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void On_expectName_Identifier( const char * ); + void On_expectName_SwBracket_Left( const char * ); + + void On_gotName_SwBracket_Left( const char * ); + void On_gotName_Return2Type( const char * ); + + void On_bodyStd_Identifier( const char * ); + void On_bodyStd_SwBracket_Right( const char * ); + + void On_afterBlock_Semicolon( const char * ); + void On_afterBlock_Return2Type( const char * ); + + // DATA + Dyn< PeStatusArray<PE_Enum> > + pStati; + Dyn<SP_EnumValue> pSpValue; + Dyn<SPU_EnumValue> pSpuValue; + + udmstri sLocalName; + ary::cpp::Enum * pCurObject; + + E_KindOfResult eResult_KindOf; +}; + + + +// IMPLEMENTATION +inline PE_Enum::E_KindOfResult +PE_Enum::Result_KindOf() const +{ + return eResult_KindOf; +} + +inline const udmstri & +PE_Enum::Result_LocalName() const +{ + return sLocalName; +} + +inline const udmstri & +PE_Enum::Result_FirstNameSegment() const +{ + return sLocalName; +} + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/pe_enval.cxx b/autodoc/source/parser/cpp/pe_enval.cxx new file mode 100644 index 000000000000..4b4184465ded --- /dev/null +++ b/autodoc/source/parser/cpp/pe_enval.cxx @@ -0,0 +1,202 @@ +/************************************************************************* + * + * $RCSfile: pe_enval.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include "pe_enval.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/template/tpltools.hxx> +#include <ary/cpp/c_rwgate.hxx> +#include "pe_expr.hxx" + + + +namespace cpp { + + +PE_EnumValue::PE_EnumValue( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_EnumValue> ) + // pSpExpression, + // pSpuInitExpression +{ + Setup_StatusFunctions(); + + pSpExpression = new SP_Expression(*this); + pSpuInitExpression = new SPU_Expression(*pSpExpression, 0, &PE_EnumValue::SpReturn_InitExpression); +} + +PE_EnumValue::~PE_EnumValue() +{ +} + +void +PE_EnumValue::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_EnumValue::Setup_StatusFunctions() +{ + typedef CallFunction<PE_EnumValue>::F_Tok F_Tok; + + static F_Tok stateF_start[] = { On_start_Identifier }; + static INT16 stateT_start[] = { Tid_Identifier }; + + static F_Tok stateF_afterName[] = { On_afterName_SwBracket_Right, + On_afterName_Comma, + On_afterName_Assign }; + static INT16 stateT_afterName[] = { Tid_SwBracket_Right, + Tid_Comma, + Tid_Assign }; + + static F_Tok stateF_expectFinish[] = { On_expectFinish_SwBracket_Right, + On_expectFinish_Comma }; + static INT16 stateT_expectFinish[] = { Tid_SwBracket_Right, + Tid_Comma }; + + SEMPARSE_CREATE_STATUS(PE_EnumValue, start, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_EnumValue, afterName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_EnumValue, expectFinish, Hdl_SyntaxError); +} + +void +PE_EnumValue::InitData() +{ + pStati->SetCur(start); + + sName.clear(); + sInitExpression.clear(); +} + +void +PE_EnumValue::TransferData() +{ + pStati->SetCur(size_of_states); + + ary::cpp::EnumValue & + rEnVal = Env().AryGate().Store_EnumValue( + Env().Context(), sName, sInitExpression ); + Env().Event_Store_EnumValue(rEnVal); +} + +void +PE_EnumValue::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_EnumValue::SpReturn_InitExpression() +{ + pStati->SetCur(expectFinish); + + sInitExpression = pSpuInitExpression->Child().Result_Text(); +} + +void +PE_EnumValue::On_start_Identifier(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterName); + + sName = i_sText; +} + +void +PE_EnumValue::On_afterName_SwBracket_Right(const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_EnumValue::On_afterName_Comma(const char * ) +{ + SetTokenResult(done, pop_success); +} + +void +PE_EnumValue::On_afterName_Assign(const char * ) +{ + pSpuInitExpression->Push(done); +} + +void +PE_EnumValue::On_expectFinish_SwBracket_Right(const char * ) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_EnumValue::On_expectFinish_Comma(const char * ) +{ + SetTokenResult(done, pop_success); +} + + +} // namespace cpp + + + + diff --git a/autodoc/source/parser/cpp/pe_enval.hxx b/autodoc/source/parser/cpp/pe_enval.hxx new file mode 100644 index 000000000000..0e62ea59b628 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_enval.hxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * $RCSfile: pe_enval.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_PE_ENVAL_HXX +#define ADC_CPP_PE_ENVAL_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS + + +namespace cpp { + +class PE_Expression; + + +class PE_EnumValue : public Cpp_PE +{ + public: + enum E_State + { + start, // before name + afterName, + expectFinish, // after init-expression + size_of_states + }; + PE_EnumValue( + Cpp_PE * i_pParent ); + ~PE_EnumValue(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + private: + typedef SubPe< PE_EnumValue, PE_Expression > SP_Expression; + typedef SubPeUse< PE_EnumValue, PE_Expression> SPU_Expression; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError(const char *); + + void SpReturn_InitExpression(); + + void On_start_Identifier(const char * ); + + void On_afterName_SwBracket_Right(const char * ); + void On_afterName_Comma(const char * ); + void On_afterName_Assign(const char * ); + + void On_expectFinish_SwBracket_Right(const char * ); + void On_expectFinish_Comma(const char * ); + + // DATA + Dyn< PeStatusArray<PE_EnumValue> > + pStati; + Dyn<SP_Expression> pSpExpression; + Dyn<SPU_Expression> pSpuInitExpression; + + udmstri sName; + udmstri sInitExpression; +}; + + + +// IMPLEMENTATION + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/pe_expr.cxx b/autodoc/source/parser/cpp/pe_expr.cxx new file mode 100644 index 000000000000..1aab3b3ad901 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_expr.cxx @@ -0,0 +1,238 @@ +/************************************************************************* + * + * $RCSfile: pe_expr.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "pe_expr.hxx" + + +// NOT FULLY DECLARED SERVICES + + +namespace cpp { + + + +PE_Expression::PE_Expression( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Expression> ), + aResult_Text(100), + nBracketCounter(0) +{ + Setup_StatusFunctions(); +} + + +PE_Expression::~PE_Expression() +{ +} + +void +PE_Expression::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); + +#if 0 + switch (i_rTok.TypeId()) + { + case Tid_SwBracket_Left: SetTokenResult(done, stay); + nBracketCounter++; + bBlockOpened = true; + break; + case Tid_SwBracket_Right: SetTokenResult(done, stay); + nBracketCounter--; + break; + case Tid_Semicolon: if (nBracketCounter == 0) + SetTokenResult(done, pop_success); + else + SetTokenResult(done, stay); + break; + default: + if ( bBlockOpened AND nBracketCounter == 0 ) + { + SetTokenResult(not_done, pop_success); + } + else + { + SetTokenResult(done, stay); + } + } // end switch +#endif // 0 +} + +void +PE_Expression::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Expression>::F_Tok F_Tok; + + static F_Tok stateF_std[] = { On_std_SwBracket_Left, + On_std_SwBracket_Right, + On_std_ArrayBracket_Left, + On_std_ArrayBracket_Right, + On_std_Bracket_Left, + On_std_Bracket_Right, + On_std_Semicolon, + On_std_Comma }; + static INT16 stateT_std[] = { Tid_SwBracket_Left, + Tid_SwBracket_Right, + Tid_ArrayBracket_Left, + Tid_ArrayBracket_Right, + Tid_Bracket_Left, + Tid_Bracket_Right, + Tid_Semicolon, + Tid_Comma }; + + SEMPARSE_CREATE_STATUS(PE_Expression, std, On_std_Default); +} + +void +PE_Expression::InitData() +{ + pStati->SetCur(std); + aResult_Text.seekp(0); + nBracketCounter = 0; +} + +void +PE_Expression::TransferData() +{ + pStati->SetCur(size_of_states); + if ( aResult_Text.tellp() > 0) + aResult_Text.pop_back(1); +} + +void +PE_Expression::On_std_Default( const char * i_sText) +{ + SetTokenResult(done, stay); + aResult_Text << i_sText << " "; +} + +void +PE_Expression::On_std_SwBracket_Left( const char *) +{ + SetTokenResult(done, stay); + nBracketCounter++; +} + +void +PE_Expression::On_std_SwBracket_Right( const char *) +{ + nBracketCounter--; + if ( nBracketCounter >= 0 ) + SetTokenResult(done, stay); + else + SetTokenResult(not_done, pop_success); +} + +void +PE_Expression::On_std_ArrayBracket_Left( const char *) +{ + SetTokenResult(done, stay); + nBracketCounter++; +} + +void +PE_Expression::On_std_ArrayBracket_Right( const char *) +{ + nBracketCounter--; + if ( nBracketCounter >= 0 ) + SetTokenResult(done, stay); + else + SetTokenResult(not_done, pop_success); +} + +void +PE_Expression::On_std_Bracket_Left( const char *) +{ + SetTokenResult(done, stay); + nBracketCounter++; +} + +void +PE_Expression::On_std_Bracket_Right( const char *) +{ + nBracketCounter--; + if ( nBracketCounter >= 0 ) + SetTokenResult(done, stay); + else + SetTokenResult(not_done, pop_success); +} + +void +PE_Expression::On_std_Semicolon( const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Expression::On_std_Comma( const char *) +{ + SetTokenResult(not_done, pop_success); +} + + +} // namespace cpp + + + + + + diff --git a/autodoc/source/parser/cpp/pe_expr.hxx b/autodoc/source/parser/cpp/pe_expr.hxx new file mode 100644 index 000000000000..0e3eef83f680 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_expr.hxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * $RCSfile: pe_expr.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef ADC_CPP_PE_EXPR_HXX +#define ADC_CPP_PE_EXPR_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS + + +namespace cpp { + + +class PE_Expression : public Cpp_PE +{ + public: + enum E_State + { + std, + size_of_states + }; + PE_Expression( + Cpp_PE * i_pParent ); + ~PE_Expression(); + + const char * Result_Text() const; + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + private: + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void On_std_Default( const char *); + + void On_std_SwBracket_Left( const char *); + void On_std_SwBracket_Right( const char *); + void On_std_ArrayBracket_Left( const char *); + void On_std_ArrayBracket_Right( const char *); + void On_std_Bracket_Left( const char *); + void On_std_Bracket_Right( const char *); + void On_std_Semicolon( const char *); + void On_std_Comma( const char *); + + // DATA + Dyn< PeStatusArray<PE_Expression> > + pStati; + + csv::StreamStr aResult_Text; + + intt nBracketCounter; +}; + + + +// IMPLEMENTATION + +inline const char * +PE_Expression::Result_Text() const +{ + return aResult_Text.c_str(); +} + + +} // namespace cpp + + + + +#endif + + diff --git a/autodoc/source/parser/cpp/pe_file.cxx b/autodoc/source/parser/cpp/pe_file.cxx new file mode 100644 index 000000000000..2af9547fc24b --- /dev/null +++ b/autodoc/source/parser/cpp/pe_file.cxx @@ -0,0 +1,348 @@ +/************************************************************************* + * + * $RCSfile: pe_file.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "pe_file.hxx" + +// NOT FULLY DECLARED SERVICES +#include "pe_defs.hxx" +#include "pe_enum.hxx" +#include "pe_namsp.hxx" +#include "pe_tpltp.hxx" +#include "pe_tydef.hxx" +#include "pe_vafu.hxx" +#include "pe_ignor.hxx" + + +// NOT FULLY DECLARED SERVICES + + +namespace cpp +{ + +PE_File::PE_File( cpp::PeEnvironment & io_rEnv) + : Cpp_PE(io_rEnv), + pEnv(&io_rEnv), + pStati( new PeStatusArray<PE_File> ), + // pSpNamespace, + // pSpTypedef, + // pSpVarFunc, + // pSpIgnore, + // pSpuNamespace, + // pSpuClass, + // pSpuTypedef, + // pSpuVarFunc, + // pSpuTemplate, + // pSpuUsing, + // pSpuIgnoreFailure, + bWithinSingleExternC(false) +{ + Setup_StatusFunctions(); + + pSpNamespace = new SP_Namespace(*this); + pSpTypedef = new SP_Typedef(*this); + pSpVarFunc = new SP_VarFunc(*this); + pSpTemplate = new SP_Template(*this); + pSpDefs = new SP_Defines(*this); + pSpIgnore = new SP_Ignore(*this); + + pSpuNamespace = new SPU_Namespace(*pSpNamespace, 0, 0); + pSpuTypedef = new SPU_Typedef(*pSpTypedef, 0, 0); + pSpuVarFunc = new SPU_VarFunc(*pSpVarFunc, 0, &PE_File::SpReturn_VarFunc); + pSpuTemplate = new SPU_Template(*pSpTemplate, 0, &PE_File::SpReturn_Template); + pSpuDefs = new SPU_Defines(*pSpDefs, 0, 0); + pSpuUsing = new SPU_Ignore(*pSpIgnore, 0, 0); + pSpuIgnoreFailure + = new SPU_Ignore(*pSpIgnore, 0, 0); +} + +PE_File::~PE_File() +{ +} + +void +PE_File::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +Cpp_PE * +PE_File::Handle_ChildFailure() +{ + SetCurSPU(pSpuIgnoreFailure.Ptr()); + return &pSpuIgnoreFailure->Child(); +} + +ary::cpp::RwGate & +PE_File::AryGate() const +{ + return const_cast< PE_File& >(*this).Env().AryGate(); +} + +void +PE_File::Setup_StatusFunctions() +{ + typedef CallFunction<PE_File>::F_Tok F_Tok; + static F_Tok stateF_std[] = { On_std_VarFunc, + On_std_ClassKey, + On_std_ClassKey, + On_std_ClassKey, + On_std_enum, + On_std_typedef, + On_std_template, + On_std_VarFunc, + On_std_VarFunc, + On_std_extern, + On_std_VarFunc, + On_std_VarFunc, + On_std_VarFunc, + On_std_namespace, + On_std_using, + On_std_SwBracketRight, + On_std_VarFunc, + On_std_DefineName, + On_std_MacroName, + On_std_VarFunc, + On_std_VarFunc }; + static INT16 stateT_std[] = { Tid_Identifier, + Tid_class, + Tid_struct, + Tid_union, + Tid_enum, + Tid_typedef, + Tid_template, + Tid_const, + Tid_volatile, + Tid_extern, + Tid_static, + Tid_register, + Tid_inline, + Tid_namespace, + Tid_using, + Tid_SwBracket_Right, + Tid_DoubleColon, + Tid_DefineName, + Tid_MacroName, + Tid_BuiltInType, + Tid_TypeSpecializer }; + + static F_Tok stateF_in_extern[] = { On_in_extern_Constant }; + static INT16 stateT_in_extern[] = { Tid_Constant }; + + static F_Tok stateF_in_externC[] = { On_in_externC_SwBracket_Left }; + static INT16 stateT_in_externC[] = { Tid_SwBracket_Left }; + + + SEMPARSE_CREATE_STATUS(PE_File, std, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_File, in_extern, On_in_extern_Ignore); + SEMPARSE_CREATE_STATUS(PE_File, in_externC, On_in_externC_NoBlock); +} + +void +PE_File::InitData() +{ + pStati->SetCur(std); +} + +void +PE_File::TransferData() +{ + pStati->SetCur(size_of_states); +} + +void +PE_File::Hdl_SyntaxError( const char * i_sText) +{ + if ( *i_sText == ';' ) + { + Cerr() << Env().CurFileName() << ", line " + << Env().LineCount() + << ": Sourcecode error: ';' as a toplevel declaration is deprecated." + << Endl(); + SetTokenResult(done,stay); + return; + } + + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_File::SpReturn_VarFunc() +{ + if (bWithinSingleExternC) + { + Env().CloseBlock(); + bWithinSingleExternC = false; + } +} + +void +PE_File::SpReturn_Template() +{ + Env().OpenTemplate( pSpuTemplate->Child().Result_Parameters() ); +} + +void +PE_File::On_std_namespace(const char * i_sText) +{ + pSpuNamespace->Push(done); +} + +void +PE_File::On_std_ClassKey(const char * i_sText) +{ + pSpuVarFunc->Push(not_done); // This is correct, + // classes are parsed via PE_Type. +} + +void +PE_File::On_std_typedef(const char * i_sText) +{ + pSpuTypedef->Push(not_done); +} + +void +PE_File::On_std_enum(const char * i_sText) +{ + pSpuVarFunc->Push(not_done); // This is correct, + // enums are parsed via PE_Type. +} + +void +PE_File::On_std_VarFunc(const char * i_sText) +{ + pSpuVarFunc->Push(not_done); +} + +void +PE_File::On_std_template(const char * i_sText) +{ + pSpuTemplate->Push(done); +} + +void +PE_File::On_std_extern(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(in_extern); +} + +void +PE_File::On_std_using(const char * i_sText) +{ + pSpuUsing->Push(done); +} + +void +PE_File::On_std_SwBracketRight(const char * i_sText) +{ + SetTokenResult(done,stay); + Env().CloseBlock(); +} + +void +PE_File::On_std_DefineName(const char * i_sText) +{ + pSpuDefs->Push(not_done); +} + +void +PE_File::On_std_MacroName(const char * i_sText) +{ + pSpuDefs->Push(not_done); +} + +void +PE_File::On_in_extern_Constant(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(in_externC); + + Env().OpenExternC(); +} + +void +PE_File::On_in_extern_Ignore(const char * i_sText) +{ + SetTokenResult(not_done, stay); + pStati->SetCur(std); +} + +void +PE_File::On_in_externC_SwBracket_Left(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(std); +} + +void +PE_File::On_in_externC_NoBlock(const char * i_sText) +{ + SetTokenResult(not_done, stay); + pStati->SetCur(std); + + bWithinSingleExternC = true; +} + + +} // namespace cpp + + diff --git a/autodoc/source/parser/cpp/pe_file.hxx b/autodoc/source/parser/cpp/pe_file.hxx new file mode 100644 index 000000000000..550d4224ea50 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_file.hxx @@ -0,0 +1,246 @@ +/************************************************************************* + * + * $RCSfile: pe_file.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_PE_FILE_HXX +#define ADC_CPP_PE_FILE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <ary/ids.hxx> +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS + + +namespace cpp { + + class PeEnvironment; + + class PE_Namespace; + class PE_Enum; + class PE_Typedef; + class PE_VarFunc; + class PE_TemplateTop; + class PE_Defines; + class PE_Ignore; + +#if 0 +class PE_Template; +class PE_Extern; +#endif + + +class PE_File : public Cpp_PE +{ + public: + enum E_State + { + std, /// before class, struct or union + in_extern, + in_externC, + size_of_states + }; + + PE_File( + PeEnvironment & io_rEnv ); + ~PE_File(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + virtual Cpp_PE * Handle_ChildFailure(); + + ary::cpp::RwGate & AryGate() const; + + private: + typedef SubPe< PE_File, PE_Namespace> SP_Namespace; + typedef SubPe< PE_File, PE_Typedef> SP_Typedef; + typedef SubPe< PE_File, PE_VarFunc> SP_VarFunc; + typedef SubPe< PE_File, PE_TemplateTop> SP_Template; + typedef SubPe< PE_File, PE_Defines> SP_Defines; + typedef SubPe< PE_File, PE_Ignore > SP_Ignore; +#if 0 + typedef SubPe< PE_File, PE_Using> SP_Using; +#endif // 0 + + typedef SubPeUse< PE_File, PE_Namespace> SPU_Namespace; + typedef SubPeUse< PE_File, PE_Typedef> SPU_Typedef; + typedef SubPeUse< PE_File, PE_VarFunc> SPU_VarFunc; + typedef SubPeUse< PE_File, PE_TemplateTop> SPU_Template; + typedef SubPeUse< PE_File, PE_Defines> SPU_Defines; + typedef SubPeUse< PE_File, PE_Ignore> SPU_Ignore; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void SpReturn_VarFunc(); + void SpReturn_Template(); + + void On_std_namespace(const char * i_sText); + void On_std_ClassKey(const char * i_sText); + void On_std_typedef(const char * i_sText); + void On_std_enum(const char * i_sText); + void On_std_VarFunc(const char * i_sText); + void On_std_template(const char * i_sText); + void On_std_extern(const char * i_sText); + void On_std_using(const char * i_sText); + void On_std_SwBracketRight(const char * i_sText); + + void On_std_DefineName(const char * i_sText); + void On_std_MacroName(const char * i_sText); + + void On_in_extern_Constant(const char * i_sText); + void On_in_extern_Ignore(const char * i_sText); + void On_in_externC_SwBracket_Left(const char * i_sText); + void On_in_externC_NoBlock(const char * i_sText); + + PeEnvironment & Env() { return *pEnv; } + + + // DATA + PeEnvironment * pEnv; + + Dyn< PeStatusArray<PE_File> > + pStati; + + Dyn<SP_Namespace> pSpNamespace; + Dyn<SP_Typedef> pSpTypedef; + Dyn<SP_VarFunc> pSpVarFunc; + Dyn<SP_Template> pSpTemplate; + Dyn<SP_Defines> pSpDefs; + + Dyn<SP_Ignore> pSpIgnore; +#if 0 + SP_Using aSpUsing; +#endif // 0 + + Dyn<SPU_Namespace> pSpuNamespace; + Dyn<SPU_Typedef> pSpuTypedef; + Dyn<SPU_VarFunc> pSpuVarFunc; + Dyn<SPU_Template> pSpuTemplate; + Dyn<SPU_Defines> pSpuDefs; + + Dyn<SPU_Ignore> pSpuUsing; + Dyn<SPU_Ignore> pSpuIgnoreFailure; + + bool bWithinSingleExternC; /** After 'extern "C"' without following '{', + waiting for the next function or variable to + set back to false. + */ +}; + +} // namespace cpp + + + +#if 0 // Branches + +namespace + -> Named Namespace declaration + -> Unnamed Namespace declaration + -> Namespace alias definition + +class struct union + -> Class + -> Predeclaration + +typedef + -> Typedef + +enum + -> Enum + +extern + -> Extern-"C" + -> TypeDeclaration + +TypeDeclaration + -> FunctionDecl + -> FunctionDef + -> Variable + +template + -> TemplateClass + -> TemplateFunction + -> TemplateFunction/Method-Implementation + -> TemplatePredeclaration + +} + -> End of Namespace + -> End of Extern-"C" + +asm + -> AssemblerDeclaration + +using + -> Using-Declaration + -> Using-Directive + +#endif // 0 + + +#endif + diff --git a/autodoc/source/parser/cpp/pe_funct.cxx b/autodoc/source/parser/cpp/pe_funct.cxx new file mode 100644 index 000000000000..0e320f1e30e3 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_funct.cxx @@ -0,0 +1,636 @@ +/************************************************************************* + * + * $RCSfile: pe_funct.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include "pe_funct.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/template/tpltools.hxx> +#include <ary/cpp/inpcontx.hxx> +#include <ary/cpp/c_rwgate.hxx> +#include <ary/cpp/c_disply.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/ca_type.hxx> +#include "pe_type.hxx" +#include "pe_param.hxx" + + + + +namespace cpp { + + +inline void +PE_Function::PerformFinishingPunctuation() +{ SetTokenResult(not_done,pop_success); +} + + +PE_Function::PE_Function( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Function> ), + // pSpParameter, + // pSpuParameter, + // pSpType, + // pSpuException, + // pSpuCastOperatorType, + nResult(0), + bResult_WithImplementation(false), + aName(60), + eVirtuality(ary::cpp::VIRTUAL_none), + eConVol(ary::cpp::CONVOL_none), + // aFlags, + nReturnType(0), + // aParameters + // aExceptions, + bThrow(false), + nBracketCounterInImplementation(0) +{ + Setup_StatusFunctions(); + + pSpParameter = new SP_Parameter(*this); + pSpType = new SP_Type(*this); + + pSpuParameter = new SPU_Parameter(*pSpParameter, 0, &PE_Function::SpReturn_Parameter); + pSpuException = new SPU_Type(*pSpType, 0, &PE_Function::SpReturn_Exception); + pSpuCastOperatorType = new SPU_Type(*pSpType, &PE_Function::SpInit_CastOperatorType, &PE_Function::SpReturn_CastOperatorType); +} + +PE_Function::~PE_Function() +{ + +} + +void +PE_Function::Init_Std( const udmstri & i_sName, + ary::Tid i_nReturnType, + bool i_bVirtual, + ary::cpp::FunctionFlags i_aFlags ) +{ + aName << i_sName; + eVirtuality = i_bVirtual ? ary::cpp::VIRTUAL_virtual : ary::cpp::VIRTUAL_none; + aFlags = i_aFlags; + nReturnType = i_nReturnType; + pStati->SetCur(afterName); +} + +void +PE_Function::Init_Ctor( const udmstri & i_sName, + ary::cpp::FunctionFlags i_aFlags ) +{ + aName << i_sName; + eVirtuality = ary::cpp::VIRTUAL_none; + aFlags = i_aFlags; + nReturnType = 0; + pStati->SetCur(afterName); +} + +void +PE_Function::Init_Dtor( const udmstri & i_sName, + bool i_bVirtual, + ary::cpp::FunctionFlags i_aFlags ) +{ + aName << "~" << i_sName; + eVirtuality = i_bVirtual ? ary::cpp::VIRTUAL_virtual : ary::cpp::VIRTUAL_none; + aFlags = i_aFlags; + nReturnType = 0; + pStati->SetCur(afterName); +} + +void +PE_Function::Init_CastOperator( bool i_bVirtual, + ary::cpp::FunctionFlags i_aFlags ) +{ + aName << "operator "; + eVirtuality = i_bVirtual ? ary::cpp::VIRTUAL_virtual : ary::cpp::VIRTUAL_none; + aFlags = i_aFlags; + nReturnType = 0; + pStati->SetCur(afterCastOperator); +} + +void +PE_Function::Init_NormalOperator( ary::Tid i_nReturnType, + bool i_bVirtual, + ary::cpp::FunctionFlags i_aFlags ) +{ + aName << "operator"; + eVirtuality = i_bVirtual ? ary::cpp::VIRTUAL_virtual : ary::cpp::VIRTUAL_none; + aFlags = i_aFlags; + nReturnType = i_nReturnType; + pStati->SetCur(afterStdOperator); +} + +ary::Cid +PE_Function::Result_Id() const +{ + return nResult; +} + +void +PE_Function::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Function::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Function>::F_Tok F_Tok; + + static F_Tok stateF_afterStdOperator[] = + { On_afterOperator_Std_Operator, + On_afterOperator_Std_LeftBracket, + On_afterOperator_Std_LeftBracket, + On_afterOperator_Std_Operator, + On_afterOperator_Std_Operator, + On_afterOperator_Std_Operator, + On_afterOperator_Std_Operator, + On_afterOperator_Std_Operator, + On_afterOperator_Std_Operator }; + static INT16 stateT_afterStdOperator[] = + { Tid_Operator, + Tid_ArrayBracket_Left, + Tid_Bracket_Left, + Tid_Comma, + Tid_Assign, + Tid_Less, + Tid_Greater, + Tid_Asterix, + Tid_AmpersAnd }; + + static F_Tok stateF_afterStdOperatorLeftBracket[] = + { On_afterStdOperatorLeftBracket_RightBracket, + On_afterStdOperatorLeftBracket_RightBracket }; + static INT16 stateT_afterStdOperatorLeftBracket[] = + { Tid_ArrayBracket_Right, + Tid_Bracket_Right }; + + static F_Tok stateF_afterCastOperator[] = + { On_afterOperator_Cast_Type, + On_afterOperator_Cast_Type, + On_afterOperator_Cast_Type, + On_afterOperator_Cast_Type, + On_afterOperator_Cast_Type, + On_afterOperator_Cast_Type, + On_afterOperator_Cast_Type, + On_afterOperator_Cast_Type, + On_afterOperator_Cast_Type, + On_afterOperator_Cast_Type }; + static INT16 stateT_afterCastOperator[] = + { Tid_Identifier, + Tid_class, + Tid_struct, + Tid_union, + Tid_enum, + Tid_const, + Tid_volatile, + Tid_DoubleColon, + Tid_BuiltInType, + Tid_TypeSpecializer }; + + static F_Tok stateF_afterName[] = { On_afterName_Bracket_Left }; + static INT16 stateT_afterName[] = { Tid_Bracket_Left }; + + static F_Tok stateF_expectParameterSeparator[] = + { On_expectParameterSeparator_BracketRight, + On_expectParameterSeparator_Comma }; + static INT16 stateT_expectParameterSeparator[] = + { Tid_Bracket_Right, + Tid_Comma }; + + static F_Tok stateF_afterParameters[] = { On_afterParameters_const, + On_afterParameters_volatile, + On_afterParameters_throw, + On_afterParameters_SwBracket_Left, + On_afterParameters_Semicolon, + On_afterParameters_Comma, + On_afterParameters_Colon, + On_afterParameters_Assign }; + static INT16 stateT_afterParameters[] = { Tid_const, + Tid_volatile, + Tid_throw, + Tid_SwBracket_Left, + Tid_Semicolon, + Tid_Comma, + Tid_Colon, + Tid_Assign }; + + static F_Tok stateF_afterThrow[] = { On_afterThrow_Bracket_Left }; + static INT16 stateT_afterThrow[] = { Tid_Bracket_Left }; + + static F_Tok stateF_expectExceptionSeparator[] = + { On_expectExceptionSeparator_BracketRight, + On_expectExceptionSeparator_Comma }; + static INT16 stateT_expectExceptionSeparator[] = + { Tid_Bracket_Right, + Tid_Comma }; + + static F_Tok stateF_afterExceptions[] = { On_afterExceptions_SwBracket_Left, + On_afterExceptions_Semicolon, + On_afterExceptions_Comma, + On_afterExceptions_Colon, + On_afterExceptions_Assign }; + static INT16 stateT_afterExceptions[] = { Tid_SwBracket_Left, + Tid_Semicolon, + Tid_Comma, + Tid_Colon, + Tid_Assign }; + + static F_Tok stateF_expectZero[] = { On_expectZero_Constant }; + static INT16 stateT_expectZero[] = { Tid_Constant }; + + static F_Tok stateF_inImplementation[] = + { On_inImplementation_SwBracket_Left, + On_inImplementation_SwBracket_Right }; + static INT16 stateT_inImplementation[] = + { Tid_SwBracket_Left, + Tid_SwBracket_Right }; + + SEMPARSE_CREATE_STATUS(PE_Function, afterStdOperator, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, afterStdOperatorLeftBracket, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, afterCastOperator, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, afterName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, expectParameterSeparator, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, afterParameters, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, afterThrow, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, expectExceptionSeparator, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, afterExceptions, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, expectZero, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Function, inImplementation, On_inImplementation_Default ); +} + +void +PE_Function::InitData() +{ + pStati->SetCur( afterName ), + nResult = 0; + bResult_WithImplementation = false; + aName.seekp(0); + eVirtuality = ary::cpp::VIRTUAL_none; + eConVol = ary::cpp::CONVOL_none; + aFlags.Reset(); + nReturnType = 0; + csv::erase_container(aParameters); + csv::erase_container(aExceptions); + bThrow = false; +} + +void +PE_Function::TransferData() +{ + udmstri sName( aName.c_str() ); + ary::cpp::Function & rFunction = + Env().AryGate().Store_Operation( + Env().Context(), + sName, + nReturnType, + aParameters, + eVirtuality, + eConVol, + aFlags, + bThrow, + aExceptions ); + + Dyn< StringVector > + pTplParams ( Env().Get_CurTemplateParameters() ); + if ( pTplParams ) + { + for ( StringVector::const_iterator it = pTplParams->begin(); + it != pTplParams->end(); + ++it ) + { + rFunction.Add_TemplateParameterType( *it, 0 ); + } // end for + } + + Env().Event_Store_Function(rFunction); + + pStati->SetCur(size_of_states); +} + +void +PE_Function::Hdl_SyntaxError(const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Function::SpInit_CastOperatorType() +{ + pSpuCastOperatorType->Child().Init_AsCastOperatorType(); +} + +void +PE_Function::SpReturn_Parameter() +{ + pStati->SetCur(expectParameterSeparator); + + ary::Tid nParamType = pSpuParameter->Child().Result_FrontType(); + if ( nParamType != 0 ) // Check, if there was a parameter, or only the closing ')'. + { + aParameters.push_back( pSpuParameter->Child().Result_ParamInfo() ); + } +} + +void +PE_Function::SpReturn_Exception() +{ + pStati->SetCur(expectExceptionSeparator); + + ary::Tid nException = pSpuException->Child().Result_Type().Id(); + if ( nException != 0 AND pSpuException->Child().Result_KindOf() == PE_Type::is_type ) + { + aExceptions.push_back( nException ); + } +} + +void +PE_Function::SpReturn_CastOperatorType() +{ + pStati->SetCur(afterName); + + Env().AryGate().RoGate().Get_TypeText( + aName, pSpuCastOperatorType->Child().Result_Type().Id() ); + aName; +} + +void +PE_Function::On_afterOperator_Std_Operator(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(afterName); + + if ( 'a' <= *i_sText AND *i_sText <= 'z' ) + aName << ' '; + aName << i_sText; +} + +void +PE_Function::On_afterOperator_Std_LeftBracket(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(afterStdOperatorLeftBracket); + + aName << i_sText; +} + +void +PE_Function::On_afterStdOperatorLeftBracket_RightBracket(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(afterName); + + aName; +} + +void +PE_Function::On_afterOperator_Cast_Type(const char * i_sText) +{ + pSpuCastOperatorType->Push(not_done); +} + +void +PE_Function::On_afterName_Bracket_Left(const char * i_sText) +{ + pSpuParameter->Push(done); +} + +void +PE_Function::On_expectParameterSeparator_BracketRight(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(afterParameters); +} + +void +PE_Function::On_expectParameterSeparator_Comma(const char * i_sText) +{ + pSpuParameter->Push(done); +} + +void +PE_Function::On_afterParameters_const(const char * i_sText) +{ + SetTokenResult(done,stay); + eConVol = static_cast<E_ConVol>( + static_cast<int>(eConVol) | static_cast<int>(ary::cpp::CONVOL_const) ); +} + +void +PE_Function::On_afterParameters_volatile(const char * i_sText) +{ + SetTokenResult(done,stay); + eConVol = static_cast<E_ConVol>( + static_cast<int>(eConVol) | static_cast<int>(ary::cpp::CONVOL_volatile) ); +} + +void +PE_Function::On_afterParameters_throw(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(afterThrow); + bThrow = true; +} + +void +PE_Function::On_afterParameters_SwBracket_Left(const char * i_sText) +{ + EnterImplementation(1); +} + +void +PE_Function::On_afterParameters_Semicolon(const char * i_sText) +{ + PerformFinishingPunctuation(); +} + +void +PE_Function::On_afterParameters_Comma(const char * i_sText) +{ + PerformFinishingPunctuation(); +} + +void +PE_Function::On_afterParameters_Colon(const char * i_sText) +{ + EnterImplementation(0); +} + +void +PE_Function::On_afterParameters_Assign(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(expectZero); +} + +void +PE_Function::On_afterThrow_Bracket_Left(const char * i_sText) +{ + pSpuException->Push(done); +} + +void +PE_Function::On_expectExceptionSeparator_BracketRight(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(afterExceptions); +} + +void +PE_Function::On_expectExceptionSeparator_Comma(const char * i_sText) +{ + pSpuException->Push(done); +} + +void +PE_Function::On_afterExceptions_SwBracket_Left(const char * i_sText) +{ + EnterImplementation(1); +} + +void +PE_Function::On_afterExceptions_Semicolon(const char * i_sText) +{ + PerformFinishingPunctuation(); +} + +void +PE_Function::On_afterExceptions_Comma(const char * i_sText) +{ + PerformFinishingPunctuation(); +} + +void +PE_Function::On_afterExceptions_Colon(const char * i_sText) +{ + EnterImplementation(0); +} + +void +PE_Function::On_afterExceptions_Assign(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(expectZero); +} + +void +PE_Function::On_expectZero_Constant(const char * i_sText) +{ + if ( strcmp(i_sText,"0") != 0 ) + Hdl_SyntaxError(i_sText); + + SetTokenResult(done,stay); + pStati->SetCur(afterExceptions); + + eVirtuality = ary::cpp::VIRTUAL_abstract; +} + +void +PE_Function::On_inImplementation_SwBracket_Left(const char * i_sText) +{ + SetTokenResult(done,stay); + nBracketCounterInImplementation++; +} + +void +PE_Function::On_inImplementation_SwBracket_Right(const char * i_sText) +{ + nBracketCounterInImplementation--; + if (nBracketCounterInImplementation == 0) + { + SetTokenResult(done,pop_success); + } + else + { + SetTokenResult(done,stay); + } +} + +void +PE_Function::On_inImplementation_Default(const char * i_sText) +{ + SetTokenResult(done,stay); +} + +void +PE_Function::EnterImplementation( intt i_nBracketCountStart ) +{ + SetTokenResult(done,stay); + pStati->SetCur(inImplementation); + + bResult_WithImplementation = true; + nBracketCounterInImplementation = i_nBracketCountStart; + if ( Env().Context().CurClass() != 0 ) + { + aFlags.SetInline(); + } +} + + + +} // namespace cpp + + + + + diff --git a/autodoc/source/parser/cpp/pe_funct.hxx b/autodoc/source/parser/cpp/pe_funct.hxx new file mode 100644 index 000000000000..3eb65df81408 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_funct.hxx @@ -0,0 +1,315 @@ +/************************************************************************* + * + * $RCSfile: pe_funct.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef ADC_CPP_PE_FUNCT_HXX +#define ADC_CPP_PE_FUNCT_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> +#include <ary/cpp/c_etypes.hxx> +#include <ary/cpp/c_vfflag.hxx> + // PARAMETERS + + +namespace ary +{ +namespace cpp +{ +class Function; +struct S_VariableInfo; +} +} + +namespace cpp +{ + +class PE_Type; +class PE_Parameter; + +class PE_Function : public Cpp_PE +{ + public: + enum E_State + { + afterStdOperator, // if initializes as operator + afterStdOperatorLeftBracket, + // if initializes as operator with ( or [ + afterCastOperator, // if initializes as operator + afterName, // undecided + expectParameterSeparator, // + afterParameters, // before const, volatile throw or = 0. + afterThrow, // expect ( + expectExceptionSeparator, // + afterExceptions, // = 0 oder ; oder , + expectZero, // after '=' + inImplementation, // after { + size_of_states + }; + typedef ary::cpp::E_Protection E_Protection; + typedef ary::cpp::E_Virtuality E_Virtuality; + typedef ary::cpp::E_ConVol E_ConVol; + + PE_Function( + Cpp_PE * i_pParent ); + ~PE_Function(); + + void Init_Std( + const udmstri & i_sName, + ary::Tid i_nReturnType, + bool i_bVirtual, + ary::cpp::FunctionFlags + i_aFlags ); + void Init_Ctor( + const udmstri & i_sName, + ary::cpp::FunctionFlags + i_aFlags ); + void Init_Dtor( + const udmstri & i_sName, + bool i_bVirtual, + ary::cpp::FunctionFlags + i_aFlags ); + void Init_CastOperator( + bool i_bVirtual, + ary::cpp::FunctionFlags + i_aFlags ); + void Init_NormalOperator( + ary::Tid i_nReturnType, + bool i_bVirtual, + ary::cpp::FunctionFlags + i_aFlags ); + + ary::Cid Result_Id() const; + bool Result_WithImplementation() const; + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + private: + typedef SubPe< PE_Function, PE_Type > SP_Type; + typedef SubPeUse< PE_Function, PE_Type > SPU_Type; + typedef SubPe< PE_Function, PE_Parameter> SP_Parameter; + typedef SubPeUse<PE_Function, PE_Parameter> SPU_Parameter; + + typedef std::vector<ary::cpp::S_Parameter> ParameterList; + typedef std::vector<ary::Tid> ExceptionTypeList; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError(const char * i_sText); + + void SpInit_CastOperatorType(); + + void SpReturn_Parameter(); + void SpReturn_Exception(); + void SpReturn_CastOperatorType(); + + void On_afterOperator_Std_Operator(const char * i_sText); // Operator+() etc. + void On_afterOperator_Std_LeftBracket(const char * i_sText); // operator [] or () + void On_afterStdOperatorLeftBracket_RightBracket(const char * i_sText); + void On_afterOperator_Cast_Type(const char * i_sText); // Type + + void On_afterName_Bracket_Left(const char * i_sText); + + void On_expectParameterSeparator_BracketRight(const char * i_sText); + void On_expectParameterSeparator_Comma(const char * i_sText); + + void On_afterParameters_const(const char * i_sText); + void On_afterParameters_volatile(const char * i_sText); + void On_afterParameters_throw(const char * i_sText); + void On_afterParameters_SwBracket_Left(const char * i_sText); + void On_afterParameters_Semicolon(const char * i_sText); + void On_afterParameters_Comma(const char * i_sText); + void On_afterParameters_Colon(const char * i_sText); + void On_afterParameters_Assign(const char * i_sText); + + void On_afterThrow_Bracket_Left(const char * i_sText); + + void On_expectExceptionSeparator_BracketRight(const char * i_sText); + void On_expectExceptionSeparator_Comma(const char * i_sText); + + void On_afterExceptions_SwBracket_Left(const char * i_sText); + void On_afterExceptions_Semicolon(const char * i_sText); + void On_afterExceptions_Comma(const char * i_sText); + void On_afterExceptions_Colon(const char * i_sText); + void On_afterExceptions_Assign(const char * i_sText); + + void On_expectZero_Constant(const char * i_sText); + + void On_inImplementation_SwBracket_Left(const char * i_sText); + void On_inImplementation_SwBracket_Right(const char * i_sText); + void On_inImplementation_Default(const char * i_sText); + + void PerformFinishingPunctuation(); + void EnterImplementation( + intt i_nBracketCountStart ); /// 1 normally, 0 in initialisation section of c'tors. + + // DATA + Dyn< PeStatusArray<PE_Function> > + pStati; + + Dyn< SP_Parameter > pSpParameter; + Dyn< SPU_Parameter> pSpuParameter; + Dyn< SP_Type > pSpType; + Dyn< SPU_Type > pSpuException; + Dyn< SPU_Type > pSpuCastOperatorType; // in "operator int()" or "operator ThatClass *()" + + ary::Cid nResult; + bool bResult_WithImplementation; // Necessary for the parent ParseEnvironment + // to know, there is no semicolon or comma following. + // Pre results + StreamStr aName; + E_Virtuality eVirtuality; + E_ConVol eConVol; + ary::cpp::FunctionFlags + aFlags; + ary::Tid nReturnType; + ParameterList aParameters; + ExceptionTypeList aExceptions; + bool bThrow; // Indicates, if there is a throw - important, if there are 0 exceptions listed. + intt nBracketCounterInImplementation; +}; + + + +// IMPLEMENTATION + + +inline bool +PE_Function::Result_WithImplementation() const + { return bResult_WithImplementation; } + + +} // namespace cpp + + + + +#endif + + +/* // Overview of Stati + +Undecided +--------- + +start // vor und whrend storage class specifiern + +->Typ + +expectName // Typ ist da + +afterName + + + + +Variable +-------- + +start // vor und whrend storage class specifiern + +->Typ + +expectName // Typ ist da -> im Falle von '(': notyetimplemented +afterName + +expectSize // after [ +expectFinish + // vor ; oder , +expectNextVarName // anders als bei expectName kann hier auch * oder & kommen + + + + + +Function +-------- + +start // vor und whrend storage class specifiern + +->Typ + +expectName // Typ ist da +expectBracket // Nach Name +expectParameter // nach ( oder , +-> Parameter +after Parameters // before const, volatile throw or = 0. +after throw // expect ( +expectException // after ( +after exceptions // = 0 oder ; oder , + + +expectNextVarName // anders als bei expectName kann hier auch * oder & kommen + + + + + + + +*/ diff --git a/autodoc/source/parser/cpp/pe_ignor.cxx b/autodoc/source/parser/cpp/pe_ignor.cxx new file mode 100644 index 000000000000..6ff31c55f736 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_ignor.cxx @@ -0,0 +1,150 @@ +/************************************************************************* + * + * $RCSfile: pe_ignor.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "pe_ignor.hxx" + + +// NOT FULLY DECLARED SERVICES + + +namespace cpp { + + + +PE_Ignore::PE_Ignore( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + nBracketCounter(0), + bBlockOpened(false) +{ + Setup_StatusFunctions(); +} + + +PE_Ignore::~PE_Ignore() +{ +} + +void +PE_Ignore::Call_Handler( const cpp::Token & i_rTok ) +{ + if ( NOT bBlockOpened ) + { + switch (i_rTok.TypeId()) + { + case Tid_SwBracket_Left: SetTokenResult(done, stay); + nBracketCounter++; + bBlockOpened = true; + break; + case Tid_Semicolon: SetTokenResult(done, pop_success); + break; + default: + SetTokenResult(done, stay); + } // end switch + } + else if ( nBracketCounter > 0 ) + { + SetTokenResult(done, stay); + + switch (i_rTok.TypeId()) + { + case Tid_SwBracket_Left: nBracketCounter++; + break; + case Tid_SwBracket_Right: nBracketCounter--; + break; + } // end switch + } + else if ( i_rTok.TypeId() == Tid_Semicolon ) + { + SetTokenResult(done, pop_success); + } + else + { + SetTokenResult(not_done, pop_success); + } +} + +void +PE_Ignore::Setup_StatusFunctions() +{ + // Does nothing. +} + +void +PE_Ignore::InitData() +{ + nBracketCounter = 0; + bBlockOpened = false; +} + +void +PE_Ignore::TransferData() +{ + // Does nothing. +} + + +} // namespace cpp + + + + + diff --git a/autodoc/source/parser/cpp/pe_ignor.hxx b/autodoc/source/parser/cpp/pe_ignor.hxx new file mode 100644 index 000000000000..e7150ad12274 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_ignor.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * $RCSfile: pe_ignor.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef ADC_CPP_PE_IGNOR_HXX +#define ADC_CPP_PE_IGNOR_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <cpp_pe.hxx> + // COMPONENTS + // PARAMETERS + + +namespace cpp { + + +class PE_Ignore : public Cpp_PE +{ + public: + PE_Ignore( + Cpp_PE * i_pParent ); + ~PE_Ignore(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + private: + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + + // DATA + uintt nBracketCounter; + bool bBlockOpened; +}; + + + +// IMPLEMENTATION + + +} // namespace cpp + + + + +#endif + + diff --git a/autodoc/source/parser/cpp/pe_namsp.cxx b/autodoc/source/parser/cpp/pe_namsp.cxx new file mode 100644 index 000000000000..27beb26d3a2b --- /dev/null +++ b/autodoc/source/parser/cpp/pe_namsp.cxx @@ -0,0 +1,173 @@ +/************************************************************************* + * + * $RCSfile: pe_namsp.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <pe_namsp.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <all_toks.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_rwgate.hxx> +#include <semantic/callf.hxx> + + +namespace cpp { + +PE_Namespace::PE_Namespace( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Namespace> ), + // sLocalname + bPush(false) +{ + Setup_StatusFunctions(); +} + +PE_Namespace::~PE_Namespace() +{ +} + +void +PE_Namespace::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Namespace>::F_Tok F_Tok; + static F_Tok stateF_start[] = { On_start_Identifier }; + static INT16 stateT_start[] = { Tid_Identifier }; + static F_Tok stateF_gotName[] = { On_gotName_SwBracket_Left, + On_gotName_Assign }; + static INT16 stateT_gotName[] = { Tid_SwBracket_Left, + Tid_Assign }; + static F_Tok stateF_expectSemicolon[] = { On_expectSemicolon_Semicolon }; + static INT16 stateT_expectSemicolon[] = { Tid_Semicolon }; + + SEMPARSE_CREATE_STATUS(PE_Namespace, start, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Namespace, gotName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Namespace, expectSemicolon, Hdl_SyntaxError); +} + +void +PE_Namespace::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Namespace::InitData() +{ + pStati->SetCur(start); + sLocalName = ""; + bPush = false; +} + +void +PE_Namespace::TransferData() +{ + if (bPush) + { + ary::cpp::Namespace & rNew + = Env().AryGate().CheckIn_Namespace( Env().Context(), sLocalName ); + Env().OpenNamespace(rNew); + } +} + +void +PE_Namespace::Hdl_SyntaxError( const char *) +{ + csv_assert(false); +} + +void +PE_Namespace::On_start_Identifier(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(gotName); + + sLocalName = i_sText; +} + +void +PE_Namespace::On_gotName_SwBracket_Left(const char * ) +{ + SetTokenResult(done, pop_success); + pStati->SetCur(size_of_states); + + bPush = true; +} + +void +PE_Namespace::On_gotName_Assign(const char * ) +{ + // KORR + Hdl_SyntaxError(0); +} + +void +PE_Namespace::On_expectSemicolon_Semicolon(const char * ) +{ + SetTokenResult(done,pop_success); + pStati->SetCur(size_of_states); +} + +} // namespace cpp + + + + diff --git a/autodoc/source/parser/cpp/pe_namsp.hxx b/autodoc/source/parser/cpp/pe_namsp.hxx new file mode 100644 index 000000000000..32415fe467c6 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_namsp.hxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * $RCSfile: pe_namsp.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_PE_NAMSP_HXX +#define ADC_CPP_PE_NAMSP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_pe.hxx> + // PARAMETERS + +namespace ary +{ +namespace cpp +{ +class Namespace; +} +} + + +namespace cpp +{ + + +class PE_Namespace : public Cpp_PE +{ + public: + enum E_State + { + start, + gotName, + expectSemicolon, /// after namespace assignment + size_of_states + }; + PE_Namespace( + Cpp_PE * i_pParent ); + ~PE_Namespace(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + ary::cpp::Namespace * + Result_OpenedNamespace() const; + private: + void Setup_StatusFunctions(); + + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void On_start_Identifier(const char * i_sText); + void On_gotName_SwBracket_Left(const char * i_sText); + void On_gotName_Assign(const char * i_sText); + void On_expectSemicolon_Semicolon(const char * i_sText); + + // DATA + Dyn< PeStatusArray<PE_Namespace> > + pStati; + + udmstri sLocalName; + bool bPush; +}; + + + +// IMPLEMENTATION + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/pe_param.cxx b/autodoc/source/parser/cpp/pe_param.cxx new file mode 100644 index 000000000000..0fdc17fbcbfb --- /dev/null +++ b/autodoc/source/parser/cpp/pe_param.cxx @@ -0,0 +1,313 @@ +/************************************************************************* + * + * $RCSfile: pe_param.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include "pe_param.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/template/tpltools.hxx> +#include <ary/cpp/c_rwgate.hxx> +#include "pe_type.hxx" +#include "pe_vari.hxx" + + +namespace cpp { + + + +//*********************** PE_Parameter ***********************// + + +PE_Parameter::PE_Parameter( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Parameter> ) + // pSpType, + // pSpuType, + // pSpVariable, + // pSpuVariable, + // aResultParamInfo +{ + Setup_StatusFunctions(); + + pSpType = new SP_Type(*this); + pSpuType = new SPU_Type(*pSpType, &PE_Parameter::SpInit_Type, &PE_Parameter::SpReturn_Type); + pSpVariable = new SP_Variable(*this); + pSpuVariable = new SPU_Variable(*pSpVariable, &PE_Parameter::SpInit_Variable, &PE_Parameter::SpReturn_Variable); +} + +PE_Parameter::~PE_Parameter() +{ +} + +void +PE_Parameter::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Parameter::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Parameter>::F_Tok F_Tok; + static F_Tok stateF_start[] = { On_start_Type, + On_start_Type, + On_start_Type, + On_start_Type, + On_start_Type, + On_start_Type, + On_start_Type, + On_start_Bracket_Right, + On_start_Type, + On_start_Ellipse, + On_start_Type, + On_start_Type }; + static INT16 stateT_start[] = { Tid_Identifier, + Tid_class, + Tid_struct, + Tid_union, + Tid_enum, + Tid_const, + Tid_volatile, + Tid_Bracket_Right, + Tid_DoubleColon, + Tid_Ellipse, + Tid_BuiltInType, + Tid_TypeSpecializer }; + static F_Tok stateF_expectName[] = { On_expectName_Identifier, + On_expectName_ArrayBracket_Left, + On_expectName_Bracket_Right, + On_expectName_Comma, + On_afterName_Assign }; + static INT16 stateT_expectName[] = { Tid_Identifier, + Tid_ArrayBracket_Left, + Tid_Bracket_Right, + Tid_Comma, + Tid_Assign }; + static F_Tok stateF_afterName[] = { On_afterName_ArrayBracket_Left, + On_afterName_Bracket_Right, + On_afterName_Comma, + On_afterName_Assign }; + static INT16 stateT_afterName[] = { Tid_ArrayBracket_Left, + Tid_Bracket_Right, + Tid_Comma, + Tid_Assign }; + static F_Tok stateF_finished[] = { On_finished_Comma, + On_finished_Bracket_Right }; + static INT16 stateT_finished[] = { Tid_Bracket_Right, + Tid_Comma }; + + SEMPARSE_CREATE_STATUS(PE_Parameter, start, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Parameter, expectName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Parameter, afterName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Parameter, finished, Hdl_SyntaxError); +} + + +void +PE_Parameter::InitData() +{ + pStati->SetCur(start); + aResultParamInfo.Empty(); +} + +void +PE_Parameter::TransferData() +{ + pStati->SetCur(size_of_states); +} + +void +PE_Parameter::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Parameter::SpInit_Type() +{ + // Does nothing. +} + +void +PE_Parameter::SpInit_Variable() +{ + // Does nothing. +} + +void +PE_Parameter::SpReturn_Type() +{ + aResultParamInfo.nType = pSpuType->Child().Result_Type().Id(); + pStati->SetCur(expectName); +} + +void +PE_Parameter::SpReturn_Variable() +{ + if (pSpuVariable->Child().Result_Pattern() > 0) + { + aResultParamInfo.sSizeExpression = pSpuVariable->Child().Result_SizeExpression(); + aResultParamInfo.sInitExpression = pSpuVariable->Child().Result_InitExpression(); + } +} + +void +PE_Parameter::On_start_Type(const char * i_sText) +{ + pSpuType->Push(not_done); +} + +void +PE_Parameter::On_start_Bracket_Right(const char * i_sText) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Parameter::On_start_Ellipse(const char * i_sText) +{ + SetTokenResult(done, pop_success); + + aResultParamInfo.nType = Env().AryGate().Tid_Ellipse(); +} + +void +PE_Parameter::On_expectName_Identifier(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterName); + + aResultParamInfo.sName = i_sText; +} + +void +PE_Parameter::On_expectName_ArrayBracket_Left(const char * i_sText) +{ + On_afterName_ArrayBracket_Left(i_sText); +} + +void +PE_Parameter::On_expectName_Bracket_Right(const char * i_sText) +{ + On_afterName_Bracket_Right(i_sText); +} + +void +PE_Parameter::On_expectName_Comma(const char * i_sText) +{ + On_afterName_Comma(i_sText); +} + +void +PE_Parameter::On_expectName_Assign(const char * i_sText) +{ + On_afterName_Assign(i_sText); +} + +void +PE_Parameter::On_afterName_ArrayBracket_Left(const char * i_sText) +{ + pSpuVariable->Push(not_done); +} + +void +PE_Parameter::On_afterName_Bracket_Right(const char * i_sText) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Parameter::On_afterName_Comma(const char * i_sText) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Parameter::On_afterName_Assign(const char * i_sText) +{ + pSpuVariable->Push(not_done); +} + +void +PE_Parameter::On_finished_Bracket_Right(const char * i_sText) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Parameter::On_finished_Comma(const char * i_sText) +{ + SetTokenResult(not_done, pop_success); +} + + +} // namespace cpp + + + + + + + + + diff --git a/autodoc/source/parser/cpp/pe_param.hxx b/autodoc/source/parser/cpp/pe_param.hxx new file mode 100644 index 000000000000..570b2eb72de1 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_param.hxx @@ -0,0 +1,174 @@ +/************************************************************************* + * + * $RCSfile: pe_param.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef ADC_CPP_PE_PARAM_HXX +#define ADC_CPP_PE_PARAM_HXX + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS +#include <ary/cpp/c_vfflag.hxx> + + +namespace cpp { + +class PE_Type; +class PE_Variable; + + +class PE_Parameter : public Cpp_PE +{ + public: + enum E_State + { + start, + expectName, + afterName, + finished, + size_of_states + }; + typedef ary::cpp::S_Parameter S_ParamInfo; + + PE_Parameter( + Cpp_PE * i_pParent ); + ~PE_Parameter(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + ary::Tid Result_FrontType() const; + const S_ParamInfo & + Result_ParamInfo() const; + + private: + typedef SubPe< PE_Parameter, PE_Type > SP_Type; + typedef SubPeUse< PE_Parameter, PE_Type > SPU_Type; + typedef SubPe< PE_Parameter, PE_Variable > SP_Variable; + typedef SubPeUse< PE_Parameter, PE_Variable > SPU_Variable; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void SpInit_Type(); // Type and Ignore. + void SpInit_Variable(); + void SpReturn_Type(); + void SpReturn_Variable(); + + void On_start_Type(const char * i_sText); + void On_start_Bracket_Right(const char * i_sText); + void On_start_Ellipse(const char * i_sText); + + void On_expectName_Identifier(const char * i_sText); + void On_expectName_ArrayBracket_Left(const char * i_sText); + void On_expectName_Bracket_Right(const char * i_sText); + void On_expectName_Comma(const char * i_sText); + void On_expectName_Assign(const char * i_sText); + + void On_afterName_ArrayBracket_Left(const char * i_sText); + void On_afterName_Bracket_Right(const char * i_sText); + void On_afterName_Comma(const char * i_sText); + void On_afterName_Assign(const char * i_sText); + + void On_finished_Bracket_Right(const char * i_sText); + void On_finished_Comma(const char * i_sText); + + // DATA + Dyn< PeStatusArray<PE_Parameter> > + pStati; + + Dyn<SP_Type> pSpType; + Dyn<SPU_Type> pSpuType; + Dyn<SP_Variable> pSpVariable; + Dyn<SPU_Variable> pSpuVariable; + + S_ParamInfo aResultParamInfo; +}; + + + +// IMPLEMENTATION + +inline ary::Tid +PE_Parameter::Result_FrontType() const + { return aResultParamInfo.nType; } +inline const PE_Parameter::S_ParamInfo & +PE_Parameter::Result_ParamInfo() const + { return aResultParamInfo; } + + + +} // namespace cpp + + + + +#endif + + + diff --git a/autodoc/source/parser/cpp/pe_tpltp.cxx b/autodoc/source/parser/cpp/pe_tpltp.cxx new file mode 100644 index 000000000000..33c40c50132a --- /dev/null +++ b/autodoc/source/parser/cpp/pe_tpltp.cxx @@ -0,0 +1,203 @@ +/************************************************************************* + * + * $RCSfile: pe_tpltp.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "pe_tpltp.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <cosv/template/tpltools.hxx> + + + +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; + + static F_Tok stateF_start[] = { On_start_Less }; + static INT16 stateT_start[] = { Tid_Less }; + + // KORR_FUTURE : add "typename". + static F_Tok stateF_expect_qualifier[]= { On_expect_qualifier_class }; + static INT16 stateT_expect_qualifier[]= { Tid_class }; + + static F_Tok stateF_expect_name[] = { On_expect_name_Identifier }; + static INT16 stateT_expect_name[] = { Tid_Identifier }; + + static F_Tok stateF_expect_separator[]= { On_expect_separator_Comma, + On_expect_separator_Greater }; + 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 +PE_TemplateTop::On_expect_qualifier_class( const char *) +{ + SetTokenResult(done, stay); + pStati->SetCur(expect_name); +} + +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); + + if ( NOT bCurIsConstant ) + { + udmstri sText( StreamLock(50)() << "typename " << i_sText << c_str ); + aResult_Parameters.push_back(sText); + } + else // + { + udmstri sText( StreamLock(50)() << "constant " << i_sText << c_str ); + 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); +} + + +} // namespace cpp + + + + + + diff --git a/autodoc/source/parser/cpp/pe_tpltp.hxx b/autodoc/source/parser/cpp/pe_tpltp.hxx new file mode 100644 index 000000000000..8759cc2a35b7 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_tpltp.hxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * $RCSfile: pe_tpltp.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_PE_TPLTP_HXX +#define ADC_CPP_PE_TPLTP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS + + +namespace cpp { + + + +class PE_TemplateTop : public cpp::Cpp_PE +{ + public: + enum E_State + { + start, + expect_qualifier, + expect_name, + expect_separator, + size_of_states + }; + PE_TemplateTop( + Cpp_PE * i_pParent ); + ~PE_TemplateTop(); + + const StringVector & + Result_Parameters() const; + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + private: + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError(const char *); + + + void On_start_Less(const char *); + + void On_expect_qualifier_class(const char *); + void On_expect_qualifier_Other(const char *); + + void On_expect_name_Identifier(const char *); + + void On_expect_separator_Comma(const char *); + void On_expect_separator_Greater(const char *); + + // DATA + Dyn< PeStatusArray<PE_TemplateTop> > + pStati; + + StringVector + aResult_Parameters; + bool bCurIsConstant; +}; + + + +// IMPLEMENTATION + +inline const StringVector & +PE_TemplateTop::Result_Parameters() const + { return aResult_Parameters; } + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/pe_tydef.cxx b/autodoc/source/parser/cpp/pe_tydef.cxx new file mode 100644 index 000000000000..e51473204471 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_tydef.cxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * $RCSfile: pe_tydef.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "pe_tydef.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <ary/cpp/c_rwgate.hxx> +#include <ary/cpp/ca_type.hxx> +#include <all_toks.hxx> +#include "pe_type.hxx" + + +namespace cpp { + + +PE_Typedef::PE_Typedef(Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Typedef> ), + // pSpType, + // pSpuType, + // sName + nType(0) +{ + Setup_StatusFunctions(); + + pSpType = new SP_Type(*this); + pSpuType = new SPU_Type(*pSpType, 0, &PE_Typedef::SpReturn_Type); +} + +PE_Typedef::~PE_Typedef() +{ +} + +void +PE_Typedef::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Typedef::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Typedef>::F_Tok F_Tok; + static F_Tok stateF_start[] = { On_start_typedef }; + static INT16 stateT_start[] = { Tid_typedef }; + + static F_Tok stateF_expectName[] = { On_expectName_Identifier }; + static INT16 stateT_expectName[] = { Tid_Identifier }; + + static F_Tok stateF_afterName[] = { On_afterName_Semicolon }; + static INT16 stateT_afterName[] = { Tid_Semicolon }; + + SEMPARSE_CREATE_STATUS(PE_Typedef, start, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Typedef, expectName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Typedef, afterName, Hdl_SyntaxError); +} + +void +PE_Typedef::InitData() +{ + pStati->SetCur(start); + + sName.clear(); + nType = 0; +} + +void +PE_Typedef::TransferData() +{ + pStati->SetCur(size_of_states); + + ary::cpp::Typedef & + rTypedef = Env().AryGate().Store_Typedef( + Env().Context(), sName, nType ); + Env().Event_Store_Typedef(rTypedef); +} + +void +PE_Typedef::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Typedef::SpReturn_Type() +{ + pStati->SetCur(expectName); + + nType = pSpuType->Child().Result_Type().Id(); +} + +void +PE_Typedef::On_start_typedef( const char * ) +{ + pSpuType->Push(done); +} + +void +PE_Typedef::On_expectName_Identifier( const char * i_sText ) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterName); + + sName = i_sText; +} + +void +PE_Typedef::On_afterName_Semicolon( const char * ) +{ + SetTokenResult(done, pop_success); +} + +} // namespace cpp + + + diff --git a/autodoc/source/parser/cpp/pe_tydef.hxx b/autodoc/source/parser/cpp/pe_tydef.hxx new file mode 100644 index 000000000000..065eb1d0f2ac --- /dev/null +++ b/autodoc/source/parser/cpp/pe_tydef.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * $RCSfile: pe_tydef.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_PE_TYDEF_HXX +#define ADC_CPP_PE_TYDEF_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS + + +namespace cpp { + +class PE_Type; + + +class PE_Typedef : public cpp::Cpp_PE +{ + public: + enum E_State + { + start, + expectName, + afterName, + size_of_states + }; + PE_Typedef( + Cpp_PE * i_pParent ); + ~PE_Typedef(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + private: + typedef SubPe< PE_Typedef, PE_Type > SP_Type; + typedef SubPeUse< PE_Typedef, PE_Type> SPU_Type; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void SpReturn_Type(); + + void On_start_typedef( const char * ); + void On_expectName_Identifier( const char * ); + void On_afterName_Semicolon( const char * ); + + // DATA + Dyn< PeStatusArray<PE_Typedef> > + pStati; + Dyn<SP_Type> pSpType; + Dyn<SPU_Type> pSpuType; + + udmstri sName; + ary::Tid nType; +}; + + + +// IMPLEMENTATION + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/pe_type.cxx b/autodoc/source/parser/cpp/pe_type.cxx new file mode 100644 index 000000000000..dfc4f10698db --- /dev/null +++ b/autodoc/source/parser/cpp/pe_type.cxx @@ -0,0 +1,521 @@ +/************************************************************************* + * + * $RCSfile: pe_type.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include "pe_type.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/inpcontx.hxx> +#include <ary/cpp/c_rwgate.hxx> +#include <ary/cpp/c_class.hxx> +#include "pe_class.hxx" +#include "pe_enum.hxx" +#include <x_parse.hxx> + + +namespace cpp { + + +inline bool +PE_Type::IsType() const + { return eResult_KindOf == is_type; } + + +PE_Type::PE_Type( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Type> ), + pSpType(0), + pSpuType_TemplateParameter(0), + // pSpClass, + // pSpuClass, + // pSpEnum, + // pSpuEnum, + pType(0), + pCurTemplate_ParameterList(0), + // sOwningClassName, + // sParsedClass_Name, + pResult_Type(0), + eResult_KindOf(is_none), + bIsCastOperatorType(false) +{ + Setup_StatusFunctions(); + + pSpType = new SP_Type(*this); + pSpClass = new SP_Class(*this); + pSpEnum = new SP_Enum(*this); + + pSpuType_TemplateParameter + = new SPU_Type( *pSpType, 0, + &PE_Type::SpReturn_Type_TemplateParameter ); + pSpuClass = new SPU_Class( *pSpClass, 0, + & PE_Type::SpReturn_Class ); + pSpuEnum = new SPU_Enum( *pSpEnum, 0, + & PE_Type::SpReturn_Enum ); +} + +PE_Type::~PE_Type() +{ +} + +void +PE_Type::Init_AsCastOperatorType() +{ + bIsCastOperatorType = true; +} + +void +PE_Type::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Type::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Type>::F_Tok F_Tok; + static F_Tok stateF_start[] = { On_start_Identifier, + On_start_class, + On_start_class, + On_start_class, + On_start_enum, + On_start_const, + On_start_volatile, + On_start_Bracket_Right, + On_start_DoubleColon, + On_start_BuiltInType, + On_start_TypeSpecializer }; + static INT16 stateT_start[] = { Tid_Identifier, + Tid_class, + Tid_struct, + Tid_union, + Tid_enum, + Tid_const, + Tid_volatile, + Tid_Bracket_Right, + Tid_DoubleColon, + Tid_BuiltInType, + Tid_TypeSpecializer }; + + static F_Tok stateF_expect_namesegment[] = { On_expect_namesegment_Identifier, + On_expect_namesegment_Identifier }; + static INT16 stateT_expect_namesegment[] = { Tid_Identifier, + Tid_BuiltInType }; + + static F_Tok stateF_after_namesegment[] = { On_after_namesegment_const, + On_after_namesegment_volatile, + On_after_namesegment_Bracket_Left, + On_after_namesegment_DoubleColon, + On_after_namesegment_Less, + On_after_namesegment_Asterix, + On_after_namesegment_AmpersAnd }; + static INT16 stateT_after_namesegment[] = { Tid_const, + Tid_volatile, + Tid_Bracket_Left, + Tid_DoubleColon, + Tid_Less, + Tid_Asterix, + Tid_AmpersAnd }; + + static F_Tok stateF_afterclass_expect_semicolon[] = + { On_afterclass_expect_semicolon_Semicolon }; + static INT16 stateT_afterclass_expect_semicolon[] = + { Tid_Semicolon }; + + static F_Tok stateF_within_template[] = { On_within_template_Comma, + On_within_template_Greater, + On_within_template_Constant }; + static INT16 stateT_within_template[] = { Tid_Comma, + Tid_Greater, + Tid_Constant }; + + static F_Tok stateF_within_indirection[] = { On_within_indirection_const, + On_within_indirection_volatile, + On_within_indirection_Asterix, + On_within_indirection_AmpersAnd }; + static INT16 stateT_within_indirection[] = { Tid_const, + Tid_volatile, + Tid_Asterix, + Tid_AmpersAnd }; + + SEMPARSE_CREATE_STATUS(PE_Type, start, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Type, expect_namesegment, On_EndOfType); + SEMPARSE_CREATE_STATUS(PE_Type, after_namesegment, On_EndOfType); + SEMPARSE_CREATE_STATUS(PE_Type, afterclass_expect_semicolon, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Type, within_template, On_within_template_TypeStart); + SEMPARSE_CREATE_STATUS(PE_Type, within_indirection, On_EndOfType); +} + +void +PE_Type::InitData() +{ + pStati->SetCur(start); + + pType = new ary::cpp::UsedType; + pCurTemplate_ParameterList = 0; + sOwningClassName + = Env().Context().CurClass() != 0 + ? Env().Context().CurClass()->LocalName().c_str() + : ""; + sParsedClass_Name.clear(); + pResult_Type = 0; + eResult_KindOf = is_type; + bIsCastOperatorType = false; +} + +void +PE_Type::TransferData() +{ + pStati->SetCur(size_of_states); + + if ( IsType() ) + pResult_Type = & Env().AryGate().CheckIn_UsedType( Env().Context(), * pType.Release() ); + else + pResult_Type = new ary::cpp::NullType; +} + +void +PE_Type::Hdl_SyntaxError( const char * i_sText ) +{ + StdHandlingOfSyntaxError( i_sText ); +} + +void +PE_Type::SpReturn_Type_TemplateParameter() +{ + if ( pSpuType_TemplateParameter->Child().Result_KindOf() != is_type ) + throw X_Parser(X_Parser::x_UnspecifiedSyntaxError, "", udmstri::Null_(), 0); + + pCurTemplate_ParameterList->AddParam_Type( + pSpuType_TemplateParameter->Child().Result_Type().Id() ); +} + +void +PE_Type::SpReturn_Class() +{ + switch ( pSpuClass->Child().Result_KindOf() ) + { + case PE_Class::is_declaration: + pStati->SetCur(afterclass_expect_semicolon); + eResult_KindOf = is_explicit_class_declaration; + break; + case PE_Class::is_implicit_declaration: + pStati->SetCur(after_namesegment); + pType->Add_NameSegment( + pSpuClass->Child().Result_LocalName() ); + break; + case PE_Class::is_predeclaration: + pStati->SetCur(afterclass_expect_semicolon); + eResult_KindOf = is_class_predeclaration; + break; + case PE_Class::is_qualified_typename: + pStati->SetCur(after_namesegment); + pType->Add_NameSegment( + pSpuClass->Child().Result_FirstNameSegment() ); + break; + default: + csv_assert(false); + } +} + +void +PE_Type::SpReturn_Enum() +{ + switch ( pSpuEnum->Child().Result_KindOf() ) + { + case PE_Enum::is_declaration: + pStati->SetCur(afterclass_expect_semicolon); + eResult_KindOf = is_explicit_enum_declaration; + break; + case PE_Enum::is_implicit_declaration: + pStati->SetCur(after_namesegment); + pType->Add_NameSegment( + pSpuEnum->Child().Result_LocalName() ); + break; + case PE_Enum::is_qualified_typename: + pStati->SetCur(after_namesegment); + pType->Add_NameSegment( + pSpuEnum->Child().Result_FirstNameSegment() ); + break; + default: + csv_assert(false); + } +} + +void +PE_Type::On_EndOfType(const char *) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Type::On_start_Identifier( const char * i_sText ) +{ + SetTokenResult(done,stay); + pStati->SetCur(after_namesegment); + + pType->Add_NameSegment(i_sText); +} + +void +PE_Type::On_start_class(const char *) +{ + pSpuClass->Push(not_done); +} + +void +PE_Type::On_start_enum(const char *) +{ + pSpuEnum->Push(done); +} + +void +PE_Type::On_start_const(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Const(); +} + +void +PE_Type::On_start_volatile(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Volatile(); +} + +void +PE_Type::On_start_Bracket_Right(const char *) +{ + SetTokenResult(not_done,pop_success); + + eResult_KindOf = is_none; +} + +void +PE_Type::On_start_DoubleColon(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Absolute(); +} + +void +PE_Type::On_start_BuiltInType(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(after_namesegment); + pType->Set_BuiltIn(i_sText); +} + +void +PE_Type::On_start_TypeSpecializer(const char * i_sText) +{ + SetTokenResult(done,stay); + if (*i_sText == 'u') + pType->Set_Unsigned(); + else if (*i_sText == 's') + pType->Set_Signed(); + else + csv_assert(false); +} + +void +PE_Type::On_expect_namesegment_Identifier(const char * i_sText) +{ + SetTokenResult(done,stay); + pStati->SetCur(after_namesegment); + pType->Add_NameSegment(i_sText); +} + +void +PE_Type::On_after_namesegment_const(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Const(); +} + +void +PE_Type::On_after_namesegment_volatile(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Volatile(); +} + +void +PE_Type::On_after_namesegment_Bracket_Left(const char * i_sText) +{ + if ( bIsCastOperatorType ) + { + SetTokenResult(not_done, pop_success); + } + else if ( pType->LocalName() == sOwningClassName ) + { + SetTokenResult(not_done,pop_success); + eResult_KindOf = is_constructor; + + } + else // + { + On_EndOfType(i_sText); + } // endif +} + +void +PE_Type::On_after_namesegment_DoubleColon(const char *) +{ + SetTokenResult(done,stay); + pStati->SetCur(expect_namesegment); +} + +void +PE_Type::On_after_namesegment_Less(const char *) +{ + SetTokenResult(done,stay); + pStati->SetCur(within_template); + + pCurTemplate_ParameterList = & pType->Enter_Template(); +} + +void +PE_Type::On_after_namesegment_Asterix(const char *) +{ + SetTokenResult(done,stay); + pStati->SetCur(within_indirection); + pType->Add_PtrLevel(); +} + +void +PE_Type::On_after_namesegment_AmpersAnd(const char *) +{ + SetTokenResult(done,pop_success); + pType->Set_Reference(); +} + +void +PE_Type::On_afterclass_expect_semicolon_Semicolon(const char *) +{ + csv_assert( NOT IsType() ); + SetTokenResult(not_done,pop_success); +} + +void +PE_Type::On_within_template_Comma(const char *) +{ + SetTokenResult(done,stay); +} + +void +PE_Type::On_within_template_Greater(const char *) +{ + SetTokenResult(done,stay); + pStati->SetCur(after_namesegment); + + pCurTemplate_ParameterList = 0; +} + +void +PE_Type::On_within_template_Constant(const char * i_sText) +{ + // KORR_FUTURE + Cerr() << "Templates with constants as parameters are not yet supported by Autodoc" << Endl(); + Hdl_SyntaxError(i_sText); +} + +void +PE_Type::On_within_template_TypeStart(const char *) +{ + pSpuType_TemplateParameter->Push(not_done); +} + +void +PE_Type::On_within_indirection_const(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Const(); +} + +void +PE_Type::On_within_indirection_volatile(const char *) +{ + SetTokenResult(done,stay); + pType->Set_Volatile(); +} + +void +PE_Type::On_within_indirection_Asterix(const char *) +{ + SetTokenResult(done,stay); + pType->Add_PtrLevel(); +} + +void +PE_Type::On_within_indirection_AmpersAnd(const char *) +{ + SetTokenResult(done,pop_success); + pType->Set_Reference(); +} + +} // namespace cpp + + + + + diff --git a/autodoc/source/parser/cpp/pe_type.hxx b/autodoc/source/parser/cpp/pe_type.hxx new file mode 100644 index 000000000000..9d922a537140 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_type.hxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * $RCSfile: pe_type.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef ADC_CPP_PE_TYPE_HXX +#define ADC_CPP_PE_TYPE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <ary/cpp/usedtype.hxx> +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> + // PARAMETERS +#include <ary/cpp/c_etypes.hxx> + + + +namespace cpp { + +class PE_Class; +class PE_Enum; +class PE_Expression; + +class PE_Type : public Cpp_PE +{ + public: + enum E_State + { + start, + expect_namesegment, + after_namesegment, + afterclass_expect_semicolon, + within_template, + within_indirection, + size_of_states + }; + enum E_KindOfResult + { + is_none, + is_type, + is_constructor, + is_explicit_class_declaration, + is_class_predeclaration, + is_explicit_enum_declaration + }; + + PE_Type( + Cpp_PE * i_pParent ); + ~PE_Type(); + + void Init_AsCastOperatorType(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + E_KindOfResult Result_KindOf() const; + const ary::cpp::Type & + Result_Type() const; + private: + typedef SubPe< PE_Type, PE_Type > SP_Type; + typedef SubPe< PE_Type, PE_Class > SP_Class; + typedef SubPe< PE_Type, PE_Enum > SP_Enum; + typedef SubPeUse< PE_Type, PE_Type > SPU_Type; + typedef SubPeUse< PE_Type, PE_Class > SPU_Class; + typedef SubPeUse< PE_Type, PE_Enum > SPU_Enum; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError( const char *); + + void SpReturn_Type_TemplateParameter(); + void SpReturn_Class(); + void SpReturn_Enum(); + + void On_EndOfType(const char *); + + void On_start_Identifier(const char *); + void On_start_class(const char *); + void On_start_enum(const char *); + void On_start_const(const char *); + void On_start_volatile(const char *); + void On_start_Bracket_Right(const char *); + void On_start_DoubleColon(const char *); + void On_start_BuiltInType(const char *); + void On_start_TypeSpecializer(const char *); + + void On_expect_namesegment_Identifier(const char *); + + void On_after_namesegment_const(const char *); + void On_after_namesegment_volatile(const char *); + void On_after_namesegment_Bracket_Left(const char *); + void On_after_namesegment_DoubleColon(const char *); + void On_after_namesegment_Less(const char *); + void On_after_namesegment_Asterix(const char *); + void On_after_namesegment_AmpersAnd(const char *); + + void On_afterclass_expect_semicolon_Semicolon(const char *); + + void On_within_template_Comma(const char *); + void On_within_template_Greater(const char *); + void On_within_template_Constant(const char *); + void On_within_template_TypeStart(const char *); + + void On_within_indirection_const(const char *); + void On_within_indirection_volatile(const char *); + void On_within_indirection_Asterix(const char *); + void On_within_indirection_AmpersAnd(const char *); + + bool IsType() const; + + // DATA + Dyn< PeStatusArray<PE_Type> > + pStati; + + Dyn<SP_Type> pSpType; + Dyn<SPU_Type> pSpuType_TemplateParameter; + Dyn<SP_Class> pSpClass; + Dyn<SPU_Class> pSpuClass; + Dyn<SP_Enum> pSpEnum; + Dyn<SPU_Enum> pSpuEnum; + + Dyn<ary::cpp::UsedType> + pType; + ary::cpp::ut::List_TplParameter * + pCurTemplate_ParameterList; + udmstri sOwningClassName; + udmstri sParsedClass_Name; + + const ary::cpp::Type * + pResult_Type; + E_KindOfResult eResult_KindOf; + bool bIsCastOperatorType; +}; + + + +// IMPLEMENTATION + + +inline const ary::cpp::Type & +PE_Type::Result_Type() const + { csv_assert(pResult_Type != 0); + return *pResult_Type; } +inline PE_Type::E_KindOfResult +PE_Type::Result_KindOf() const + { return eResult_KindOf; } + + +} // namespace cpp + + +#endif + + + diff --git a/autodoc/source/parser/cpp/pe_vafu.cxx b/autodoc/source/parser/cpp/pe_vafu.cxx new file mode 100644 index 000000000000..a0200abfeaf6 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_vafu.cxx @@ -0,0 +1,669 @@ +/************************************************************************* + * + * $RCSfile: pe_vafu.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include "pe_vafu.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/template/tpltools.hxx> +#include <ary/cpp/c_rwgate.hxx> +#include <ary/cpp/inpcontx.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/cpp/c_vfflag.hxx> +#include "pe_type.hxx" +#include "pe_vari.hxx" +#include "pe_funct.hxx" +#include "pe_ignor.hxx" +#include <x_parse.hxx> + + + + +namespace cpp { + + + +//*********************** PE_VarFunc ***********************// + + +PE_VarFunc::PE_VarFunc( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_VarFunc> ), + // pSpType, + // pSpuType, + // pSpVariable, + // pSpuVariable, + // pSpFunction, + // pSpuFunctionStd, + // pSpuFunctionCtor, + // pSpuFunctionDtor, + // pSpuFunctionCastOperator, + // pSpuFunctionNormalOperator + // pSpIgnore, + // pSpuIgnore, + nCounter_TemplateBrackets(0), + bInDestructor(false), + // aResultIds, + nResultFrontType(0), + eResultType(result_unknown), + bVirtual(false), + bStatic(false), + bExtern(false), + bExternC(false), + bMutable(false), + bInline(false), + bRegister(false), + bExplicit(false) +{ + Setup_StatusFunctions(); + + pSpType = new SP_Type(*this); + pSpuType = new SPU_Type(*pSpType, 0, &PE_VarFunc::SpReturn_Type); + pSpVariable = new SP_Variable(*this); + pSpuVariable = new SPU_Variable(*pSpVariable, 0, &PE_VarFunc::SpReturn_Variable); + pSpFunction = new SP_Function(*this); + pSpuFunctionStd = new SPU_Function(*pSpFunction, &PE_VarFunc::SpInit_FunctionStd, &PE_VarFunc::SpReturn_FunctionStd); + pSpuFunctionCtor = new SPU_Function(*pSpFunction, &PE_VarFunc::SpInit_FunctionCtor, &PE_VarFunc::SpReturn_FunctionStd); + pSpuFunctionDtor = new SPU_Function(*pSpFunction, &PE_VarFunc::SpInit_FunctionDtor, &PE_VarFunc::SpReturn_FunctionStd); + pSpuFunctionCastOperator + = new SPU_Function(*pSpFunction, &PE_VarFunc::SpInit_FunctionCastOperator, &PE_VarFunc::SpReturn_FunctionStd); + pSpuFunctionNormalOperator + = new SPU_Function(*pSpFunction, &PE_VarFunc::SpInit_FunctionNormalOperator, &PE_VarFunc::SpReturn_FunctionStd); + pSpIgnore = new SP_Ignore(*this); + pSpuIgnore = new SPU_Ignore(*pSpIgnore, 0, &PE_VarFunc::SpReturn_Ignore); +} + +PE_VarFunc::~PE_VarFunc() +{ +} + +void +PE_VarFunc::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_VarFunc::Setup_StatusFunctions() +{ + typedef CallFunction<PE_VarFunc>::F_Tok F_Tok; + + static F_Tok stateF_start[] = { On_start_Identifier, + On_start_operator, + On_start_TypeKey, + On_start_TypeKey, + On_start_TypeKey, + On_start_TypeKey, + On_start_virtual, + On_start_Tilde, + On_start_const, + On_start_volatile, + On_start_extern, + On_start_static, + On_start_mutable, + On_start_register, + On_start_inline, + On_start_explicit, + On_start_Bracket_Right, + On_start_Identifier, + On_start_Identifier, + On_start_Identifier }; + static INT16 stateT_start[] = { Tid_Identifier, + Tid_operator, + Tid_class, + Tid_struct, + Tid_union, + Tid_enum, + Tid_virtual, + Tid_Tilde, + Tid_const, + Tid_volatile, + Tid_extern, + Tid_static, + Tid_mutable, + Tid_register, + Tid_inline, + Tid_explicit, + Tid_Bracket_Right, + Tid_DoubleColon, + Tid_BuiltInType, + Tid_TypeSpecializer }; + + static F_Tok stateF_expectCtor[] = { On_expectCtor_Bracket_Left }; + static INT16 stateT_expectCtor[] = { Tid_Bracket_Left }; + + static F_Tok stateF_afterClassDecl[] = { On_afterClassDecl_Semicolon }; + static INT16 stateT_afterClassDecl[] = { Tid_Semicolon }; + + static F_Tok stateF_expectName[] = { On_expectName_Identifier, + On_expectName_operator, + On_expectName_Bracket_Left }; + static INT16 stateT_expectName[] = { Tid_Identifier, + Tid_operator, + Tid_Bracket_Left }; + + static F_Tok stateF_afterName[] = { On_afterName_ArrayBracket_Left, + On_afterName_Bracket_Left, + On_afterName_DoubleColon, + On_afterName_Semicolon, + On_afterName_Comma, + On_afterName_Assign, + On_afterName_Less }; + static INT16 stateT_afterName[] = { Tid_ArrayBracket_Left, + Tid_Bracket_Left, + Tid_DoubleColon, + Tid_Semicolon, + Tid_Comma, + Tid_Assign, + Tid_Less }; + + static F_Tok stateF_afterName_inErraneousTemplate[] = + { On_afterName_inErraneousTemplate_Less, + On_afterName_inErraneousTemplate_Greater }; + static INT16 stateT_afterName_inErraneousTemplate[] = + { Tid_Less, + Tid_Greater }; + + static F_Tok stateF_finished[] = { On_finished_Semicolon, + On_finished_Comma }; + static INT16 stateT_finished[] = { Tid_Semicolon, + Tid_Comma }; + + static F_Tok stateF_finishedIncludingFunctionImplementation[] = + { On_finishedIncludingFunctionImplementation_Default + }; + static INT16 stateT_finishedIncludingFunctionImplementation[] = + { Tid_BuiltInType // Just to have one entry, but it is default handled, too. + }; + + SEMPARSE_CREATE_STATUS(PE_VarFunc, start, Hdl_UnknownToken); + SEMPARSE_CREATE_STATUS(PE_VarFunc, expectCtor, Hdl_UnknownToken); + SEMPARSE_CREATE_STATUS(PE_VarFunc, afterClassDecl, Hdl_UnknownToken); + SEMPARSE_CREATE_STATUS(PE_VarFunc, expectName, Hdl_UnknownToken); + SEMPARSE_CREATE_STATUS(PE_VarFunc, afterName, Hdl_UnknownToken); + SEMPARSE_CREATE_STATUS(PE_VarFunc, afterName_inErraneousTemplate, On_afterName_inErraneousTemplate_Default); + SEMPARSE_CREATE_STATUS(PE_VarFunc, finished, On_finished_Default); + SEMPARSE_CREATE_STATUS(PE_VarFunc, finishedIncludingFunctionImplementation, On_finishedIncludingFunctionImplementation_Default); +} + +void +PE_VarFunc::InitData() +{ + pStati->SetCur(start); + csv::erase_container(aResultIds); + + nCounter_TemplateBrackets = 0; + bInDestructor = false; + + nResultFrontType = 0; + eResultType = result_unknown; + sName.clear(); + bVirtual = ary::cpp::VIRTUAL_none; + bStatic = false; + bExtern = false; + bExternC = false; + bMutable = false; + bInline = false; + bRegister = false; + bExplicit = false; +} + +void +PE_VarFunc::TransferData() +{ + pStati->SetCur(size_of_states); +} + +void +PE_VarFunc::Hdl_UnknownToken( const char *) +{ + pSpuIgnore->Push(not_done); +} + +void +PE_VarFunc::SpInit_FunctionStd() +{ + if ( nResultFrontType != 0 AND sName.length() > 0 ) + { + pSpuFunctionStd->Child().Init_Std( + sName, + nResultFrontType, + bVirtual, + CreateFunctionFlags() ); + } + else + { + throw X_Parser( X_Parser::x_UnexpectedToken, + "", + Env().CurFileName(), + Env().LineCount() ); + } +} + +void +PE_VarFunc::SpInit_FunctionCtor() +{ + ary::cpp::Class * pOwnerClass = Env().Context().CurClass(); + csv_assert( pOwnerClass != 0 ); + pSpuFunctionStd->Child().Init_Ctor( pOwnerClass->LocalName(), + CreateFunctionFlags() ); +} + +void +PE_VarFunc::SpInit_FunctionDtor() +{ + pSpuFunctionStd->Child().Init_Dtor( sName, + bVirtual, + CreateFunctionFlags() ); +} + +void +PE_VarFunc::SpInit_FunctionCastOperator() +{ + pSpuFunctionStd->Child().Init_CastOperator( bVirtual, + CreateFunctionFlags() ); +} + +void +PE_VarFunc::SpInit_FunctionNormalOperator() +{ + pSpuFunctionStd->Child().Init_NormalOperator( nResultFrontType, + bVirtual, + CreateFunctionFlags() ); +} + +void +PE_VarFunc::SpReturn_Type() +{ + switch ( pSpuType->Child().Result_KindOf() ) + { + case PE_Type::is_type: + pStati->SetCur(expectName); + nResultFrontType + = pSpuType->Child().Result_Type().Id(); + break; + case PE_Type::is_constructor: + pStati->SetCur(expectCtor); + eResultType = result_function; + break; + case PE_Type::is_explicit_class_declaration: + case PE_Type::is_explicit_enum_declaration: + pStati->SetCur(afterClassDecl); + eResultType = result_ignore; + break; + case PE_Type::is_class_predeclaration: + pStati->SetCur(afterClassDecl); + eResultType = result_ignore; + break; + } +} + +void +PE_VarFunc::SpReturn_Variable() +{ + typedef ary::cpp::VariableFlags VarFlags; + + if ( NOT bExtern ) + { + VarFlags aFlags( UINT16(0) + | ( bStatic AND Env().Context().CurClass() == 0 ? VarFlags::f_static_local : 0 ) + | ( bStatic AND Env().Context().CurClass() != 0 ? VarFlags::f_static_member : 0 ) + | ( bMutable ? VarFlags::f_mutable : 0 ) + ); + +// ary::S_InitData aData( 0, Env().CurCeSpace().Id(), i_sName, 0 ); + ary::cpp::Variable & rCurParsedVariable + = Env().AryGate().Store_Variable( Env().Context(), + sName, + nResultFrontType, + aFlags, + pSpuVariable->Child().Result_SizeExpression(), + pSpuVariable->Child().Result_InitExpression() ); + Env().Event_Store_Variable(rCurParsedVariable); + aResultIds.push_back( rCurParsedVariable.Id() ); + eResultType = result_variable; + } + else if (bExtern) + { + eResultType = result_ignore; + } + + pStati->SetCur(finished); +} + +void +PE_VarFunc::SpReturn_FunctionStd() +{ + if ( (NOT bExtern) OR bExternC ) + { + aResultIds.push_back(pSpuFunctionStd->Child().Result_Id()); + eResultType = result_function; + } + else + { + eResultType = result_ignore; + } + + if ( NOT pSpuFunctionStd->Child().Result_WithImplementation() ) + pStati->SetCur(finished); + else + pStati->SetCur(finishedIncludingFunctionImplementation); +} + +void +PE_VarFunc::SpReturn_Ignore() +{ + pStati->SetCur(finished); +} + +void +PE_VarFunc::On_start_Identifier(const char * i_sText) +{ + pSpuType->Push(not_done); +} + +void +PE_VarFunc::On_start_operator(const char * i_sText) +{ + pSpuFunctionCastOperator->Push(done); +} + +void +PE_VarFunc::On_start_TypeKey(const char * i_sText) +{ + pSpuType->Push(not_done); +} + +void +PE_VarFunc::On_start_virtual(const char * i_sText) +{ + SetTokenResult(done, stay); + bVirtual = true; +} + +void +PE_VarFunc::On_start_Tilde(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(expectName); + + bInDestructor = true; +} + +void +PE_VarFunc::On_start_const(const char * i_sText) +{ + pSpuType->Push(not_done); +} + +void +PE_VarFunc::On_start_volatile(const char * i_sText) +{ + pSpuType->Push(not_done); +} + +void +PE_VarFunc::On_start_extern(const char * i_sText) +{ + SetTokenResult(done, stay); + bExtern = true; +} + +void +PE_VarFunc::On_start_static(const char * i_sText) +{ + SetTokenResult(done, stay); + bStatic = true; +} + +void +PE_VarFunc::On_start_mutable(const char * i_sText) +{ + SetTokenResult(done, stay); + bMutable = true; +} + +void +PE_VarFunc::On_start_register(const char * i_sText) +{ + SetTokenResult(done, stay); + bRegister = true; +} + +void +PE_VarFunc::On_start_inline(const char * i_sText) +{ + SetTokenResult(done, stay); + + bInline = true; +} + +void +PE_VarFunc::On_start_explicit(const char * i_sText) +{ + SetTokenResult(done, stay); + bExplicit = true; +} + +void +PE_VarFunc::On_start_Bracket_Right(const char * i_sText) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_VarFunc::On_expectCtor_Bracket_Left(const char * i_sText) +{ + pSpuFunctionCtor->Push(not_done); +} + +void +PE_VarFunc::On_afterClassDecl_Semicolon(const char * i_sText) +{ + SetTokenResult(done, pop_success); +} + +void +PE_VarFunc::On_expectName_Identifier(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterName); + sName = i_sText; +} + +void +PE_VarFunc::On_expectName_operator(const char * i_sText) +{ + pSpuFunctionNormalOperator->Push(done); +} + +void +PE_VarFunc::On_expectName_Bracket_Left(const char * i_sText) +{ + // Function pointer declaration + pSpuIgnore->Push(not_done); + // TODO +} + + +void +PE_VarFunc::On_afterName_ArrayBracket_Left(const char * i_sText) +{ + pSpuVariable->Push(not_done); +} + +void +PE_VarFunc::On_afterName_Bracket_Left(const char * i_sText) +{ + if ( NOT bInDestructor) + pSpuFunctionStd->Push(not_done); + else + pSpuFunctionDtor->Push(not_done); +} + +void +PE_VarFunc::On_afterName_DoubleColon(const char * i_sText) +{ + pSpuIgnore->Push(done); // This seems to be only an implementation. +} + +void +PE_VarFunc::On_afterName_Semicolon(const char * i_sText) +{ + pSpuVariable->Push(not_done); +} + +void +PE_VarFunc::On_afterName_Comma(const char * i_sText) +{ + pSpuVariable->Push(not_done); +} + +void +PE_VarFunc::On_afterName_Assign(const char * ) +{ + pSpuVariable->Push(not_done); +} + +void +PE_VarFunc::On_afterName_Less(const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterName_inErraneousTemplate); + + nCounter_TemplateBrackets = 1; +} + +void +PE_VarFunc::On_afterName_inErraneousTemplate_Less(const char * ) +{ + SetTokenResult(done, stay); + + nCounter_TemplateBrackets++; +} + +void +PE_VarFunc::On_afterName_inErraneousTemplate_Greater(const char * ) +{ + SetTokenResult(done, stay); + + nCounter_TemplateBrackets--; + if ( nCounter_TemplateBrackets == 0 ) + pStati->SetCur(afterName); +} + +void +PE_VarFunc::On_afterName_inErraneousTemplate_Default(const char * ) +{ + SetTokenResult(done, stay); +} + +void +PE_VarFunc::On_finished_Semicolon(const char * ) // Should be Semicolon !!! +{ + SetTokenResult(done, pop_success); +} + +void +PE_VarFunc::On_finished_Comma(const char * ) +{ + SetTokenResult(done, stay); + pStati->SetCur(expectName); +} + +void +PE_VarFunc::On_finished_Default(const char * ) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_VarFunc::On_finishedIncludingFunctionImplementation_Default(const char * ) +{ + SetTokenResult(not_done, pop_success); +} + +ary::cpp::FunctionFlags +PE_VarFunc::CreateFunctionFlags() +{ + typedef ary::cpp::FunctionFlags FuncFlags; + + return FuncFlags( UINT16(0) + | ( bStatic AND Env().Context().CurClass() == 0 ? FuncFlags::f_static_local : 0 ) + | ( bStatic AND Env().Context().CurClass() != 0 ? FuncFlags::f_static_member : 0 ) + | ( bExtern ? FuncFlags::f_extern : 0 ) + | ( Env().IsExternC() ? FuncFlags::f_externC : 0 ) + | ( bMutable ? FuncFlags::f_mutable : 0 ) + | ( bInline ? FuncFlags::f_inline : 0 ) + | ( bRegister ? FuncFlags::f_register : 0 ) + | ( bExplicit ? FuncFlags::f_explicit : 0 ) + ); + +} + + +} // namespace cpp + + + diff --git a/autodoc/source/parser/cpp/pe_vafu.hxx b/autodoc/source/parser/cpp/pe_vafu.hxx new file mode 100644 index 000000000000..490c36574262 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_vafu.hxx @@ -0,0 +1,322 @@ +/************************************************************************* + * + * $RCSfile: pe_vafu.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:31 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#ifndef ADC_CPP_PE_VAFU_HXX +#define ADC_CPP_PE_VAFU_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> +#include <ary/cpp/c_etypes.hxx> +#include <ary/cpp/c_vfflag.hxx> + // PARAMETERS + + +namespace cpp { + +class PE_Type; +class PE_Variable; +class PE_Function; +class PE_Ignore; + + +class PE_VarFunc : public Cpp_PE +{ + public: + enum E_State + { + start, + expectCtor, + afterClassDecl, // Also used for after enum declaration. + expectName, + afterName, + afterName_inErraneousTemplate, + finished, + finishedIncludingFunctionImplementation, + size_of_states + }; + enum E_ResultType + { + result_unknown = 0, + result_ignore, /// Used for class and enum declarations and predeclarations and for extern variables and functions. + result_variable, + result_function + }; + + typedef ary::cpp::E_Protection E_Protection; + + + PE_VarFunc( + Cpp_PE * i_pParent ); + ~PE_VarFunc(); + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + const std::vector<ary::Cid> & + Result_Ids() const; + ary::Tid Result_FrontType() const; + const StringVector & + Result_Names() const; + E_ResultType Result_CeType() const; + + private: + typedef SubPe< PE_VarFunc, PE_Type > SP_Type; + typedef SubPeUse< PE_VarFunc, PE_Type > SPU_Type; + typedef SubPe< PE_VarFunc, PE_Variable > SP_Variable; + typedef SubPeUse< PE_VarFunc, PE_Variable > SPU_Variable; + typedef SubPe< PE_VarFunc, PE_Function > SP_Function; + typedef SubPeUse< PE_VarFunc, PE_Function > SPU_Function; + typedef SubPe< PE_VarFunc, PE_Ignore > SP_Ignore; + typedef SubPeUse< PE_VarFunc, PE_Ignore > SPU_Ignore; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_UnknownToken( const char *); + + void SpInit_FunctionStd(); + void SpInit_FunctionCtor(); + void SpInit_FunctionDtor(); + void SpInit_FunctionCastOperator(); + void SpInit_FunctionNormalOperator(); + void SpReturn_Type(); + void SpReturn_Variable(); + void SpReturn_FunctionStd(); + void SpReturn_Ignore(); + + void On_start_Identifier(const char * i_sText); + void On_start_operator(const char * i_sText); + void On_start_TypeKey(const char * i_sText); + void On_start_virtual(const char * i_sText); + void On_start_Tilde(const char * i_sText); + void On_start_const(const char * i_sText); + void On_start_volatile(const char * i_sText); + void On_start_extern(const char * i_sText); + void On_start_static(const char * i_sText); + void On_start_mutable(const char * i_sText); + void On_start_register(const char * i_sText); + void On_start_inline(const char * i_sText); + void On_start_explicit(const char * i_sText); + void On_start_Bracket_Right(const char * i_sText); + + void On_expectCtor_Bracket_Left(const char * i_sText); + + void On_afterClassDecl_Semicolon(const char * i_sText); + + void On_expectName_Identifier(const char * i_sText); + void On_expectName_operator(const char * i_sText); + void On_expectName_Bracket_Left(const char * i_sText); + + void On_afterName_ArrayBracket_Left(const char * i_sText); + void On_afterName_Bracket_Left(const char * i_sText); + void On_afterName_DoubleColon(const char * i_sText); + void On_afterName_Semicolon(const char * i_sText); + void On_afterName_Comma(const char * i_sText); + void On_afterName_Assign(const char * i_sText); + void On_afterName_Less(const char * i_sText); + + void On_afterName_inErraneousTemplate_Less(const char * i_sText); + void On_afterName_inErraneousTemplate_Greater(const char * i_sText); + void On_afterName_inErraneousTemplate_Default(const char * i_sText); + + void On_finished_Semicolon(const char * i_sText); + void On_finished_Comma(const char * i_sText); + void On_finished_Default(const char * i_sText); + + void On_finishedIncludingFunctionImplementation_Default(const char * i_sText); + + ary::cpp::FunctionFlags + CreateFunctionFlags(); + + // DATA + Dyn< PeStatusArray<PE_VarFunc> > + pStati; + + Dyn<SP_Type> pSpType; + Dyn<SPU_Type> pSpuType; + Dyn<SP_Variable> pSpVariable; + Dyn<SPU_Variable> pSpuVariable; + Dyn<SP_Function> pSpFunction; + Dyn<SPU_Function> pSpuFunctionStd; + Dyn<SPU_Function> pSpuFunctionCtor; + Dyn<SPU_Function> pSpuFunctionDtor; + Dyn<SPU_Function> pSpuFunctionCastOperator; + Dyn<SPU_Function> pSpuFunctionNormalOperator; + Dyn<SP_Ignore> pSpIgnore; + Dyn<SPU_Ignore> pSpuIgnore; + + intt nCounter_TemplateBrackets; + bool bInDestructor; + + std::vector<ary::Cid> + aResultIds; + ary::Tid nResultFrontType; + E_ResultType eResultType; + + // Pre-Results + udmstri sName; + + bool bVirtual; + bool bStatic; + bool bExtern; + bool bExternC; + bool bMutable; + bool bInline; + bool bRegister; + bool bExplicit; +}; + + + +// IMPLEMENTATION + +inline const std::vector<ary::Tid> & +PE_VarFunc::Result_Ids() const + { return aResultIds; } +inline ary::Tid +PE_VarFunc::Result_FrontType() const + { return nResultFrontType; } +inline PE_VarFunc::E_ResultType +PE_VarFunc::Result_CeType() const + { return eResultType; } + + + +} // namespace cpp + + + + +#endif + + +/* // Overview of Stati + +Undecided +--------- + +start // vor und whrend storage class specifiern + any ->stay + operaator ->goto Function + +->Typ + +expectName + Identifier ->stay + operator ->goto Function + +afterName ->goto Variable or Function + + + + +Variable +-------- + +start // vor und whrend storage class specifiern + +->Typ + +expectName // Typ ist da -> im Falle von '(': notyetimplemented +afterName + +expectSize // after [ +expectFinish + // vor ; oder , +expectNextVarName // anders als bei expectName kann hier auch * oder & kommen + + + + + +Function +-------- + +start // vor und whrend storage class specifiern + +->Typ + +expectName // Typ ist da +expectBracket // Nach Name +expectParameter // nach ( oder , +-> Parameter +after Parameters // before const, volatile throw or = 0. +after throw // expect ( +expectException // after ( +after exceptions // = 0 oder ; oder , + + +expectNextVarName // anders als bei expectName kann hier auch * oder & kommen + + + + + + + +*/ diff --git a/autodoc/source/parser/cpp/pe_vari.cxx b/autodoc/source/parser/cpp/pe_vari.cxx new file mode 100644 index 000000000000..f26685795f18 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_vari.cxx @@ -0,0 +1,222 @@ +/************************************************************************* + * + * $RCSfile: pe_vari.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include "pe_vari.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/template/tpltools.hxx> +#include "pe_expr.hxx" + + + + +namespace cpp { + + +PE_Variable::PE_Variable( Cpp_PE * i_pParent ) + : Cpp_PE(i_pParent), + pStati( new PeStatusArray<PE_Variable> ) + // pSpExpression, + // pSpuArraySizeExpression, + // pSpuInitExpression, + // sResultSizeExpression, + // sResultInitExpression +{ + Setup_StatusFunctions(); + + pSpExpression = new SP_Expression(*this); + + pSpuArraySizeExpression = new SPU_Expression(*pSpExpression, 0, &PE_Variable::SpReturn_ArraySizeExpression); + pSpuInitExpression = new SPU_Expression(*pSpExpression, 0, &PE_Variable::SpReturn_InitExpression); +} + +PE_Variable::~PE_Variable() +{ +} + +void +PE_Variable::Call_Handler( const cpp::Token & i_rTok ) +{ + pStati->Cur().Call_Handler(i_rTok.TypeId(), i_rTok.Text()); +} + +void +PE_Variable::Setup_StatusFunctions() +{ + typedef CallFunction<PE_Variable>::F_Tok F_Tok; + + static F_Tok stateF_afterName[] = { On_afterName_ArrayBracket_Left, + On_afterName_Semicolon, + On_afterName_Comma, + On_afterName_Assign }; + static INT16 stateT_afterName[] = { Tid_ArrayBracket_Left, + Tid_Semicolon, + Tid_Comma, + Tid_Assign }; + static F_Tok stateF_afterSize[] = { On_afterSize_ArrayBracket_Right }; + static INT16 stateT_afterSize[] = { Tid_ArrayBracket_Right }; + static F_Tok stateF_expectFinish[] = { On_expectFinish_Bracket_Right, + On_expectFinish_Semicolon, + On_expectFinish_Comma }; + static INT16 stateT_expectFinish[] = { Tid_Bracket_Right, + Tid_Semicolon, + Tid_Comma }; + + SEMPARSE_CREATE_STATUS(PE_Variable, afterName, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Variable, afterSize, Hdl_SyntaxError); + SEMPARSE_CREATE_STATUS(PE_Variable, expectFinish, Hdl_SyntaxError); +} + +void +PE_Variable::InitData() +{ + pStati->SetCur(afterName); + + sResultSizeExpression.clear(); + sResultInitExpression.clear(); +} + +void +PE_Variable::TransferData() +{ + pStati->SetCur(size_of_states); +} + +void +PE_Variable::Hdl_SyntaxError( const char * i_sText) +{ + StdHandlingOfSyntaxError(i_sText); +} + +void +PE_Variable::SpReturn_ArraySizeExpression() +{ + pStati->SetCur(afterSize); + + sResultSizeExpression = pSpuArraySizeExpression->Child().Result_Text(); +} + +void +PE_Variable::SpReturn_InitExpression() +{ + pStati->SetCur(expectFinish); + + sResultInitExpression = pSpuInitExpression->Child().Result_Text(); +} + +void +PE_Variable::On_afterName_ArrayBracket_Left(const char * i_sText) +{ + pSpuArraySizeExpression->Push(done); +} + +void +PE_Variable::On_afterName_Semicolon(const char * i_sText) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Variable::On_afterName_Comma(const char * i_sText) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Variable::On_afterName_Assign(const char * i_sText) +{ + pSpuInitExpression->Push(done); +} + +void +PE_Variable::On_afterSize_ArrayBracket_Right(const char * i_sText) +{ + SetTokenResult(done, stay); + pStati->SetCur(afterName); +} + +void +PE_Variable::On_expectFinish_Semicolon(const char * i_sText) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Variable::On_expectFinish_Comma(const char * i_sText) +{ + SetTokenResult(not_done, pop_success); +} + +void +PE_Variable::On_expectFinish_Bracket_Right(const char * i_sText) +{ + SetTokenResult(not_done, pop_success); +} + + +} // namespace cpp + + + + diff --git a/autodoc/source/parser/cpp/pe_vari.hxx b/autodoc/source/parser/cpp/pe_vari.hxx new file mode 100644 index 000000000000..24c57573f682 --- /dev/null +++ b/autodoc/source/parser/cpp/pe_vari.hxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * $RCSfile: pe_vari.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_PE_VARI_HXX +#define ADC_CPP_PE_VARI_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cpp_pe.hxx" + // COMPONENTS +#include <semantic/callf.hxx> +#include <semantic/sub_peu.hxx> +#include <ary/cpp/c_etypes.hxx> +#include <ary/cpp/c_vfflag.hxx> + // PARAMETERS + + +namespace cpp { + +class PE_Expression; + + +class PE_Variable : public Cpp_PE +{ + public: + enum E_State + { + afterName, // + afterSize, // after ] + expectFinish, // after InitExpression + size_of_states + }; + PE_Variable( + Cpp_PE * i_pParent ); + ~PE_Variable(); + + /** @return + Bit 0x0001 != 0, if there is a size and + bit 0x0002 != 0, if there is an initialisation. + */ + UINT16 Result_Pattern() const; + const udmstri & Result_SizeExpression() const; + const udmstri & Result_InitExpression() const; + + virtual void Call_Handler( + const cpp::Token & i_rTok ); + + private: + typedef SubPe< PE_Variable, PE_Expression > SP_Expression; + typedef SubPeUse< PE_Variable, PE_Expression> SPU_Expression; + + void Setup_StatusFunctions(); + virtual void InitData(); + virtual void TransferData(); + void Hdl_SyntaxError(const char *); + + void SpReturn_ArraySizeExpression(); + void SpReturn_InitExpression(); + + void On_afterName_ArrayBracket_Left(const char * i_sText); + void On_afterName_Semicolon(const char * i_sText); + void On_afterName_Comma(const char * i_sText); + void On_afterName_Assign(const char * i_sText); + + void On_afterSize_ArrayBracket_Right(const char * i_sText); + + void On_expectFinish_Semicolon(const char * i_sText); + void On_expectFinish_Comma(const char * i_sText); + void On_expectFinish_Bracket_Right(const char * i_sText); + + // DATA + Dyn< PeStatusArray<PE_Variable> > + pStati; + + Dyn<SP_Expression> pSpExpression; + Dyn<SPU_Expression> pSpuArraySizeExpression; + Dyn<SPU_Expression> pSpuInitExpression; + + udmstri sResultSizeExpression; + udmstri sResultInitExpression; +}; + + + +// IMPLEMENTATION + + +inline UINT16 +PE_Variable::Result_Pattern() const + { return ( sResultSizeExpression.length() > 0 ? 1 : 0 ) + + ( sResultInitExpression.length() > 0 ? 2 : 0 ); } +inline const udmstri & +PE_Variable::Result_SizeExpression() const + { return sResultSizeExpression; } +inline const udmstri & +PE_Variable::Result_InitExpression() const + { return sResultInitExpression; } + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/pev.hxx b/autodoc/source/parser/cpp/pev.hxx new file mode 100644 index 000000000000..6559645d4d30 --- /dev/null +++ b/autodoc/source/parser/cpp/pev.hxx @@ -0,0 +1,333 @@ +/************************************************************************* + * + * $RCSfile: pev.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:30 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_PEV_HXX +#define ADC_CPP_PEV_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <tokens/tokproct.hxx> + // COMPONENTS + // PARAMETERS +#include <ary/cpp/c_etypes.hxx> + +namespace ary +{ + namespace cpp + { + class RwGate; + class InputContext; + + class Namespace; + class Class; + class Enum; + class Typedef; + class Function; + class Variable; + class EnumValue; + + class CppDefinition; + } + + class Documentation; +} + + +namespace cpp +{ + + +class PeEnvironment : protected TokenProcessing_Types +{ + public: + // INQUIRY + virtual ~PeEnvironment() {} + + // OPERATIONS + // Token results + void SetTokenResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push = 0 ); + + // Owner stack + void OpenNamespace( + ary::cpp::Namespace & + io_rOpenedNamespace ); + void OpenExternC( + bool i_bOnlyForOneDeclaration = false ); + void OpenClass( + ary::cpp::Class & io_rOpenedClass ); + void OpenEnum( + ary::cpp::Enum & io_rOpenedEnum ); + void CloseBlock(); /// Handles a '}' on file scope. + void CloseClass(); + void CloseEnum(); + void SetCurProtection( /// Handles 'public:', 'protected:' and 'private:' on class scope. + ary::cpp::E_Protection + i_eProtection ); + void OpenTemplate( + const StringVector & + i_rParameters ); + /// Removes parameters from this object. + DYN StringVector * + Get_CurTemplateParameters(); + + // Special events + void Event_Class_FinishedBase( + const udmstri & i_sParameterName ); + + void Event_Store_Typedef( + ary::cpp::Typedef & io_rTypedef ); + void Event_Store_EnumValue( + ary::cpp::EnumValue & + io_rEnumValue ); + void Event_Store_CppDefinition( + ary::cpp::CppDefinition & + io_rDefinition ); + + void Event_EnterFunction_ParameterList(); + void Event_Function_FinishedParameter( + const udmstri & i_sParameterName ); + void Event_LeaveFunction_ParameterList(); + void Event_EnterFunction_Implementation(); + void Event_LeaveFunction_Implementation(); + + void Event_Store_Function( + ary::cpp::Function & + io_rFunction ); + void Event_Store_Variable( + ary::cpp::Variable & + io_rVariable ); + // Error recovery + void StartWaitingFor_Recovery(); + + // INQUIRY + ary::cpp::RwGate & AryGate() const; + const ary::cpp::InputContext & + Context() const; + udmstri CurFileName() const; + uintt LineCount() const; + bool IsWaitingFor_Recovery() const; + bool IsExternC() const; + + private: + virtual void do_SetTokenResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push ) = 0; + virtual void do_OpenNamespace( + ary::cpp::Namespace & + io_rOpenedNamespace ) = 0; + virtual void do_OpenExternC( + bool i_bOnlyForOneDeclaration ) = 0; + virtual void do_OpenClass( + ary::cpp::Class & io_rOpenedClass ) = 0; + virtual void do_OpenEnum( + ary::cpp::Enum & io_rOpenedEnum ) = 0; + virtual void do_CloseBlock() = 0; + virtual void do_CloseClass() = 0; + virtual void do_CloseEnum() = 0; + virtual void do_SetCurProtection( + ary::cpp::E_Protection + i_eProtection ) = 0; + virtual void do_OpenTemplate( + const StringVector & + i_rParameters ) = 0; + virtual DYN StringVector * + do_Get_CurTemplateParameters() = 0; + virtual void do_Event_Class_FinishedBase( + const udmstri & i_sBaseName ) = 0; + + virtual void do_Event_Store_Typedef( + ary::cpp::Typedef & io_rTypedef ) = 0; + virtual void do_Event_Store_EnumValue( + ary::cpp::EnumValue & + io_rEnumValue ) = 0; + virtual void do_Event_Store_CppDefinition( + ary::cpp::CppDefinition & + io_rDefinition ) = 0; + virtual void do_Event_EnterFunction_ParameterList() = 0; + virtual void do_Event_Function_FinishedParameter( + const udmstri & i_sParameterName ) = 0; + virtual void do_Event_LeaveFunction_ParameterList() = 0; + virtual void do_Event_EnterFunction_Implementation() = 0; + virtual void do_Event_LeaveFunction_Implementation() = 0; + virtual void do_Event_Store_Function( + ary::cpp::Function & + io_rFunction ) = 0; + virtual void do_Event_Store_Variable( + ary::cpp::Variable & + io_rVariable ) = 0; + virtual void do_StartWaitingFor_Recovery() = 0; + virtual ary::cpp::RwGate & + inq_AryGate() const = 0; + virtual const ary::cpp::InputContext & + inq_Context() const = 0; + virtual udmstri inq_CurFileName() const = 0; + virtual uintt inq_LineCount() const = 0; + virtual bool inq_IsWaitingFor_Recovery() const = 0; + virtual bool inq_IsExternC() const = 0; +}; + + + +// IMPLEMENTATION + +inline void +PeEnvironment::SetTokenResult( E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + ParseEnvironment * i_pParseEnv2Push ) + { do_SetTokenResult(i_eDone, i_eWhat2DoWithEnvStack, i_pParseEnv2Push); } +inline void +PeEnvironment::OpenNamespace( ary::cpp::Namespace & io_rOpenedNamespace ) + { do_OpenNamespace(io_rOpenedNamespace); } +inline void +PeEnvironment::OpenExternC( bool i_bOnlyForOneDeclaration ) + { do_OpenExternC(i_bOnlyForOneDeclaration); } +inline void +PeEnvironment::OpenClass( ary::cpp::Class & io_rOpenedClass ) + { do_OpenClass(io_rOpenedClass); } +inline void +PeEnvironment::OpenEnum( ary::cpp::Enum & io_rOpenedEnum ) + { do_OpenEnum(io_rOpenedEnum); } +inline void +PeEnvironment::CloseBlock() + { do_CloseBlock(); } +inline void +PeEnvironment::CloseClass() + { do_CloseClass(); } +inline void +PeEnvironment::CloseEnum() + { do_CloseEnum(); } +inline void +PeEnvironment::SetCurProtection( ary::cpp::E_Protection i_eProtection ) + { do_SetCurProtection(i_eProtection); } +inline void +PeEnvironment::OpenTemplate( const StringVector & i_rParameters ) + { do_OpenTemplate(i_rParameters); } +inline DYN StringVector * +PeEnvironment::Get_CurTemplateParameters() + { return do_Get_CurTemplateParameters(); } +inline void +PeEnvironment::Event_Class_FinishedBase( const udmstri & i_sBaseName ) + { do_Event_Class_FinishedBase(i_sBaseName); } +inline void +PeEnvironment::Event_Store_Typedef( ary::cpp::Typedef & io_rTypedef ) + { do_Event_Store_Typedef(io_rTypedef); } +inline void +PeEnvironment::Event_Store_EnumValue( ary::cpp::EnumValue & io_rEnumValue ) + { do_Event_Store_EnumValue(io_rEnumValue); } +inline void +PeEnvironment::Event_Store_CppDefinition( ary::cpp::CppDefinition & io_rDefinition ) + { do_Event_Store_CppDefinition(io_rDefinition); } +inline void +PeEnvironment::Event_EnterFunction_ParameterList() + { do_Event_EnterFunction_ParameterList(); } +inline void +PeEnvironment::Event_Function_FinishedParameter( const udmstri & i_sParameterName ) + { do_Event_Function_FinishedParameter(i_sParameterName); } +inline void +PeEnvironment::Event_LeaveFunction_ParameterList() + { do_Event_LeaveFunction_ParameterList(); } +inline void +PeEnvironment::Event_EnterFunction_Implementation() + { do_Event_EnterFunction_Implementation(); } +inline void +PeEnvironment::Event_LeaveFunction_Implementation() + { do_Event_LeaveFunction_Implementation(); } +inline void +PeEnvironment::Event_Store_Function( ary::cpp::Function & io_rFunction ) + { do_Event_Store_Function(io_rFunction); } +inline void +PeEnvironment::Event_Store_Variable( ary::cpp::Variable & io_rVariable ) + { do_Event_Store_Variable(io_rVariable); } +inline void +PeEnvironment::StartWaitingFor_Recovery() + { do_StartWaitingFor_Recovery(); } +inline ary::cpp::RwGate & +PeEnvironment::AryGate() const + { return inq_AryGate(); } +inline const ary::cpp::InputContext & +PeEnvironment::Context() const + { return inq_Context(); } +inline udmstri +PeEnvironment::CurFileName() const + { return inq_CurFileName(); } +inline uintt +PeEnvironment::LineCount() const + { return inq_LineCount(); } +inline bool +PeEnvironment::IsWaitingFor_Recovery() const + { return inq_IsWaitingFor_Recovery(); } +inline bool +PeEnvironment::IsExternC() const + { return inq_IsExternC(); } + + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/preproc.cxx b/autodoc/source/parser/cpp/preproc.cxx new file mode 100644 index 000000000000..4e9f9661ee8c --- /dev/null +++ b/autodoc/source/parser/cpp/preproc.cxx @@ -0,0 +1,267 @@ +/************************************************************************* + * + * $RCSfile: preproc.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include "preproc.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/template/tpltools.hxx> +#include "all_toks.hxx" +#include "defdescr.hxx" +#include <tools/tkpchars.hxx> +#include "c_rcode.hxx" + + +namespace cpp +{ + + +PreProcessor::F_TOKENPROC PreProcessor::aTokProcs[PreProcessor::state_MAX] = + { + PreProcessor::On_plain, + PreProcessor::On_expect_macro_bracket_left, + PreProcessor::On_expect_macro_param + }; + + +PreProcessor::PreProcessor() + : pCppExplorer(0), + pSourceText(0), + pCurValidDefines(0), + // aTokens, + eState(plain), + pCurMacro(0), + dpCurMacroName(0), + // aCurMacroParams, + aCurParamText(60000), + nBracketInParameterCounter(0) + // aBlockedMacroNames +{ +} + +PreProcessor::~PreProcessor() +{ +} + +void +PreProcessor::AssignPartners( CodeExplorer & o_rCodeExplorer, + CharacterSource & o_rCharSource, + const MacroMap & i_rCurValidDefines ) +{ + pCppExplorer = &o_rCodeExplorer; + pSourceText = &o_rCharSource; + pCurValidDefines = &i_rCurValidDefines; +} + +void +PreProcessor::Process_Token( cpp::Token & let_drToken ) +{ + csv_assert(pCppExplorer != 0); // Implies pSourceText and pCurValidDefines. + + (this->*aTokProcs[eState])(let_drToken); +} + +void +PreProcessor::On_plain( cpp::Token & let_drToken ) +{ + if ( let_drToken.TypeId() == Tid_Identifier ) + { + if (CheckForDefine(let_drToken)) + return; + } + + pCppExplorer->Process_Token(let_drToken); +} + +void +PreProcessor::On_expect_macro_bracket_left( cpp::Token & let_drToken ) +{ + if ( let_drToken.TypeId() == Tid_Bracket_Left ) + { + aCurParamText.seekp(0); + eState = expect_macro_param; + } + else + { + pCppExplorer->Process_Token(*dpCurMacroName); + dpCurMacroName = 0; + pCppExplorer->Process_Token(let_drToken); + eState = plain; + } +} + +void +PreProcessor::On_expect_macro_param( cpp::Token & let_drToken ) +{ + if ( let_drToken.TypeId() == Tid_Bracket_Left ) + nBracketInParameterCounter++; + else if ( let_drToken.TypeId() == Tid_Bracket_Right ) + { + if ( nBracketInParameterCounter > 0 ) + nBracketInParameterCounter--; + else + { + aCurParamText; + if ( NOT csv::no_str(aCurParamText.c_str()) ) + { + aCurMacroParams.push_back( udmstri(aCurParamText.c_str()) ); + } + csv_assert( aCurMacroParams.size() == pCurMacro->ParamCount() ); + + InterpretMacro(); + eState = plain; + return; + } + } + else if ( let_drToken.TypeId() == Tid_Comma AND nBracketInParameterCounter == 0 ) + { + aCurMacroParams.push_back( udmstri(aCurParamText.c_str()) ); + aCurParamText.seekp(0); + return; + } + + // KORR FUTURE: + // If in future whitespace is parsed also, that should match exactly and the + // safety spaces, " ", here should be removed. + aCurParamText << let_drToken.Text() << " "; +} + +bool +PreProcessor::CheckForDefine( cpp::Token & let_drToken ) +{ + udmstri sTokenText(let_drToken.Text()); + pCurMacro = csv::value_from_map( *pCurValidDefines, sTokenText ); + if (pCurMacro == 0 ) + return false; + for ( StringVector::const_iterator it = aBlockedMacroNames.begin(); + it != aBlockedMacroNames.end(); + ++it ) + { + if ( strcmp( (*it).c_str(), let_drToken.Text() ) == 0 ) + return false; + } + + if ( pCurMacro->DefineType() == DefineDescription::type_define ) + { + delete &let_drToken; + + aCurParamText.seekp(0); + pCurMacro->GetDefineText(aCurParamText); + + if ( aCurParamText.tellp() > 1 ) + pSourceText->InsertTextAtCurPos(aCurParamText.c_str()); + } + else // ( pCurMacro->DefineType() == DefineDescription::type_macro ) + { + dpCurMacroName = &let_drToken; + eState = expect_macro_bracket_left; + csv::erase_container( aCurMacroParams ); + aCurParamText.seekp(0); + nBracketInParameterCounter = 0; + } // endif + + return true; +} + +void +PreProcessor::UnblockMacro( const char * i_sMacroName ) +{ + for ( StringVector::iterator it = aBlockedMacroNames.begin(); + it != aBlockedMacroNames.end(); + ++it ) + { + if ( strcmp( (*it), i_sMacroName ) == 0 ) + { + aBlockedMacroNames.erase(it); + break; + } + } /// end for +} + +void +PreProcessor::InterpretMacro() +{ + aCurParamText.seekp(0); + pCurMacro->GetMacroText(aCurParamText, aCurMacroParams); + + if ( NOT csv::no_str(aCurParamText.c_str()) ) + { + aCurParamText.seekp(-1, csv::cur); + aCurParamText << " #unblock-" << dpCurMacroName->Text() << " "; + + pSourceText->InsertTextAtCurPos(aCurParamText.c_str()); + udmstri sCurMacroName(dpCurMacroName->Text()); + aBlockedMacroNames.insert( aBlockedMacroNames.begin(), sCurMacroName ); + } + + delete dpCurMacroName; + dpCurMacroName = 0; + pCurMacro = 0; + csv::erase_container(aCurMacroParams); + aCurParamText.seekp(0); +} + + +} // end namespace cpp + + diff --git a/autodoc/source/parser/cpp/preproc.hxx b/autodoc/source/parser/cpp/preproc.hxx new file mode 100644 index 000000000000..0466b3c562fc --- /dev/null +++ b/autodoc/source/parser/cpp/preproc.hxx @@ -0,0 +1,150 @@ +/************************************************************************* + * + * $RCSfile: preproc.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_PREPROC_HXX +#define ADC_CPP_PREPROC_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <deque> + // PARAMETERS + +class CharacterSource; + + +namespace cpp +{ + +class Token; +class CodeExplorer; +class DefineDescription; + + +class PreProcessor +{ + public: + typedef std::map< udmstri, DefineDescription* > MacroMap; + + // LIFECYCLE + PreProcessor(); + ~PreProcessor(); + // OPERATONS + void AssignPartners( + CodeExplorer & o_rCodeExplorer, + CharacterSource & o_rCharSource, + const MacroMap & i_rCurValidDefines ); + void Process_Token( + cpp::Token & let_drToken ); + void UnblockMacro( + const char * i_sMacroName ); + private: + public: // Necessary for instantiation of static variable: + enum E_State + { + plain = 0, + expect_macro_bracket_left, + expect_macro_param, + state_MAX + }; + typedef void (PreProcessor::* F_TOKENPROC )(cpp::Token &); + void On_plain( cpp::Token & ); + void On_expect_macro_bracket_left( cpp::Token & ); + void On_expect_macro_param( cpp::Token & ); + + private: // Reprivate again: + typedef std::deque< DYN cpp::Token * > TokenQueue; + typedef StringVector List_MacroParams; + + + bool CheckForDefine( + cpp::Token & let_drToken ); + void InterpretMacro(); + + // DATA + static F_TOKENPROC aTokProcs[state_MAX]; + // Referenced extern objects + CodeExplorer * pCppExplorer; + CharacterSource * pSourceText; + const MacroMap * pCurValidDefines; + + // internal data + TokenQueue aTokens; + + E_State eState; + + DefineDescription * pCurMacro; + DYN Token * dpCurMacroName; + List_MacroParams aCurMacroParams; + csv::StreamStr aCurParamText; + + intt nBracketInParameterCounter; + StringVector aBlockedMacroNames; +}; + + + +} // end namespace cpp + +#endif + diff --git a/autodoc/source/parser/cpp/prs_cpp.cxx b/autodoc/source/parser/cpp/prs_cpp.cxx new file mode 100644 index 000000000000..690dc1fa91da --- /dev/null +++ b/autodoc/source/parser/cpp/prs_cpp.cxx @@ -0,0 +1,281 @@ +/************************************************************************* + * + * $RCSfile: prs_cpp.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + + +#include <precomp.h> +#include <cpp/prs_cpp.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cosv/file.hxx> +#include <ary/ary.hxx> +#include <ary/cpp/c_rwgate.hxx> +#include <autodoc/prs_docu.hxx> +#include <autodoc/filecoli.hxx> +#include <autodoc/x_parsing.hxx> +#include <tools/tkpchars.hxx> +#include <adc_cl.hxx> +#include "c_dealer.hxx" +#include "defdescr.hxx" +#include "tkp_cpp.hxx" + + +// Helper function +static bool Local_LoadFile( + CharacterSource & o_rTextBuffer, + const udmstri & i_rFullFilePath ); + + + + +namespace cpp +{ + +// This class is used for the UDK as workaround for the missing +// feature of parsing #define s. + +class Udk_MacroMap +{ + public: + typedef std::map< udmstri, DefineDescription* > Data; + + Udk_MacroMap(); + ~Udk_MacroMap(); + + const Data & GetData() const { return aData; } + + private: + Data aData; +}; + +struct S_RunningData +{ + CharacterSource aFileContent; + ary::cpp::RwGate & rCppGate; + Udk_MacroMap aMacros; + Distributor aDealer; + TokenParser_Cpp aTkp; + + S_RunningData( + ary::Repository & o_rRepository, + const autodoc::DocumentationParser_Ifc & + i_rDocumentationInterpreter ); +}; + + + + +Cpluplus_Parser::Cpluplus_Parser() +// : pRunningData +{ +} + +Cpluplus_Parser::~Cpluplus_Parser() +{ +} + +void +Cpluplus_Parser::Setup( ary::Repository & o_rRepository, + const autodoc::DocumentationParser_Ifc & i_rDocumentationInterpreter ) +{ + pRunningData = new S_RunningData(o_rRepository, i_rDocumentationInterpreter); +} + +void +Cpluplus_Parser::Run( const udmstri & i_sProjectName, + csv::ploc::Path & i_rProjectRootDirectory, + const autodoc::FileCollector_Ifc & i_rFiles ) +{ + pRunningData->aDealer.StartNewProject( i_sProjectName, i_rProjectRootDirectory ); + uintt nProjectSubPathLength = i_rProjectRootDirectory.DirChain().Size(); + + for ( autodoc::FileCollector_Ifc::const_iterator iter = i_rFiles.Begin(); + iter != i_rFiles.End(); + ++iter ) + { + csv::ploc::Path aFilePath(*iter); + aFilePath.DirChain().PopFront(nProjectSubPathLength); + + try + { + if ( NOT Local_LoadFile(pRunningData->aFileContent, *iter) ) + continue; + for ( pRunningData->aTkp.StartNewFile(aFilePath.File(), aFilePath.DirChain()); + pRunningData->aTkp.HasMore(); + pRunningData->aTkp.GetNextToken() ) + ; + } + catch (autodoc::X_Parser_Ifc & rX_Parse) + { + if ( DEBUG_ShowStoring() OR DEBUG_ShowText() ) + Cerr() << rX_Parse << Endl(); + } + catch (...) + { + if ( DEBUG_ShowStoring() OR DEBUG_ShowText() ) + Cerr() << "Error: Unknown exception." << Endl(); + } + } // end for (iter) +} + +S_RunningData::S_RunningData( ary::Repository & o_rRepository, + const autodoc::DocumentationParser_Ifc & i_rDocumentationInterpreter ) + : // aFileContent, + rCppGate( o_rRepository.RwGate_Cpp() ), + // aMacros, + aDealer(o_rRepository.RwGate_Cpp()), + aTkp( * i_rDocumentationInterpreter.Create_DocuContext() ) +{ + aDealer.AssignPartners( aFileContent, + aMacros.GetData() ); + aTkp.AssignPartners( aFileContent, aDealer ); +} + + +Udk_MacroMap::Udk_MacroMap() +{ + udmstri sSAL_CALL("SAL_CALL"); + udmstri sSAL_CALL_ELLIPSE("SAL_CALL_ELLIPSE"); + udmstri sSAL_NO_VTABLE("SAL_NO_VTABLE"); + udmstri sREGISTRY_CALLTYPE("REGISTRY_CALLTYPE"); + udmstri sSAL_THROW("SAL_THROW"); + udmstri sSAL_THROW_EXTERN_C("SAL_THROW_EXTERN_C"); + + udmstri s__DEF_COMPIMPLHELPER_A("__DEF_COMPIMPLHELPER_A"); + udmstri s__DEF_COMPIMPLHELPER_B("__DEF_COMPIMPLHELPER_B"); + udmstri s__DEF_COMPIMPLHELPER("__DEF_COMPIMPLHELPER"); + + udmstri s__DEF_IMPLHELPER_PRE("__DEF_IMPLHELPER_PRE"); + udmstri s__IFC_WRITEOFFSET("__IFC_WRITEOFFSET"); + udmstri s__DEF_IMPLHELPER_POST("__DEF_IMPLHELPER_POST"); + + + StringVector aEmpty; + + StringVector aParamsSAL_THROW; + aParamsSAL_THROW.push_back( udmstri("exc") ); + StringVector aDefSAL_THROW; + aDefSAL_THROW.push_back( udmstri("throw") ); + aDefSAL_THROW.push_back( udmstri("exc") ); + + StringVector aCompImplHelperParams; + aCompImplHelperParams.push_back(udmstri("N")); + + + // filling up the list + + + aData[sSAL_CALL] = new DefineDescription(sSAL_CALL, aEmpty); + aData[sSAL_CALL_ELLIPSE] = new DefineDescription(sSAL_CALL_ELLIPSE, aEmpty); + aData[sSAL_NO_VTABLE] = new DefineDescription(sSAL_NO_VTABLE, aEmpty); + aData[sREGISTRY_CALLTYPE] = new DefineDescription(sREGISTRY_CALLTYPE, aEmpty); + + aData[sSAL_THROW] = new DefineDescription(sSAL_THROW, aParamsSAL_THROW, aDefSAL_THROW); + aData[sSAL_THROW_EXTERN_C] = new DefineDescription(sSAL_THROW_EXTERN_C, aEmpty, aEmpty); + + aData[s__DEF_COMPIMPLHELPER_A] + = new DefineDescription( s__DEF_COMPIMPLHELPER_A, aCompImplHelperParams, aEmpty); + aData[s__DEF_COMPIMPLHELPER_B] + = new DefineDescription(s__DEF_COMPIMPLHELPER_B, aCompImplHelperParams, aEmpty); + aData[s__DEF_COMPIMPLHELPER] + = new DefineDescription(s__DEF_COMPIMPLHELPER, aCompImplHelperParams, aEmpty); + + aData[s__DEF_IMPLHELPER_PRE] + = new DefineDescription(s__DEF_IMPLHELPER_PRE, aCompImplHelperParams, aEmpty); + aData[s__IFC_WRITEOFFSET] + = new DefineDescription(s__IFC_WRITEOFFSET, aCompImplHelperParams, aEmpty); + aData[s__DEF_IMPLHELPER_POST] + = new DefineDescription(s__DEF_IMPLHELPER_POST, aCompImplHelperParams, aEmpty); + +} + +Udk_MacroMap::~Udk_MacroMap() +{ + for ( Data::iterator it = aData.begin(); it != aData.end(); ++it ) + { + delete (*it).second; + } +} + + + +} // namespace cpp + + +bool +Local_LoadFile( CharacterSource & o_rTextBuffer, + const udmstri & i_rFullFilePath ) +{ + Cout() << "Parse " << i_rFullFilePath << " ..." << Endl(); + + csv::File aFile( i_rFullFilePath, csv::CFM_READ ); + if (NOT aFile.open()) + { + Cerr() << " could not be opened.\n" << Endl(); + return false; + } + o_rTextBuffer.LoadText(aFile); + aFile.close(); + return true; +} + + + diff --git a/autodoc/source/parser/cpp/sdocdist.hxx b/autodoc/source/parser/cpp/sdocdist.hxx new file mode 100644 index 000000000000..7fcf0f29ff93 --- /dev/null +++ b/autodoc/source/parser/cpp/sdocdist.hxx @@ -0,0 +1,205 @@ +/************************************************************************* + * + * $RCSfile: sdocdist.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_SDOCDIST_HXX +#define ADC_CPP_SDOCDIST_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cxt2ary.hxx" +#include <ary/info/docstore.hxx> + // COMPONENTS + // PARAMETERS + +namespace cpp +{ + +using ary::Documentation; + +/** Implementation struct for cpp::ContextForAry. +*/ + +struct ContextForAry::S_DocuDistributor : public ary::info::DocuStore +{ + public: + S_DocuDistributor() : pCurRe(0) {} + ~S_DocuDistributor() {} + + void Reset() { pCurRe = 0; pLastStoredDocu = 0; } + + void SetCurrentlyStoredRe( + ary::RepositoryEntity & + io_rRe ); + void Event_LineBreak(); + + private: + // Interface ary::info::DocuStore + virtual void do_Store2CurProject( + DYN Documentation & let_drDocu ); + virtual void do_Store2CurFile( + DYN Documentation & let_drDocu ); + virtual void do_Store2CurNamespace( + DYN Documentation & let_drDocu ); + + virtual void do_Store2ConnectedDeclaration( + DYN Documentation & let_drDocu ); + + virtual void do_Store2Glossary( + DYN Documentation & let_drDocu, + const udmstri & i_sExplainedTerm ); + virtual void do_Store2GlobalTexts( + DYN Documentation & let_drDocu, + ary::info::GlobalTextId + i_nId ); + // DATA + ary::RepositoryEntity * + pCurRe; + Dyn<Documentation> pLastStoredDocu; +}; + + +// IMPLEMENTATION + +/* The implementation is in header, though not all inline, because this file + is included in cxt2ary.cxx only! +*/ + + +void +ContextForAry:: +S_DocuDistributor::SetCurrentlyStoredRe( ary::RepositoryEntity & io_rRe ) +{ + pCurRe = &io_rRe; + if ( pLastStoredDocu ) + pCurRe->Add_Documentation( *pLastStoredDocu.Release() ); +} + +inline void +ContextForAry:: +S_DocuDistributor::Event_LineBreak() +{ + pCurRe = 0; +} + +void +ContextForAry:: +S_DocuDistributor::do_Store2CurProject( DYN Documentation & let_drDocu ) +{ + // KORR_FUTURE + delete &let_drDocu; +} + +void +ContextForAry:: +S_DocuDistributor::do_Store2CurFile( DYN Documentation & let_drDocu ) +{ + // KORR_FUTURE + delete &let_drDocu; +} + +void +ContextForAry:: +S_DocuDistributor::do_Store2CurNamespace( DYN Documentation & let_drDocu ) +{ + // KORR_FUTURE + delete &let_drDocu; +} + +void +ContextForAry:: +S_DocuDistributor::do_Store2ConnectedDeclaration( DYN Documentation & let_drDocu ) +{ + if ( pCurRe != 0 ) + pCurRe->Add_Documentation(let_drDocu); + else + pLastStoredDocu = &let_drDocu; +} + +void +ContextForAry:: +S_DocuDistributor::do_Store2Glossary( DYN Documentation & let_drDocu, + const udmstri & // i_sExplainedTerm + ) +{ + // KORR_FUTURE + delete &let_drDocu; +} + +void +ContextForAry:: +S_DocuDistributor::do_Store2GlobalTexts( DYN Documentation & let_drDocu, + ary::info::GlobalTextId // i_nId + ) +{ + // KORR_FUTURE + delete &let_drDocu; +} + + + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/sfscope.hxx b/autodoc/source/parser/cpp/sfscope.hxx new file mode 100644 index 000000000000..5b2ca10792d0 --- /dev/null +++ b/autodoc/source/parser/cpp/sfscope.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * $RCSfile: sfscope.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_SFSCOPE_HXX +#define ADC_CPP_SFSCOPE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cxt2ary.hxx" + // COMPONENTS + // PARAMETERS + +namespace cpp +{ + +/** Implementation struct for cpp::ContextForAry. +*/ +struct ContextForAry::S_FileScopeInfo +{ + udmstri sCurFileName; + ary::cpp::ProjectGroup * + pCurProject; + ary::cpp::FileGroup * + pCurFile; + uintt nLineCount; + Dyn<StringVector> pCurTemplateParameters; + + S_FileScopeInfo(); +}; + + +inline +ContextForAry:: +S_FileScopeInfo::S_FileScopeInfo() + : // sCurFileName, + pCurProject(0), + pCurFile(0), + nLineCount(0) + // pCurTemplateParameters +{ +} + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/sownstck.hxx b/autodoc/source/parser/cpp/sownstck.hxx new file mode 100644 index 000000000000..9e27ee8da5e1 --- /dev/null +++ b/autodoc/source/parser/cpp/sownstck.hxx @@ -0,0 +1,348 @@ +/************************************************************************* + * + * $RCSfile: sownstck.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_SOWNSTCK_HXX +#define ADC_CPP_SOWNSTCK_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cxt2ary.hxx" + // COMPONENTS +#include <ary/cpp/c_etypes.hxx> +#include <estack.hxx> + // PARAMETERS +#include <ary/cpp/c_namesp.hxx> + + +namespace cpp +{ + +using ary::cpp::E_Protection; + + +/** Implementation struct for cpp::ContextForAry. +*/ +struct ContextForAry::S_OwnerStack +{ + public: + S_OwnerStack(); + void SetGlobalNamespace( + ary::cpp::Namespace & + io_rGlobalNamespace ); + ~S_OwnerStack(); + + void Reset(); + + void OpenNamespace( + ary::cpp::Namespace & + io_rOpenedNamespace ); + void OpenExternC(); + void OpenClass( + ary::cpp::Class & io_rOpenedClass ); + void OpenEnum( + ary::cpp::Enum & io_rOpenedEnum ); + void CloseBlock(); + void CloseClass(); + void CloseEnum(); + void SetCurProtection( + ary::cpp::E_Protection + i_eProtection ); + ary::cpp::Namespace & + CurNamespace() const; + ary::cpp::Class * CurClass() const; + ary::cpp::Enum * CurEnum() const; + + Owner & CurOwner() const; + ary::cpp::E_Protection + CurProtection() const; + bool IsExternC() const { return nExternC > 0; } + + private: + typedef std::pair< ary::cpp::Class*, E_Protection > ClassEnv; + typedef EStack< ary::cpp::Namespace* > Stack_Namespaces; + typedef EStack< ClassEnv > Stack_Classes; + typedef ary::cpp::InputContext::Owner Ifc_Owner; + + void SetOwner_2CurNamespace(); + void SetOwner_2CurClass(); + void SetOwner_2None(); + + // DATA + Stack_Namespaces aStack_Namespaces; + Stack_Classes aStack_Classes; + ary::cpp::Enum * pCurEnum; + uintt nExternC; /// This is a number, for the case that extern "C" blocks are nested. + + Dyn<Owner_Namespace> + pOwner_Namespace; + Dyn<Owner_Class> pOwner_Class; + Ifc_Owner * pOwner_Cur; +}; + + +// IMPLEMENTATION + +/* The implementation is in header, though not inline, because this file is included + in cxt2ary.cxx only! +*/ + +inline ary::cpp::Namespace & +ContextForAry:: +S_OwnerStack::CurNamespace() const +{ + csv_assert( aStack_Namespaces.size() > 0 ); + return *aStack_Namespaces.top(); +} + +inline ary::cpp::Class * +ContextForAry:: +S_OwnerStack::CurClass() const +{ + return aStack_Classes.size() > 0 + ? aStack_Classes.top().first + : (ary::cpp::Class *) 0; +} + +inline void +ContextForAry:: +S_OwnerStack::SetOwner_2CurNamespace() +{ + csv_assert( aStack_Namespaces.size() > 0 ); + pOwner_Cur = pOwner_Namespace.MutablePtr(); + pOwner_Namespace->SetAnotherNamespace( CurNamespace() ); +} + +inline void +ContextForAry:: +S_OwnerStack::SetOwner_2CurClass() +{ + csv_assert( aStack_Classes.size() > 0 ); + pOwner_Cur = pOwner_Class.MutablePtr(); + pOwner_Class->SetAnotherClass( *CurClass() ); +} + +ContextForAry:: +S_OwnerStack::S_OwnerStack() + : // aStack_Namespaces, + // aStack_Classes, + pCurEnum(0), + nExternC(0), + pOwner_Namespace(new Owner_Namespace), + pOwner_Class(new Owner_Class), + pOwner_Cur(0) +{ +} + +void +ContextForAry:: +S_OwnerStack::Reset() +{ + while ( aStack_Namespaces.top()->Owner() != 0 ) + aStack_Namespaces.pop(); + while ( NOT aStack_Classes.empty() ) + aStack_Classes.pop(); + pCurEnum = 0; + nExternC = 0; + SetOwner_2CurNamespace(); +} + +inline void +ContextForAry:: +S_OwnerStack::SetGlobalNamespace( ary::cpp::Namespace & io_rGlobalNamespace ) +{ + csv_assert( aStack_Namespaces.size() == 0 ); + aStack_Namespaces.push(&io_rGlobalNamespace); + SetOwner_2CurNamespace(); +} + +ContextForAry:: +S_OwnerStack::~S_OwnerStack() +{ +} + +inline void +ContextForAry:: +S_OwnerStack::OpenNamespace( ary::cpp::Namespace & io_rOpenedNamespace ) +{ + csv_assert( aStack_Namespaces.size() > 0 OR io_rOpenedNamespace.Parent() == 0 ); + aStack_Namespaces.push(&io_rOpenedNamespace); + SetOwner_2CurNamespace(); +} + +inline void +ContextForAry:: +S_OwnerStack::OpenExternC() +{ + ++nExternC; +// SetOwner_2None(); +} + +inline void +ContextForAry:: +S_OwnerStack::SetCurProtection( ary::cpp::E_Protection i_eProtection ) +{ + csv_assert( aStack_Classes.size() > 0 ); + aStack_Classes.top().second = i_eProtection; +} + +inline ary::cpp::Enum * +ContextForAry:: +S_OwnerStack::CurEnum() const +{ + return pCurEnum; +} + + +inline ary::cpp::InputContext::Owner & +ContextForAry:: +S_OwnerStack::CurOwner() const +{ + csv_assert( pOwner_Cur != 0 ); + return *pOwner_Cur; +} + +inline E_Protection +ContextForAry:: +S_OwnerStack::CurProtection() const +{ + return aStack_Classes.size() > 0 + ? aStack_Classes.top().second + : ary::cpp::PROTECT_global; +} + +inline void +ContextForAry:: +S_OwnerStack::SetOwner_2None() +{ + pOwner_Cur = 0; +} + +void +ContextForAry:: +S_OwnerStack::OpenClass( ary::cpp::Class & io_rOpenedClass ) +{ + E_Protection eDefaultProtection + = io_rOpenedClass.ClassKey() == ary::cpp::CK_class + ? ary::cpp::PROTECT_private + : ary::cpp::PROTECT_public; + aStack_Classes.push( ClassEnv(&io_rOpenedClass, eDefaultProtection) ); + SetOwner_2CurClass(); +} + +inline void +ContextForAry:: +S_OwnerStack::OpenEnum( ary::cpp::Enum & io_rOpenedEnum ) +{ + csv_assert( pCurEnum == 0 ); + pCurEnum = &io_rOpenedEnum; + SetOwner_2None(); +} + +void +ContextForAry:: +S_OwnerStack::CloseBlock() +{ + if (nExternC > 0) + { + --nExternC; + } + else + { + csv_assert( aStack_Classes.size() == 0 ); + csv_assert( pCurEnum == 0 ); + aStack_Namespaces.pop(); + csv_assert( aStack_Namespaces.size() > 0 ); + } + SetOwner_2CurNamespace(); +} + +void +ContextForAry:: +S_OwnerStack::CloseClass() +{ + csv_assert( aStack_Classes.size() > 0 ); + aStack_Classes.pop(); + if ( aStack_Classes.size() > 0 ) + SetOwner_2CurClass(); + else + SetOwner_2CurNamespace(); +} + +void +ContextForAry:: +S_OwnerStack::CloseEnum() +{ + csv_assert( pCurEnum != 0 ); + pCurEnum = 0; + if ( aStack_Classes.size() > 0 ) + SetOwner_2CurClass(); + else + SetOwner_2CurNamespace(); +} + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/srecover.hxx b/autodoc/source/parser/cpp/srecover.hxx new file mode 100644 index 000000000000..14755c810fda --- /dev/null +++ b/autodoc/source/parser/cpp/srecover.hxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * $RCSfile: srecover.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_SRECOVER_HXX +#define ADC_CPP_SRECOVER_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "cxt2ary.hxx" +#include <ary/info/docstore.hxx> + // COMPONENTS + // PARAMETERS + +namespace cpp +{ + +/** Implementation struct for cpp::ContextForAry. +*/ +struct ContextForAry::S_RecoveryGuard +{ + public: + S_RecoveryGuard(); + ~S_RecoveryGuard(); + + void Reset() { bIsWithinRecovery = false; nBlockBracketsCounter = 0; } + + void StartWaitingFor_Recovery(); + + void Hdl_SwBracketOpen(); + void Hdl_SwBracketClose(); + void Hdl_Semicolon(); + + bool IsWithinRecovery() const; + + private: + // DATA + bool bIsWithinRecovery; + intt nBlockBracketsCounter; +}; + + + +// IMPLEMENTATION + +/* The implementation is in header, though not all inline, because this file + is included in cxt2ary.cxx only! +*/ + +ContextForAry:: +S_RecoveryGuard::S_RecoveryGuard() + : bIsWithinRecovery(false), + nBlockBracketsCounter(0) +{ +} + +ContextForAry:: +S_RecoveryGuard::~S_RecoveryGuard() +{ +} + +inline void +ContextForAry:: +S_RecoveryGuard::StartWaitingFor_Recovery() +{ + bIsWithinRecovery = true; + nBlockBracketsCounter = 0; +} + +void +ContextForAry:: +S_RecoveryGuard::Hdl_SwBracketOpen() +{ + if ( bIsWithinRecovery ) + ++nBlockBracketsCounter; +} + +void +ContextForAry:: +S_RecoveryGuard::Hdl_SwBracketClose() +{ + if ( bIsWithinRecovery ) + --nBlockBracketsCounter; +} + +inline void +ContextForAry:: +S_RecoveryGuard::Hdl_Semicolon() +{ + if (bIsWithinRecovery AND nBlockBracketsCounter == 0) + bIsWithinRecovery = false; +} + +inline bool +ContextForAry:: +S_RecoveryGuard::IsWithinRecovery() const +{ + return bIsWithinRecovery; +} + + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/cpp/tkp_cpp.cxx b/autodoc/source/parser/cpp/tkp_cpp.cxx new file mode 100644 index 000000000000..309d185ff57e --- /dev/null +++ b/autodoc/source/parser/cpp/tkp_cpp.cxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * $RCSfile: tkp_cpp.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "tkp_cpp.hxx" + +// NOT FULLY DECLARED SERVICES +#include "cx_c_std.hxx" +#include "c_dealer.hxx" + + +namespace cpp { + + + + +TokenParser_Cpp::TokenParser_Cpp( DYN autodoc::TkpDocuContext & let_drDocuContext ) + : pBaseContext( new Context_CppStd( let_drDocuContext ) ), + pCurContext(0), + pDealer(0), + pCharacterSource(0) +{ + SetStartContext(); +} + +TokenParser_Cpp::~TokenParser_Cpp() +{ +} + +void +TokenParser_Cpp::AssignPartners( CharacterSource & io_rCharacterSource, + cpp::Distributor & o_rDealer ) +{ + pDealer = &o_rDealer; + pBaseContext->AssignDealer(o_rDealer); + pCharacterSource = &io_rCharacterSource; +} + +void +TokenParser_Cpp::StartNewFile( const udmstri & i_sFileName, + const csv::ploc::DirectoryChain & i_rFileSubPath ) +{ + csv_assert(pDealer != 0); + pDealer->StartNewFile(i_sFileName, i_rFileSubPath); + + csv_assert(pCharacterSource != 0); + Start(*pCharacterSource); +} + +void +TokenParser_Cpp::SetStartContext() +{ + pCurContext = pBaseContext.Ptr(); +} + +void +TokenParser_Cpp::SetCurrentContext( TkpContext & io_rContext ) +{ + pCurContext = &io_rContext; +} + +TkpContext & +TokenParser_Cpp::CurrentContext() +{ + return *pCurContext; +} + +} // namespace cpp + diff --git a/autodoc/source/parser/cpp/tkp_cpp.hxx b/autodoc/source/parser/cpp/tkp_cpp.hxx new file mode 100644 index 000000000000..6e417cbcefe6 --- /dev/null +++ b/autodoc/source/parser/cpp/tkp_cpp.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * $RCSfile: tkp_cpp.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_TKP_CPP_HXX +#define ADC_TKP_CPP_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkp.hxx> + // COMPONENTS + // PARAMETRS + +namespace autodoc +{ + class TkpDocuContext; +} + +namespace csv +{ + namespace ploc + { + class Path; + class DirectoryChain; + } +} + + +namespace cpp { + +class Context_CppStd; +class DefineDescription; +class Distributor; + + +/** This is a TokenParser which is able to parse tokens from + C++ source code. +*/ +class TokenParser_Cpp : public TokenParser +{ + public: + typedef std::map< udmstri, DefineDescription* > MacroMap; + + // LIFECYCLE + TokenParser_Cpp( + DYN autodoc::TkpDocuContext & + let_drDocuContext ); + virtual ~TokenParser_Cpp(); + + // OPERATIONS + void AssignPartners( + CharacterSource & io_rCharacterSource, + cpp::Distributor & o_rDealer ); + void StartNewFile( + const udmstri & i_sFileName, + const csv::ploc::DirectoryChain & + i_rFileSubPath ); + private: + virtual void SetStartContext(); + virtual void SetCurrentContext( + TkpContext & io_rContext ); + virtual TkpContext & + CurrentContext(); + // DATA + Dyn<Context_CppStd> pBaseContext; + TkpContext * pCurContext; + Distributor * pDealer; + CharacterSource * pCharacterSource; +}; + + +} // namespace cpp + + +#endif + + diff --git a/autodoc/source/parser/cpp/tokintpr.hxx b/autodoc/source/parser/cpp/tokintpr.hxx new file mode 100644 index 000000000000..5b3e7c956bac --- /dev/null +++ b/autodoc/source/parser/cpp/tokintpr.hxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * $RCSfile: tokintpr.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_TOKINTPR_HXX +#define ADC_CPP_TOKINTPR_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <all_toks.hxx> + // COMPONENTS + // PARAMETERS + +namespace cpp { + + + +#define DECL_TOK_HANDLER(token) \ + void Hdl_##token( \ + const Tok_##token & i_rTok ) { Call_Handler(i_rTok); } + +class TokenInterpreter +{ + public: + virtual ~TokenInterpreter() {} + + DECL_TOK_HANDLER(Identifier) + DECL_TOK_HANDLER(Operator) + DECL_TOK_HANDLER(operator) + DECL_TOK_HANDLER(class) + DECL_TOK_HANDLER(struct) + DECL_TOK_HANDLER(union) + DECL_TOK_HANDLER(enum) + DECL_TOK_HANDLER(typedef) + DECL_TOK_HANDLER(public) + DECL_TOK_HANDLER(protected) + DECL_TOK_HANDLER(private) + DECL_TOK_HANDLER(template) + DECL_TOK_HANDLER(virtual) + DECL_TOK_HANDLER(friend) + DECL_TOK_HANDLER(Tilde) + DECL_TOK_HANDLER(const) + DECL_TOK_HANDLER(volatile) + DECL_TOK_HANDLER(extern) + DECL_TOK_HANDLER(static) + DECL_TOK_HANDLER(mutable) + DECL_TOK_HANDLER(register) + DECL_TOK_HANDLER(inline) + DECL_TOK_HANDLER(explicit) + DECL_TOK_HANDLER(namespace) + DECL_TOK_HANDLER(using) + DECL_TOK_HANDLER(throw) + DECL_TOK_HANDLER(SwBracket_Left) + DECL_TOK_HANDLER(SwBracket_Right) + DECL_TOK_HANDLER(ArrayBracket_Left) + DECL_TOK_HANDLER(ArrayBracket_Right) + DECL_TOK_HANDLER(Bracket_Left) + DECL_TOK_HANDLER(Bracket_Right) + DECL_TOK_HANDLER(DoubleColon) + DECL_TOK_HANDLER(Semicolon) + DECL_TOK_HANDLER(Comma) + DECL_TOK_HANDLER(Colon) + DECL_TOK_HANDLER(Assign) + DECL_TOK_HANDLER(Less) + DECL_TOK_HANDLER(Greater) + DECL_TOK_HANDLER(Asterix) + DECL_TOK_HANDLER(AmpersAnd) + DECL_TOK_HANDLER(Ellipse) + DECL_TOK_HANDLER(DefineName) + DECL_TOK_HANDLER(MacroName) + DECL_TOK_HANDLER(MacroParameter) + DECL_TOK_HANDLER(PreProDefinition) + DECL_TOK_HANDLER(BuiltInType) + DECL_TOK_HANDLER(TypeSpecializer) + DECL_TOK_HANDLER(Constant) + + protected: + virtual void Call_Handler( + const cpp::Token & i_rTok ) = 0; +}; + +#undef DECL_TOK_HANDLER + + +// IMPLEMENTATION + + +} // namespace cpp + + +#endif + diff --git a/autodoc/source/parser/inc/adoc/a_rdocu.hxx b/autodoc/source/parser/inc/adoc/a_rdocu.hxx new file mode 100644 index 000000000000..616fa9e72612 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/a_rdocu.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * $RCSfile: a_rdocu.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_ADOC_A_RDOCU_HXX +#define ADC_ADOC_A_RDOCU_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +class DocuDealer; + + + +namespace adoc +{ + +class Token; +class Adoc_PE; + +class DocuExplorer + +{ + public: + DocuExplorer(); + ~DocuExplorer(); + void StartNewFile( + DocuDealer & o_rDocuDistributor ); + + void Process_Token( + DYN adoc::Token & let_drToken ); + private: + DocuDealer * pDocuDistributor; + Dyn<Adoc_PE> pPE; + bool bIsPassedFirstDocu; +}; + + +} // namespace adoc + + +#endif + + diff --git a/autodoc/source/parser/inc/adoc/adoc_tok.hxx b/autodoc/source/parser/inc/adoc/adoc_tok.hxx new file mode 100644 index 000000000000..12e58c58c734 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/adoc_tok.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * $RCSfile: adoc_tok.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_ADOC_ADOC_TOK_HXX +#define ADC_ADOC_ADOC_TOK_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/token.hxx> + // COMPONENTS + // PARAMETERS + + +namespace adoc { + + +class TokenInterpreter; + + +class Token : public TextToken +{ + public: + // LIFECYCLE + virtual ~Token() {} + + // OPERATIONS + virtual void DealOut( + ::TokenDealer & o_rDealer ); + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const = 0; +}; + + +} // namespace adoc + +#endif + + diff --git a/autodoc/source/parser/inc/adoc/atokdeal.hxx b/autodoc/source/parser/inc/adoc/atokdeal.hxx new file mode 100644 index 000000000000..dd9d2ac740d1 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/atokdeal.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * $RCSfile: atokdeal.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_ADOC_ATOKDEAL_HXX +#define ADC_ADOC_ATOKDEAL_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <tokens/tokdeal.hxx> + // COMPONENTS + // PARAMETERS + + + +namespace adoc +{ + +class Token; + +class TokenDealer : public virtual ::TokenDealer +{ + public: + + virtual void Deal_AdcDocu( + adoc::Token & let_drToken ) = 0; +}; + + +} // namespace adoc + + + +#endif + diff --git a/autodoc/source/parser/inc/adoc/cx_a_std.hxx b/autodoc/source/parser/inc/adoc/cx_a_std.hxx new file mode 100644 index 000000000000..4f7b6ac973cc --- /dev/null +++ b/autodoc/source/parser/inc/adoc/cx_a_std.hxx @@ -0,0 +1,139 @@ +/************************************************************************* + * + * $RCSfile: cx_a_std.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_ADOC_CX_A_STD_HXX +#define ADC_ADOC_CX_A_STD_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> + // COMPONENTS +#include <tokens/tkpstama.hxx> + // PARAMETERS + +class TextToken; + + +namespace adoc { + +class Cx_LineStart; +class Cx_CheckStar; +class Cx_AtTagCompletion; + + +/** +@descr +*/ +class Context_AdocStd : public autodoc::TkpDocuContext, + private StateMachineContext +{ + public: + // LIFECYCLE + Context_AdocStd(); + virtual void SetParentContext( + TkpContext & io_rParentContext, + const char * i_sMultiLineEndToken ); + ~Context_AdocStd(); + + // OPERATIONS + virtual void AssignDealer( + TokenDealer & o_rDealer ); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + virtual void SetMode_IsMultiLine( + bool i_bTrue ); + // INQUIRY + virtual TkpContext & + FollowUpContext(); + private: + // SERVICE FUNCTIONS + virtual void PerformStatusFunction( + uintt i_nStatusSignal, + F_CRTOK i_fTokenCreateFunction, + CharacterSource & io_rText ); + + void SetupStateMachine(); + + // DATA + StateMachine aStateMachine; + TokenDealer * pDealer; + + // Contexts + TkpContext * pFollowUpContext; + TkpContext * pParentContext; + Dyn<Cx_LineStart> pCx_LineStart; + Dyn<Cx_CheckStar> pCx_CheckStar; + Dyn<Cx_AtTagCompletion> + pCx_AtTagCompletion; + + // Temporary data, used during ReadCharChain() + Dyn<TextToken> pNewToken; + bool bIsMultiline; +}; + + +} // namespace adoc + + +#endif + diff --git a/autodoc/source/parser/inc/adoc/cx_a_sub.hxx b/autodoc/source/parser/inc/adoc/cx_a_sub.hxx new file mode 100644 index 000000000000..96344a5d3682 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/cx_a_sub.hxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * $RCSfile: cx_a_sub.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_ADOC_CX_A_SUB_HXX +#define ADC_ADOC_CX_A_SUB_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> + // COMPONENTS +#include <tokens/tkpstama.hxx> + // PARAMETERS +#include <tokens/token.hxx> + + +namespace adoc { + + + + +class Cx_LineStart : public TkpContext +{ + public: + Cx_LineStart( + TkpContext & i_rFollowUpContext ); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); + + void SetCurToken( + TextToken::F_CRTOK i_fTokenCreateFunction ) + { fCur_TokenCreateFunction = i_fTokenCreateFunction; } + void AssignDealer( + TokenDealer & o_rDealer ) + { pDealer = &o_rDealer; } + private: + // DATA + TokenDealer * pDealer; + TkpContext * pFollowUpContext; + + Dyn<TextToken> pNewToken; + + TextToken::F_CRTOK fCur_TokenCreateFunction; +}; + + +/** +@descr +*/ + +class Cx_CheckStar : public TkpContext +{ + public: + // LIFECYCLE + Cx_CheckStar( + TkpContext & i_rFollowUpContext ); + void Set_End_FollowUpContext( + TkpContext & i_rEnd_FollowUpContext ) + { pEnd_FollowUpContext = &i_rEnd_FollowUpContext; } + + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + + void SetCanBeEnd( + bool i_bCanBeEnd ) + { bCanBeEnd = i_bCanBeEnd; } + virtual TkpContext & + FollowUpContext(); + void AssignDealer( + TokenDealer & o_rDealer ) + { pDealer = &o_rDealer; } + private: + // DATA + TokenDealer * pDealer; + TkpContext * pFollowUpContext; + TkpContext * pEnd_FollowUpContext; + + Dyn<TextToken> pNewToken; + + bool bCanBeEnd; + bool bEndTokenFound; +}; + + +class Cx_AtTagCompletion : public TkpContext +{ + public: + Cx_AtTagCompletion( + TkpContext & i_rFollowUpContext ); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); + + void SetCurToken( + TextToken::F_CRTOK i_fTokenCreateFunction ) + { fCur_TokenCreateFunction = i_fTokenCreateFunction; } + void AssignDealer( + TokenDealer & o_rDealer ) + { pDealer = &o_rDealer; } + private: + // DATA + TokenDealer * pDealer; + TkpContext * pFollowUpContext; + + Dyn<TextToken> pNewToken; + + TextToken::F_CRTOK fCur_TokenCreateFunction; +}; + + +} // namespace adoc + + +#endif + diff --git a/autodoc/source/parser/inc/adoc/docu_pe.hxx b/autodoc/source/parser/inc/adoc/docu_pe.hxx new file mode 100644 index 000000000000..470a5116cb5e --- /dev/null +++ b/autodoc/source/parser/inc/adoc/docu_pe.hxx @@ -0,0 +1,226 @@ +/************************************************************************* + * + * $RCSfile: docu_pe.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_DOCU_PE_HXX +#define ADC_DOCU_PE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <adoc/tokintpr.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ + class Documentation; + + namespace info + { + class CodeInfo; + class AtTag; + } +} + + + +namespace adoc +{ + + +class Adoc_PE : public TokenInterpreter +{ + public: + Adoc_PE(); + ~Adoc_PE(); + + virtual void Hdl_at_std( + const Tok_at_std & i_rTok ); + virtual void Hdl_at_base( + const Tok_at_base & i_rTok ); + virtual void Hdl_at_exception( + const Tok_at_exception & + i_rTok ); + virtual void Hdl_at_impl( + const Tok_at_impl & i_rTok ); + virtual void Hdl_at_key( + const Tok_at_key & i_rTok ); + virtual void Hdl_at_param( + const Tok_at_param & + i_rTok ); + virtual void Hdl_at_see( + const Tok_at_see & i_rTok ); + virtual void Hdl_at_template( + const Tok_at_template & + i_rTok ); + virtual void Hdl_at_interface( + const Tok_at_interface & + i_rTok ); + virtual void Hdl_at_internal( + const Tok_at_internal & + i_rTok ); + virtual void Hdl_at_obsolete( + const Tok_at_obsolete & + i_rTok ); + virtual void Hdl_at_module( + const Tok_at_module & + i_rTok ); + virtual void Hdl_at_file( + const Tok_at_file & i_rTok ); + virtual void Hdl_at_gloss( + const Tok_at_gloss & + i_rTok ); + virtual void Hdl_at_global( + const Tok_at_global & + i_rTok ); + virtual void Hdl_at_include( + const Tok_at_include & + i_rTok ); + virtual void Hdl_at_label( + const Tok_at_label & + i_rTok ); + virtual void Hdl_at_HTML( + const Tok_at_HTML & + i_rTok ); + virtual void Hdl_at_NOHTML( + const Tok_at_NOHTML & + i_rTok ); + + virtual void Hdl_DocWord( + const Tok_DocWord & i_rTok ); + + virtual void Hdl_Whitespace( + const Tok_Whitespace & + i_rTok ); + virtual void Hdl_LineStart( + const Tok_LineStart & + i_rTok ); + virtual void Hdl_Eol( + const Tok_Eol & i_rTok ); + + virtual void Hdl_EoDocu( + const Tok_EoDocu & i_rTok ); + + + DYN ary::Documentation * + ReleaseJustParsedDocu(); + + bool IsComplete() const; + + private: + void InstallAtTag( + DYN ary::info::AtTag * + let_dpTag, + bool i_bImplicit = false ); /// True for implicit @short and @descr. + ary::info::CodeInfo & + CurDocu(); + ary::info::AtTag & CurAtTag(); + bool UsesHtmlInDocuText(); + + void RenameCurShortTag(); + void FinishCurShortTag(); + + + // DATA + enum E_TagState + { + ts_new, + ts_std + }; + enum E_DocuState + { + ds_wait_for_short = 0, + ds_in_short, + ds_1newline_after_short, + ds_in_descr, + ds_std + }; + + Dyn<ary::info::CodeInfo> + pCurDocu; + ary::info::AtTag * pCurAtTag; + uintt nLineCountInDocu; + UINT8 nCurSpecialMeaningTokens; + UINT8 nCurSubtractFromLineStart; + E_TagState eCurTagState; + E_DocuState eDocuState; + bool bIsComplete; + bool bUsesHtmlInDocuText; +}; + + +// IMPLEMENTATION +inline bool +Adoc_PE::IsComplete() const +{ + return bIsComplete; +} + + +} // namespace adoc + + + + +#endif + + diff --git a/autodoc/source/parser/inc/adoc/prs_adoc.hxx b/autodoc/source/parser/inc/adoc/prs_adoc.hxx new file mode 100644 index 000000000000..ce11dbaf71c5 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/prs_adoc.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * $RCSfile: prs_adoc.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_ADOC_PRS_ADOC_HXX +#define ADC_ADOC_PRS_ADOC_HXX + + + +#include <autodoc/prs_docu.hxx> + +namespace adoc +{ + + +class DocuParser_AutodocStyle : public autodoc::DocumentationParser_Ifc +{ + public: + DocuParser_AutodocStyle(); + virtual ~DocuParser_AutodocStyle(); + + virtual DYN autodoc::TkpDocuContext * + Create_DocuContext() const; +}; + + + +} // namespace adoc + + +#endif + diff --git a/autodoc/source/parser/inc/adoc/tk_attag.hxx b/autodoc/source/parser/inc/adoc/tk_attag.hxx new file mode 100644 index 000000000000..68d19ebfd331 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/tk_attag.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * $RCSfile: tk_attag.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_ADOC_TK_ATTAG_HXX +#define ADC_ADOC_TK_ATTAG_HXX + +// USED SERVICES + // BASE CLASSES +#include <adoc/adoc_tok.hxx> + // COMPONENTS + // PARAMETERS +#include <ary/info/inftypes.hxx> + +namespace adoc { + +typedef ary::info::E_AtTagId E_AtTagId; + + +class Tok_at_std : public Token +{ + public: + Tok_at_std( + E_AtTagId i_nId ) + : eId(i_nId) {} + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; + E_AtTagId Id() const { return eId; } + + private: + E_AtTagId eId; +}; + + +#define DECL_TOKEN_CLASS(name) \ +class Tok_##name : public Token \ +{ public: \ + virtual void Trigger( \ + TokenInterpreter & io_rInterpreter ) const; \ + virtual const char * \ + Text() const; \ +} + + +DECL_TOKEN_CLASS(at_base); +DECL_TOKEN_CLASS(at_exception); +DECL_TOKEN_CLASS(at_impl); +DECL_TOKEN_CLASS(at_key); +DECL_TOKEN_CLASS(at_param); +DECL_TOKEN_CLASS(at_see); +DECL_TOKEN_CLASS(at_template); +DECL_TOKEN_CLASS(at_interface); +DECL_TOKEN_CLASS(at_internal); +DECL_TOKEN_CLASS(at_obsolete); +DECL_TOKEN_CLASS(at_module); +DECL_TOKEN_CLASS(at_file); +DECL_TOKEN_CLASS(at_gloss); +DECL_TOKEN_CLASS(at_global); +DECL_TOKEN_CLASS(at_include); +DECL_TOKEN_CLASS(at_label); +DECL_TOKEN_CLASS(at_HTML); +DECL_TOKEN_CLASS(at_NOHTML); + + +#undef DECL_TOKEN_CLASS + + + +} // namespace adoc + +#endif + diff --git a/autodoc/source/parser/inc/adoc/tk_docw.hxx b/autodoc/source/parser/inc/adoc/tk_docw.hxx new file mode 100644 index 000000000000..c577872c12b9 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/tk_docw.hxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * $RCSfile: tk_docw.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_ADOC_TK_DOCW_HXX +#define ADC_ADOC_TK_DOCW_HXX + +// USED SERVICES + // BASE CLASSES +#include <adoc/adoc_tok.hxx> + // COMPONENTS + // PARAMETERS + +namespace adoc { + + +class Tok_DocWord : public Token +{ + public: + // Spring and Fall + Tok_DocWord( + const char * i_sText ) + : sText(i_sText) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + uintt Length() const { return sText.length(); } + + private: + // DATA + udmstri sText; +}; + +class Tok_Whitespace : public Token +{ + public: + // Spring and Fall + Tok_Whitespace( + UINT8 i_nSize ) + : nSize(i_nSize) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + UINT8 Size() const { return nSize; } + + private: + // DATA + UINT8 nSize; +}; + +class Tok_LineStart : public Token +{ + public: + // Spring and Fall + Tok_LineStart( + UINT8 i_nSize ) + : nSize(i_nSize) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + UINT8 Size() const { return nSize; } + + private: + // DATA + UINT8 nSize; +}; + +class Tok_Eol : public Token +{ public: + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; +}; + +class Tok_EoDocu : public Token +{ public: + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; +}; + + +} // namespace adoc + +#endif + diff --git a/autodoc/source/parser/inc/adoc/tokintpr.hxx b/autodoc/source/parser/inc/adoc/tokintpr.hxx new file mode 100644 index 000000000000..f7ef085432ce --- /dev/null +++ b/autodoc/source/parser/inc/adoc/tokintpr.hxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * $RCSfile: tokintpr.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_ADOC_TOKINTPR_HXX +#define ADC_ADOC_TOKINTPR_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +namespace adoc { + + +class Tok_at_std; +class Tok_at_base; +class Tok_at_exception; +class Tok_at_impl; +class Tok_at_key; +class Tok_at_param; +class Tok_at_see; +class Tok_at_template; +class Tok_at_interface; +class Tok_at_internal; +class Tok_at_obsolete; +class Tok_at_module; +class Tok_at_file; +class Tok_at_gloss; +class Tok_at_global; +class Tok_at_include; +class Tok_at_label; +class Tok_at_HTML; // Sets default to: Use HTML in DocuText +class Tok_at_NOHTML; // Sets default to: Don't use HTML in DocuText + +class Tok_DocWord; +class Tok_LineStart; +class Tok_Whitespace; +class Tok_Eol; +class Tok_EoDocu; + + +#define DECL_TOK_HANDLER(token) \ + virtual void Hdl_##token( \ + const Tok_##token & i_rTok ) = 0 + + + +class TokenInterpreter +{ + public: + virtual ~TokenInterpreter() {} + + DECL_TOK_HANDLER(at_std); + DECL_TOK_HANDLER(at_base); + DECL_TOK_HANDLER(at_exception); + DECL_TOK_HANDLER(at_impl); + DECL_TOK_HANDLER(at_key); + DECL_TOK_HANDLER(at_param); + DECL_TOK_HANDLER(at_see); + DECL_TOK_HANDLER(at_template); + DECL_TOK_HANDLER(at_interface); + DECL_TOK_HANDLER(at_internal); + DECL_TOK_HANDLER(at_obsolete); + DECL_TOK_HANDLER(at_module); + DECL_TOK_HANDLER(at_file); + DECL_TOK_HANDLER(at_gloss); + DECL_TOK_HANDLER(at_global); + DECL_TOK_HANDLER(at_include); + DECL_TOK_HANDLER(at_label); + DECL_TOK_HANDLER(at_HTML); + DECL_TOK_HANDLER(at_NOHTML); + DECL_TOK_HANDLER(DocWord); + DECL_TOK_HANDLER(Whitespace); + DECL_TOK_HANDLER(LineStart); + DECL_TOK_HANDLER(Eol); + DECL_TOK_HANDLER(EoDocu); +}; + +#undef DECL_TOK_HANDLER + + +// IMPLEMENTATION + + +} // namespace adoc + + +#endif + diff --git a/autodoc/source/parser/inc/cpp/ctokdeal.hxx b/autodoc/source/parser/inc/cpp/ctokdeal.hxx new file mode 100644 index 000000000000..594a66721e10 --- /dev/null +++ b/autodoc/source/parser/inc/cpp/ctokdeal.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * $RCSfile: ctokdeal.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_CTOKDEAL_HXX +#define ADC_CPP_CTOKDEAL_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <tokens/tokdeal.hxx> + // COMPONENTS + // PARAMETERS + + +namespace cpp +{ + +class Token; +class Tok_UnblockMacro; + + +class TokenDealer : public virtual ::TokenDealer +{ + public: + + virtual void Deal_CppCode( + cpp::Token & let_drToken ) = 0; + + /** This is to be used only by the internal macro expander + ( ::cpp::PreProcessor ). + These tokens are inserted into the source text temporary to make clear, + where a specific macro replacement ends and therefore the macro's name + becomes valid again. + + @see ::cpp::Tok_UnblockMacro + @see ::cpp::PreProcessor + */ + virtual void Deal_Cpp_UnblockMacro( + Tok_UnblockMacro & let_drToken ) = 0; +}; + + + +} // namespace cpp + + + +#endif + diff --git a/autodoc/source/parser/inc/cpp/prs_cpp.hxx b/autodoc/source/parser/inc/cpp/prs_cpp.hxx new file mode 100644 index 000000000000..aab0aa91aa1a --- /dev/null +++ b/autodoc/source/parser/inc/cpp/prs_cpp.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * $RCSfile: prs_cpp.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_PRS_CPP_HXX +#define ADC_CPP_PRS_CPP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <autodoc/prs_code.hxx> + // COMPONENTS + // PARAMETERS + +namespace cpp +{ + +struct S_RunningData; + +class Cpluplus_Parser : public autodoc::CodeParser_Ifc +{ + public: + Cpluplus_Parser(); + virtual ~Cpluplus_Parser(); + + + virtual void Setup( + ary::Repository & o_rRepository, + const autodoc::DocumentationParser_Ifc & + i_rDocumentationInterpreter ); + + virtual void Run( + const udmstri & i_sProjectName, + csv::ploc::Path & i_rProjectRootDirectory, + const autodoc::FileCollector_Ifc & + i_rFiles ); + private: + Dyn<S_RunningData> pRunningData; +}; + + +} // namespace cpp + + +#endif + + diff --git a/autodoc/source/parser/inc/doc_deal.hxx b/autodoc/source/parser/inc/doc_deal.hxx new file mode 100644 index 000000000000..b01428a6d02a --- /dev/null +++ b/autodoc/source/parser/inc/doc_deal.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * $RCSfile: doc_deal.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_DOC_DEAL_HXX +#define ADC_DOC_DEAL_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <tokens/tokproct.hxx> + // COMPONENTS + // PARAMETERS +#include <ary/cpp/c_etypes.hxx> + +namespace ary +{ + class Documentation; +} + + + +class DocuDealer +{ + public: + // INQUIRY + virtual ~DocuDealer() {} + + // OPERATIONS + /** @descr + This distributes the let_drDocu to the matching ary::RepositoryEntity . + + If the docu is not inline, it will be saved and later given to the next + ary::CodeEntity. Or it will be discarded, if there does not come a matching + ary::CodeEntity . + + If the docu is inline after a function header or after an enum value + or after a function parameter or after a base class, it will be stored + together with the matching function, enum value, parameter or base class. + + If the documentation is @file or @project or @glos(sary) it will be + stored at the matching ary::cpp::FileGroup, ary::cpp::ProjectGroup + or ary::Glossary. + */ + void TakeDocu( + DYN ary::Documentation & + let_drInfo ); + private: + virtual void do_TakeDocu( + DYN ary::Documentation & + let_drInfo ) = 0; +}; + + + +// IMPLEMENTATION + +inline void +DocuDealer::TakeDocu( DYN ary::Documentation & let_drInfo ) + { do_TakeDocu(let_drInfo); } + + + + +#endif + diff --git a/autodoc/source/parser/inc/semantic/callf.hxx b/autodoc/source/parser/inc/semantic/callf.hxx new file mode 100644 index 000000000000..b8a8a86678c2 --- /dev/null +++ b/autodoc/source/parser/inc/semantic/callf.hxx @@ -0,0 +1,328 @@ +/************************************************************************* + * + * $RCSfile: callf.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_CALLF_HXX +#define ADC_CPP_CALLF_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <cosv/template/inc_stl.hxx> + // COMPONENTS + // PARAMETERS + + + + + +/** This represents a function to be called, if a specific kind of token + arrives in the semantic parser. + + @descr This class is only to be used as member of PeStatus<PE>. + @template PE + The owning ParseEnvironment. + @see PeStatus, ParseEnvironment +*/ +template <class PE> +class CallFunction +{ + public: + typedef void (PE::*F_Tok)(const char *); + + CallFunction( + F_Tok i_f2Call, + INT16 i_nTokType ); + + F_Tok GetF() const; + INT16 TokType() const; + + private: + // DATA + F_Tok f2Call; + INT16 nTokType; +}; + + +/** One state within a ParseEnvironment. + + @template PE + The owning ParseEnvironment. +*/ +template <class PE> +class PeStatus +{ + public: + typedef CallFunction<PE>::F_Tok F_Tok; + + PeStatus( + PE & i_rMyPE, + uintt i_nSize, + F_Tok * i_pFuncArray, + INT16 * i_pTokTypeArray, + F_Tok i_pDefault ); + ~PeStatus(); + + virtual void Call_Handler( + INT16 i_nTokTypeId, + const char * i_sTokenText ) const; + + private: + bool CheckForCall( + uintt i_nPos, + INT16 i_nTokTypeId, + const char * i_sTokenText ) const; + + PE * pMyPE; + std::vector< CallFunction<PE> > + aBranches; + F_Tok fDefault; +}; + + +template <class PE> +class PeStatusArray +{ + public: + typedef typename PE::E_State State; + + PeStatusArray(); + void InsertState( + State i_ePosition, + DYN PeStatus<PE> & let_drState ); + ~PeStatusArray(); + + const PeStatus<PE> & + operator[]( + State i_ePosition ) const; + + void SetCur( + State i_eCurState ); + const PeStatus<PE> & + Cur() const; + + private: + DYN PeStatus<PE> * aStati[PE::size_of_states]; + State eState; +}; + + + +// IMPLEMENTATION + + +// CallFunction + +template <class PE> +CallFunction<PE>::CallFunction( F_Tok i_f2Call, + INT16 i_nTokType ) + : f2Call(i_f2Call), + nTokType(i_nTokType) +{ +} + +template <class PE> +inline CallFunction<PE>::F_Tok +CallFunction<PE>::GetF() const +{ + return f2Call; +} + +template <class PE> +inline INT16 +CallFunction<PE>::TokType() const +{ + return nTokType; +} + + + +// PeStatus + +template <class PE> +PeStatus<PE>::PeStatus( PE & i_rMyPE, + uintt i_nSize, + F_Tok * i_pFuncArray, + INT16 * i_pTokTypeArray, + F_Tok i_fDefault ) + : pMyPE(&i_rMyPE), + fDefault(i_fDefault) +{ + aBranches.reserve(i_nSize); + for ( uintt i = 0; i < i_nSize; ++i ) + { + csv_assert(i > 0 ? i_pTokTypeArray[i] > i_pTokTypeArray[i-1] : true); + aBranches.push_back( CallFunction<PE>( i_pFuncArray[i], i_pTokTypeArray[i]) ); + } // end for +} + +template <class PE> +PeStatus<PE>::~PeStatus() +{ + +} + +template <class PE> +void +PeStatus<PE>::Call_Handler( INT16 i_nTokTypeId, + const char * i_sTokenText ) const +{ + uintt nSize = aBranches.size(); + uintt nPos = nSize / 2; + + if ( i_nTokTypeId < aBranches[nPos].TokType() ) + { + for ( --nPos; intt(nPos) >= 0; --nPos ) + { + if (CheckForCall(nPos, i_nTokTypeId, i_sTokenText)) + return; + } + } + else + { + for ( nPos; nPos < nSize; ++nPos ) + { + if (CheckForCall(nPos, i_nTokTypeId, i_sTokenText)) + return; + } + } + + (pMyPE->*fDefault)(i_sTokenText); +} + +template <class PE> +bool +PeStatus<PE>::CheckForCall( uintt i_nPos, + INT16 i_nTokTypeId, + const char * i_sTokenText ) const +{ + if ( aBranches[i_nPos].TokType() == i_nTokTypeId ) + { + (pMyPE->*aBranches[i_nPos].GetF())(i_sTokenText); + return true; + } + return false; +} + +// PeStatusArray + +template <class PE> +PeStatusArray<PE>::PeStatusArray() + : eState(PE::size_of_states) +{ + memset(aStati, 0, sizeof aStati); +} + +template <class PE> +void +PeStatusArray<PE>::InsertState( State i_ePosition, + DYN PeStatus<PE> & let_drState ) +{ + csv_assert(aStati[i_ePosition] == 0); + aStati[i_ePosition] = &let_drState; +} + +template <class PE> +PeStatusArray<PE>::~PeStatusArray() +{ + int i_max = PE::size_of_states; + for (int i = 0; i < i_max; i++) + { + delete aStati[i]; + } // end for +} + +template <class PE> +inline const PeStatus<PE> & +PeStatusArray<PE>::operator[]( State i_ePosition ) const +{ + csv_assert( uintt(i_ePosition) < PE::size_of_states ); + csv_assert( aStati[i_ePosition] != 0 ); + return *aStati[i_ePosition]; +} + +template <class PE> +inline void +PeStatusArray<PE>::SetCur( State i_eCurState ) +{ + eState = i_eCurState; +} + + +template <class PE> +const PeStatus<PE> & +PeStatusArray<PE>::Cur() const +{ + return (*this)[eState]; +} + +#define SEMPARSE_CREATE_STATUS(penv, state, default_function) \ + pStati->InsertState( state, \ + *new PeStatus<penv>( \ + *this, \ + sizeof( stateT_##state ) / sizeof (INT16), \ + stateF_##state, \ + stateT_##state, \ + &penv::default_function ) ) + + +#endif + diff --git a/autodoc/source/parser/inc/semantic/parseenv.hxx b/autodoc/source/parser/inc/semantic/parseenv.hxx new file mode 100644 index 000000000000..e1696fd70d4d --- /dev/null +++ b/autodoc/source/parser/inc/semantic/parseenv.hxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * $RCSfile: parseenv.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_PARSEENV_HXX +#define ADC_PARSEENV_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <tokens/tokproct.hxx> + // COMPONENTS + // PARAMETERS + + +namespace ary +{ +namespace info +{ +class CodeInfo; +} // namespace info +} // namespace ary) + + + +class SubPeUseIfc; + + +class ParseEnvironment : protected TokenProcessing_Types +{ + public: + virtual ~ParseEnvironment() {} + + // Parsing + void Enter( + E_EnvStackAction i_eWayOfEntering ); + void Leave( + E_EnvStackAction i_eWayOfLeaving ); + void SetCurSPU( + const SubPeUseIfc * i_pCurSPU ); + + ParseEnvironment * Parent() const; + + + // ACCESS + protected: + ParseEnvironment( + ParseEnvironment * i_pParent ); + const SubPeUseIfc * CurSubPeUse() const; + void GlobalHandlingOfSyntaxError( + const char * i_sTokenText, + const char * i_sFileName, + uintt i_nLineCount ); + + private: + virtual void InitData() = 0; + virtual void TransferData() = 0; + + ParseEnvironment * pParent; + const SubPeUseIfc * pCurSubPe; +}; + +class SubPeUseIfc +{ + public: + virtual ~SubPeUseIfc() {} + + virtual void InitParse() const = 0; + virtual void GetResults() const = 0; +}; + + + +// IMPLEMENTATION + +inline void +ParseEnvironment::SetCurSPU( const SubPeUseIfc * i_pCurSPU ) + { pCurSubPe = i_pCurSPU; } + +inline ParseEnvironment * +ParseEnvironment::Parent() const + { return pParent; } + +inline const SubPeUseIfc * +ParseEnvironment::CurSubPeUse() const + { return pCurSubPe; } + + + +#endif + diff --git a/autodoc/source/parser/inc/semantic/sub_pe.hxx b/autodoc/source/parser/inc/semantic/sub_pe.hxx new file mode 100644 index 000000000000..20dde677de6c --- /dev/null +++ b/autodoc/source/parser/inc/semantic/sub_pe.hxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * $RCSfile: sub_pe.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_SUB_PE_HXX +#define ADC_CPP_SUB_PE_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + + +class ParseEnvironment; + +template <class PE, class SUB> +class SubPe +{ + public: + typedef SubPe< PE, SUB > self; + + SubPe( + PE & i_rParent ); + PE & Parent() const; + SUB & Child() const; + + ParseEnvironment & Get() const; + + private: + SUB & CreateChild() const; + + PE & rParent; + Dyn<SUB> pChild; +}; + + + +// IMPLEMENTATION + + +// SubPe + +template <class PE, class SUB> +SubPe<PE,SUB>::SubPe( PE & i_rParent ) + : rParent(i_rParent) +{ +} + +template <class PE, class SUB> +PE & +SubPe<PE,SUB>::Parent() const +{ + return rParent; +} + +template <class PE, class SUB> +inline SUB & +SubPe<PE,SUB>::Child() const +{ + return pChild ? *pChild.MutablePtr() : CreateChild(); +} + +template <class PE, class SUB> +ParseEnvironment & +SubPe<PE,SUB>::Get() const +{ + return Child(); +} + +template <class PE, class SUB> +SUB & +SubPe<PE,SUB>::CreateChild() const +{ + self * pThis = const_cast< self* >(this); + + SUB * pNewChild = new SUB( &rParent); + + pThis->pChild = pNewChild; + + return *pChild.MutablePtr(); +} + + + + +#endif + diff --git a/autodoc/source/parser/inc/semantic/sub_peu.hxx b/autodoc/source/parser/inc/semantic/sub_peu.hxx new file mode 100644 index 000000000000..8dff8ae5f997 --- /dev/null +++ b/autodoc/source/parser/inc/semantic/sub_peu.hxx @@ -0,0 +1,165 @@ +/************************************************************************* + * + * $RCSfile: sub_peu.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_SUB_PEU_HXX +#define ADC_CPP_SUB_PEU_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <semantic/parseenv.hxx> +#include <tokens/tokproct.hxx> + // COMPONENTS + // PARAMETERS +#include <semantic/sub_pe.hxx> + + + +template <class PE, class SUB> +class SubPeUse : public SubPeUseIfc, + private TokenProcessing_Types +{ + public: + typedef void (PE::*F_INIT)(); + typedef void (PE::*F_RETURN)(); + + SubPeUse( + SubPe<PE,SUB> & i_rSubPeCreator, + F_INIT i_fInit, + F_RETURN i_fReturn ); + ~SubPeUse(); + + void Push( + E_TokenDone i_eDone ); + virtual void InitParse() const; + virtual void GetResults() const; + + PE & Parent() const; + SUB & Child() const; + + private: + // DATA + SubPe<PE,SUB> & rSubPeCreator; + F_INIT fInit; + F_RETURN fReturn; +}; + + +// IMPLEMENTATION + + +template <class PE, class SUB> +SubPeUse<PE,SUB>::SubPeUse( SubPe<PE,SUB> & i_rSubPeCreator, + F_INIT i_fInit, + F_RETURN i_fReturn ) + : rSubPeCreator(i_rSubPeCreator), + fInit(i_fInit), + fReturn(i_fReturn) +{ +} + +template <class PE, class SUB> +SubPeUse<PE,SUB>::~SubPeUse() +{ +} + +template <class PE, class SUB> +void +SubPeUse<PE,SUB>::Push( E_TokenDone i_eDone ) +{ + Parent().SetTokenResult( i_eDone, push, &rSubPeCreator.Get() ); + Parent().SetCurSPU(this); +} + +template <class PE, class SUB> +void +SubPeUse<PE,SUB>::InitParse() const +{ + if (fInit != 0) + (Parent().*fInit)(); +} + +template <class PE, class SUB> +void +SubPeUse<PE,SUB>::GetResults() const +{ + if (fReturn != 0) + (Parent().*fReturn)(); +} + +template <class PE, class SUB> +inline PE & +SubPeUse<PE,SUB>::Parent() const +{ + return rSubPeCreator.Parent(); +} + +template <class PE, class SUB> +inline SUB & +SubPeUse<PE,SUB>::Child() const +{ + return rSubPeCreator.Child(); +} + + +#endif + diff --git a/autodoc/source/parser/inc/tokens/parseinc.hxx b/autodoc/source/parser/inc/tokens/parseinc.hxx new file mode 100644 index 000000000000..329fa5e76319 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/parseinc.hxx @@ -0,0 +1,237 @@ +/************************************************************************* + * + * $RCSfile: parseinc.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_PARSEINC_HXX +#define ADC_PARSEINC_HXX + + +#include <tools/tkpchars.hxx> + +inline char +jumpOver( CharacterSource & io_rText, + char in_c ) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + cNext == in_c; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpTo( CharacterSource & io_rText, + char in_c ) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + cNext != in_c AND cNext != 0; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpTo( CharacterSource & io_rText, + char in_c1, + char in_c2 ) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + cNext != in_c1 AND cNext != in_c2 AND cNext != 0; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpTo( CharacterSource & io_rText, + char in_c1, + char in_c2, + char in_c3 ) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + cNext != in_c1 AND cNext != in_c2 AND cNext != in_c3 AND cNext != 0; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpTo( CharacterSource & io_rText, + char in_c1, + char in_c2, + char in_c3, + char in_c4 ) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + cNext != in_c1 AND cNext != in_c2 AND cNext != in_c3 + AND cNext != in_c4 AND cNext != 0; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpOverWhite(CharacterSource & io_rText) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + static_cast<UINT8>(cNext) < 33 + AND cNext != 0 AND cNext != 13 AND cNext != 10; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpToWhite(CharacterSource & io_rText) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + static_cast<UINT8>(cNext) > 32; + cNext = io_rText.MoveOn() ) + { } + + return cNext; +} + +inline char +jumpToEol(CharacterSource & io_rText, int & o_rCount_BackslashedLineBreaks ) +{ + o_rCount_BackslashedLineBreaks = 0; + char cNext; + for ( cNext = io_rText.CurChar(); + cNext != 13 AND cNext != 10 AND cNext != NULCH; + cNext = io_rText.MoveOn() ) + { + if ( cNext == '\\') + { + cNext = io_rText.MoveOn(); + if ( cNext == 13 ) + io_rText.MoveOn(); + if ( cNext == 10 ) + ++o_rCount_BackslashedLineBreaks; + } + } + return cNext; +} + +inline char +jumpToEol(CharacterSource & io_rText) +{ + char cNext; + for ( cNext = io_rText.CurChar(); + cNext != 13 AND cNext != 10 AND cNext != NULCH; + cNext = io_rText.MoveOn() ) + { + if ( cNext == '\\') + io_rText.MoveOn(); + } + return cNext; +} + +inline char +jumpOverEol(CharacterSource & io_rText) +{ + char cNext = io_rText.CurChar(); + + if (cNext == 13) + io_rText.MoveOn(); + if (cNext == 10) + io_rText.MoveOn(); + return cNext; +} + + +inline char // Finds a matching closing bracket after the opening one is passed +jumpToMatchingBracket( CharacterSource & io_rText, + char in_cBegin, + char in_cEnd ) +{ + intt nCounter = 1; + char cNext; + for ( cNext = io_rText.CurChar(); + nCounter - (cNext == in_cEnd ? 1 : 0) > 0 AND cNext != NULCH; + cNext = io_rText.MoveOn() ) + { + if (cNext == in_cEnd) + nCounter++; + else if (cNext == in_cBegin) + nCounter--; + } + + return cNext; +} + + + + +#endif + diff --git a/autodoc/source/parser/inc/tokens/stmstarr.hxx b/autodoc/source/parser/inc/tokens/stmstarr.hxx new file mode 100644 index 000000000000..72a857c8c1d2 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/stmstarr.hxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * $RCSfile: stmstarr.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_STMSTARR_HXX +#define ADC_STMSTARR_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/stmstate.hxx> + // COMPONENTS + // PARAMETERS +#include <tokens/token.hxx> + + +class StmArrayStatus : public StmStatus +{ + public: + typedef TextToken::F_CRTOK F_CRTOK; + + // LIFECYCLE + StmArrayStatus( + intt i_nStatusSize, + const INT16 * in_aArrayModel, + F_CRTOK i_fTokenCreateFunction, + bool in_bIsDefault ); + ~StmArrayStatus(); + + // INQUIRY + StmStatus::Branch NextBy( + intt in_nFollowersIndex) const; + F_CRTOK TokenCreateFunction() const + { return fTokenCreateFunction; } + virtual bool IsADefault() const; + + // ACCESS + virtual StmArrayStatus * + AsArray(); + void SetBranches( + intt in_nStartBranchIx, + StmStatus::Branch * in_aBranchValues, + intt in_nNrofValues ); + bool SetBranch( + intt in_nBranchIx, + StmStatus::Branch in_nBranch ); + void SetTokenCreateFunction( + F_CRTOK i_fTokenCreateFunction ); + private: + StmStatus::Branch * dpBranches; + intt nNrOfBranches; + F_CRTOK fTokenCreateFunction; + bool bIsADefault; +}; + + +// IMPLEMENTATION + +inline void +StmArrayStatus::SetTokenCreateFunction( F_CRTOK i_fTokenCreateFunction ) + { fTokenCreateFunction = i_fTokenCreateFunction; } + + + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/stmstate.hxx b/autodoc/source/parser/inc/tokens/stmstate.hxx new file mode 100644 index 000000000000..9e01626d4d7b --- /dev/null +++ b/autodoc/source/parser/inc/tokens/stmstate.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * $RCSfile: stmstate.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_STMSTATE_HXX +#define ADC_STMSTATE_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +class StmArrayStatus; +class StmBoundsStatus; + +/** A StmStatus is a state within a StateMachine. + There are two kinds of it. Either its an array of pointers to + other states within the state machine - an ArrayStatus. + + Or it is a BoundsStatus, which shows, the token cannot be + followed further within the StateMachine. +**/ +class StmStatus // := "State machine status" +{ + public: + typedef intt Branch; /// Values >= 0 give a next #Status' ID. + /// Values <= 0 tell, that a token is finished. + /// a value < 0 returns the status back to an upper level state machine. + // LIFECYCLE + virtual ~StmStatus() {} + + // OPERATIONS + virtual StmArrayStatus * + AsArray(); + virtual StmBoundsStatus * + AsBounds(); + + // INQUIRY + virtual bool IsADefault() const = 0; +}; + + + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/stmstfin.hxx b/autodoc/source/parser/inc/tokens/stmstfin.hxx new file mode 100644 index 000000000000..e7aef86b4e6f --- /dev/null +++ b/autodoc/source/parser/inc/tokens/stmstfin.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * $RCSfile: stmstfin.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_STMSTFIN_HXX +#define ADC_STMSTFIN_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/stmstate.hxx> + // COMPONENTS + // PARAMETERS + + +class TkpContext; +class StateMachineContext; + +/** +**/ +class StmBoundsStatus : public StmStatus +{ + public: + // LIFECYCLE + StmBoundsStatus( + StateMachineContext & + o_rOwner, + TkpContext & i_rFollowUpContext, + uintt i_nStatusFunctionNr, + bool i_bIsDefault ); + // INQUIRY + TkpContext * FollowUpContext(); + uintt StatusFunctionNr() const; + virtual bool IsADefault() const; + + // ACCESS + virtual StmBoundsStatus * + AsBounds(); + + private: + StateMachineContext * + pOwner; + TkpContext * pFollowUpContext; + uintt nStatusFunctionNr; + bool bIsDefault; +}; + +inline TkpContext * +StmBoundsStatus::FollowUpContext() + { return pFollowUpContext; } +inline uintt +StmBoundsStatus::StatusFunctionNr() const + { return nStatusFunctionNr; } + + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/tkp.hxx b/autodoc/source/parser/inc/tokens/tkp.hxx new file mode 100644 index 000000000000..2786046351f4 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tkp.hxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * $RCSfile: tkp.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_TKP_HXX +#define ADC_TKP_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +class CharacterSource; +class TkpContext; + // PARAMETRS + + + +/** This is the interface for parser classes, which get a sequence of tokens from + a text. + + Start() starts to parse the text from the given i_rSource. + GetNextToken() returns a Token on the heap as long as there are + still characters in the text left. This can be checked by + HasMore(). + + The algorithms for parsing tokens from the text are an issue of + the derived classes. +*/ +#if 0 +/** + Parsing can be interrupted for a different source by PushSource(). + The parsing before interruption is continued after PopSource(). +*/ +#endif // 0 + +class TokenParser +{ + public: + // LIFECYCLE + TokenParser(); + virtual ~TokenParser() {} + + // OPERATIONS + /** Start parsing a character source. Any previously parsed sources + are discarded. + */ + virtual void Start( + CharacterSource & + i_rSource ); + + /** @short Gets the next identifiable token out of the + source code. + */ + void GetNextToken(); + + /// @return true, if there are more tokens to parse. + bool HasMore() const { return bHasMore; } + + private: + void InitSource( + CharacterSource & + i_rSource ); + + virtual void SetStartContext() = 0; + virtual void SetCurrentContext( + TkpContext & io_rContext ) = 0; + virtual TkpContext & + CurrentContext() = 0; + // DATA + CharacterSource * pChars; + bool bHasMore; +}; + + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/tkpcontx.hxx b/autodoc/source/parser/inc/tokens/tkpcontx.hxx new file mode 100644 index 000000000000..0a04bdeadcca --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tkpcontx.hxx @@ -0,0 +1,172 @@ +/************************************************************************* + * + * $RCSfile: tkpcontx.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_TKPCONTX_HXX +#define ADC_TKPCONTX_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +#include <tokens/token.hxx> +class CharacterSource; +class TkpNullContext; + +/** @task + Specifies a context within which tokens are interpreted in a special + way. For example in parsing C++ there could be a context for code, + one for comments and a third one for preprocessor statements, because + each of these would give the same token different meanings. + + The three functions + ReadCharChain() + PassNewToken() + FollowUpContext() + have to be called in this sequence. + +**/ +class TkpContext +{ + public: + // LIFECYCLE + virtual ~TkpContext() {} + + // OPERATIONS + /** @descr + The functions starts to parse with the CurChar() of io_rText. + It leaves io_rText.CurChar() at the first char of the following Token or + the following Context. + + This function returns, when a context has parsed some characterss + and completed a token OR left the context. + If the token is to be ignored, it is cut from io_rText. + + If the token is to be parsed further in a different context, + it is NOT cut from io_rText. + + After this function PassNewToken() has to be called. + + If the function has found a valid and complete token, PassNewToken() + passes the parsed token to the internally known receiver and + returns true. The token is cut from io_rText. + **/ + virtual void ReadCharChain( + CharacterSource & io_rText ) = 0; + /** Has to pass the parsed token to a known receiver. + If the token is to be parsed further in a different context, + PassNewToken() returns false, but the token is NOT cut from io_rText. + + @return true, if a token was passed. + false, if the token was not parsed completely by this context + or if the token is to be ignored. + */ + virtual bool PassNewToken() = 0; + virtual TkpContext & + FollowUpContext() = 0; + + static TkpNullContext & + Null_(); +}; + +class StateMachineContext +{ + public: + typedef TextToken::F_CRTOK F_CRTOK; + + /// Is used by StmBoundsStatus only. + virtual void PerformStatusFunction( + uintt i_nStatusSignal, + F_CRTOK i_fTokenCreateFunction, + CharacterSource & io_rText ) = 0; +}; + +class TkpNullContext : public TkpContext +{ + public: + ~TkpNullContext(); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); +}; + +namespace autodoc +{ + +class TkpDocuContext : public TkpContext +{ + public: + virtual void SetParentContext( + TkpContext & io_rParentContext, + const char * i_sMultiLineEndToken ) = 0; + virtual void AssignDealer( + TokenDealer & o_rDealer ) = 0; + virtual void SetMode_IsMultiLine( + bool i_bTrue ) = 0; +}; + +} // namespace autodoc + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/tkpstama.hxx b/autodoc/source/parser/inc/tokens/tkpstama.hxx new file mode 100644 index 000000000000..c2dbb00b24ee --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tkpstama.hxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * $RCSfile: tkpstama.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_TKPSTAMA_HXX +#define ADC_TKPSTAMA_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcontx.hxx> + // COMPONENTS +#include <tokens/stmstarr.hxx> +#include <tokens/stmstfin.hxx> + +/** @descr + This state-machine models state transitions from one state to another + per indices of branches. If the indices represent ascii-char-values, + the state-machine can be used for recognising tokens of text. + + The state-machine can be a status itself. + + StateMachine needs the array-size of all stati as a guess, how many stati + the state machine will contain, when at work. + + +**/ +class StateMachine +{ + public: + // Types + typedef StmStatus::Branch Branch; + typedef StmStatus * * StatusList; + + //# Interface self + // LIFECYCLE + StateMachine( + intt in_nStatusSize, + intt in_nInitial_StatusListSize ); /// The user of the constructor should guess + /// the approximate number of stati here to + /// avoid multiple reallocations. + /// @#AddStatus + intt AddStatus( /// @return the new #Status' ID + DYN StmStatus * let_dpStatus); + /// @#AddToken + void AddToken( + const char * in_sToken, + TextToken::F_CRTOK in_fTokenCreateFunction, + const INT16 * in_aBranches, + INT16 in_nBoundsStatus ); + ~StateMachine(); + + + // FOR TESTS ONLY: + void PrintOut(); + + // OPERATIONS + StmBoundsStatus & + GetCharChain( + TextToken::F_CRTOK & + o_nTokenCreateFunction, + CharacterSource & io_rText ); + private: + // SERVICE FUNCTIONS + StmStatus & Status( + intt in_nStatusNr) const; + StmArrayStatus & + CurrentStatus() const; + StmBoundsStatus * + BoundsStatus() const; + + /// Sets the PeekedStatus. + void Peek( + intt in_nBranch); + + void ResizeStati(); // Adds space for 32 stati. + + // DATA + StatusList pStati; /// List of Status, implemented as simple C-array of length #nStatiSpace + /// with nStatiLength valid members (beginning from zero). + intt nCurrentStatus; + intt nPeekedStatus; + + intt nStatusSize; /// Size of the branch array of a single status. + + intt nNrofStati; /// Nr of Stati so far. + intt nStatiSpace; /// Size of allocated array for #pStati (size in items). +}; + + + +/** @#AddToken + @descr + Adds a token, which will be recogniszeds by the + statemachine. + + +**/ + + + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/tokdeal.hxx b/autodoc/source/parser/inc/tokens/tokdeal.hxx new file mode 100644 index 000000000000..81f9df33bdc7 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tokdeal.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * $RCSfile: tokdeal.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_TOKDEAL_HXX +#define ADC_TOKDEAL_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + + +class TokenDealer + +{ + public: + virtual ~TokenDealer() {} + + virtual void Deal_Eol() = 0; + virtual void Deal_Eof() = 0; +}; + + +#if 0 +class TokenDealer + +{ + public: + virtual void Deal_IdlCode( + idl::Token & let_drToken ); + virtual void Deal_UdkDocu( + udoc::Token & let_drToken ); + virtual void Deal_JavaCode( + java::Token & let_drToken ); + virtual void Deal_SBasicCode( + sbasic::Token & let_drToken ); +}; + +#endif // 0 + + + +#endif + diff --git a/autodoc/source/parser/inc/tokens/token.hxx b/autodoc/source/parser/inc/tokens/token.hxx new file mode 100644 index 000000000000..b054f84b7239 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/token.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * $RCSfile: token.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_TOKEN_HXX +#define ADC_TOKEN_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETRS + + +class TokenDealer; + +/** +*/ +class TextToken +{ + public: + typedef TextToken * (*F_CRTOK)(const char*); + + // LIFECYCLE + virtual ~TextToken() {} + + + // INQUIRY + virtual const char* Text() const = 0; + + virtual void DealOut( + ::TokenDealer & o_rDealer ) = 0; +}; + +class Tok_Eof : public TextToken +{ + virtual void DealOut( // Implemented in tokdeal.cxx + TokenDealer & o_rDealer ); + virtual const char* Text() const; +}; + +#endif + + diff --git a/autodoc/source/parser/inc/tokens/tokproct.hxx b/autodoc/source/parser/inc/tokens/tokproct.hxx new file mode 100644 index 000000000000..118d4fe508f1 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tokproct.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * $RCSfile: tokproct.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_CPP_TOKPROCT_HXX +#define ADC_CPP_TOKPROCT_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + + +class ParseEnvironment; + +/** is a parent class for classes, which take part in parsing tokens semantically. + It provides some types for them. +*/ +class TokenProcessing_Types +{ + public: + enum E_TokenDone + { + not_done = 0, + done = 1 + }; + + enum E_EnvStackAction + { + stay, // same parse environment + push, // push sub environment + pop_success, // return to parent environment, parsing was successful + pop_failure // return to parent environment, but an error occured. + }; + + struct TokenProcessing_Result + { + E_TokenDone eDone; + E_EnvStackAction eStackAction; + ParseEnvironment * pEnv2Push; + + TokenProcessing_Result() + : eDone(not_done), eStackAction(stay), pEnv2Push(0) {} + void Reset() { eDone = not_done; eStackAction = stay; pEnv2Push = 0; } + }; + + enum E_ParseResult + { + res_error, + res_complete, + res_predeclaration + }; +}; + + + +#endif + diff --git a/autodoc/source/parser/inc/x_parse.hxx b/autodoc/source/parser/inc/x_parse.hxx new file mode 100644 index 000000000000..afbd72f1a323 --- /dev/null +++ b/autodoc/source/parser/inc/x_parse.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * $RCSfile: x_parse.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:32 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_X_PARSE_HXX +#define ADC_X_PARSE_HXX + +// USED SERVICES + // BASE CLASSES +#include <autodoc/x_parsing.hxx> + // COMPONENTS + // PARAMETERS + + +class X_Parser : public autodoc::X_Parser_Ifc +{ + public: + // LIFECYCLE + X_Parser( + E_Event i_eEvent, + const char * i_sObject, + const udmstri & i_sCausingFile_FullPath, + uintt i_nCausingLineNr ); + ~X_Parser(); + // INQUIRY + virtual E_Event GetEvent() const; + virtual void GetInfo( + ostream & o_rOutputMedium ) const; + + private: + E_Event eEvent; + udmstri sObject; + udmstri sCausingFile_FullPath; + uintt nCausingLineNr; + +}; + +#endif + diff --git a/autodoc/source/parser/kernel/makefile.mk b/autodoc/source/parser/kernel/makefile.mk new file mode 100644 index 000000000000..3350ef003b92 --- /dev/null +++ b/autodoc/source/parser/kernel/makefile.mk @@ -0,0 +1,92 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=parser_kernel +TARGETTYPE=CUI + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/parsefct.obj \ + $(OBJ)$/x_parse.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser/kernel/parsefct.cxx b/autodoc/source/parser/kernel/parsefct.cxx new file mode 100644 index 000000000000..b541fe76e14d --- /dev/null +++ b/autodoc/source/parser/kernel/parsefct.cxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * $RCSfile: parsefct.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include "parsefct.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <cpp/prs_cpp.hxx> +#include <adoc/prs_adoc.hxx> +#include <tools/filecoll.hxx> + + +DYN ParseToolsFactory * ParseToolsFactory::dpTheInstance_ = 0; + + +namespace autodoc +{ + +ParseToolsFactory_Ifc & +ParseToolsFactory_Ifc::GetIt_() +{ + if ( ParseToolsFactory::dpTheInstance_ == 0 ) + ParseToolsFactory::dpTheInstance_ = new ParseToolsFactory; + return *ParseToolsFactory::dpTheInstance_; +} + +} // namespace autodoc + + +ParseToolsFactory::ParseToolsFactory() +{ +} + +ParseToolsFactory::~ParseToolsFactory() +{ +} + +DYN autodoc::CodeParser_Ifc * +ParseToolsFactory::Create_Parser_Cplusplus() const +{ + return new cpp::Cpluplus_Parser; +} + +DYN autodoc::DocumentationParser_Ifc * +ParseToolsFactory::Create_DocuParser_AutodocStyle() const +{ + return new adoc::DocuParser_AutodocStyle; +} + +DYN autodoc::FileCollector_Ifc * +ParseToolsFactory::Create_FileCollector( uintt i_nEstimatedNrOfFiles ) const +{ + return new FileCollector(i_nEstimatedNrOfFiles); +} + + diff --git a/autodoc/source/parser/kernel/parsefct.hxx b/autodoc/source/parser/kernel/parsefct.hxx new file mode 100644 index 000000000000..0b9eda3e58fc --- /dev/null +++ b/autodoc/source/parser/kernel/parsefct.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * $RCSfile: parsefct.hxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef ADC_PARSER_PARSEFCT_HXX +#define ADC_PARSER_PARSEFCT_HXX + + +#include <autodoc/parsing.hxx> + + +/** Interface for parsing code of a programming language and + delivering the information into an Autodoc Repository. +**/ +class ParseToolsFactory : public autodoc::ParseToolsFactory_Ifc +{ + public: + ParseToolsFactory(); + virtual ~ParseToolsFactory(); + + virtual DYN autodoc::CodeParser_Ifc * + Create_Parser_Cplusplus() const; + virtual DYN autodoc::DocumentationParser_Ifc * + Create_DocuParser_AutodocStyle() const; + virtual DYN autodoc::FileCollector_Ifc * + Create_FileCollector( + uintt i_nEstimatedNrOfFiles ) const; + private: + static DYN ParseToolsFactory * + dpTheInstance_; + + friend class autodoc::ParseToolsFactory_Ifc; +}; + + +#endif + diff --git a/autodoc/source/parser/kernel/x_parse.cxx b/autodoc/source/parser/kernel/x_parse.cxx new file mode 100644 index 000000000000..100f98cd65cd --- /dev/null +++ b/autodoc/source/parser/kernel/x_parse.cxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * $RCSfile: x_parse.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <x_parse.hxx> + +// NOT FULLY DECLARED SERVICES + + + +X_Parser::X_Parser( E_Event i_eEvent, + const char * i_sObject, + const udmstri & i_sCausingFile_FullPath, + uintt i_nCausingLineNr ) + : eEvent(i_eEvent), + sObject(i_sObject), + sCausingFile_FullPath(i_sCausingFile_FullPath), + nCausingLineNr(i_nCausingLineNr) +{ +} + +X_Parser::~X_Parser() +{ +} + +X_Parser::E_Event +X_Parser::GetEvent() const +{ + return eEvent; +} + +void +X_Parser::GetInfo( ostream & o_rOutputMedium ) const +{ + o_rOutputMedium << "Error in file " + << sCausingFile_FullPath + << " in line " + << nCausingLineNr + << ": "; + + + switch (eEvent) + { + case x_InvalidChar: + o_rOutputMedium << "Unknown character '" + << sObject + << "'"; + break; + case x_UnexpectedToken: + o_rOutputMedium << "Unexpected token \"" + << sObject + << "\""; + break; + case x_UnexpectedEOF: + o_rOutputMedium << "Unexpected end of file."; + break; + case x_UnspecifiedSyntaxError: + o_rOutputMedium << "Unspecified syntax error."; + break; + case x_Any: + default: + o_rOutputMedium << "Unspecified parsing exception."; + } // end switch + o_rOutputMedium << Endl(); +} + + +ostream & +operator<<( ostream & o_rOut, + const autodoc::X_Parser_Ifc & i_rException ) +{ + i_rException.GetInfo(o_rOut); + return o_rOut; +} + diff --git a/autodoc/source/parser/semantic/makefile.mk b/autodoc/source/parser/semantic/makefile.mk new file mode 100644 index 000000000000..f3f7be8a9fdf --- /dev/null +++ b/autodoc/source/parser/semantic/makefile.mk @@ -0,0 +1,93 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=parser_semantic + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + + +OBJFILES= \ + $(OBJ)$/parseenv.obj + + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser/semantic/parseenv.cxx b/autodoc/source/parser/semantic/parseenv.cxx new file mode 100644 index 000000000000..6627ca57d713 --- /dev/null +++ b/autodoc/source/parser/semantic/parseenv.cxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * $RCSfile: parseenv.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <semantic/parseenv.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/info/codeinfo.hxx> +#include <x_parse.hxx> + + +void +ParseEnvironment::Enter( E_EnvStackAction i_eWayOfEntering ) +{ + switch (i_eWayOfEntering) + { + case push: + InitData(); + if ( Parent() != 0 ) + { + csv_assert( Parent()->CurSubPeUse() != 0 ); + Parent()->CurSubPeUse()->InitParse(); + } + break; + case pop_success: + break; + case pop_failure: + break; + default: + csv_assert(false); + } // end switch +} + +void +ParseEnvironment::Leave( E_EnvStackAction i_eWayOfLeaving ) +{ + switch (i_eWayOfLeaving) + { + case push: + break; + case pop_success: + TransferData(); + if ( Parent() != 0 ) + { + csv_assert( Parent()->CurSubPeUse() != 0 ); + Parent()->CurSubPeUse()->GetResults(); + } + break; + case pop_failure: + break; + default: + csv_assert(false); + } // end switch +} + +ParseEnvironment::ParseEnvironment( ParseEnvironment * i_pParent ) + : pParent(i_pParent), + // pDocu, + pCurSubPe(0) +{ +} + +void +ParseEnvironment::GlobalHandlingOfSyntaxError( const char * i_sTokenText, + const char * i_sFileName, + uintt i_nLineCount ) +{ + throw X_Parser( X_Parser::x_UnexpectedToken, + i_sTokenText, + i_sFileName, + i_nLineCount ); +} + + + diff --git a/autodoc/source/parser/tokens/makefile.mk b/autodoc/source/parser/tokens/makefile.mk new file mode 100644 index 000000000000..730c74b435cc --- /dev/null +++ b/autodoc/source/parser/tokens/makefile.mk @@ -0,0 +1,97 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1.1.1 $ +# +# last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=garden +TARGET=parser_tokens +TARGETTYPE=CUI + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/stmstarr.obj \ + $(OBJ)$/stmstate.obj \ + $(OBJ)$/stmstfin.obj \ + $(OBJ)$/tkpstama.obj \ + $(OBJ)$/tkp.obj \ + $(OBJ)$/tkpcontx.obj \ + $(OBJ)$/tokdeal.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser/tokens/stmstarr.cxx b/autodoc/source/parser/tokens/stmstarr.cxx new file mode 100644 index 000000000000..e00e49dca17e --- /dev/null +++ b/autodoc/source/parser/tokens/stmstarr.cxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * $RCSfile: stmstarr.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <tokens/stmstarr.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <x_parse.hxx> + + + +StmArrayStatus::StmArrayStatus( intt i_nStatusSize, + const INT16 * in_aArrayModel, + F_CRTOK i_fTokenCreateFunction, + bool in_bIsDefault ) + : dpBranches(new StmStatus::Branch[i_nStatusSize]), + nNrOfBranches(i_nStatusSize), + fTokenCreateFunction(i_fTokenCreateFunction), + bIsADefault(in_bIsDefault) +{ + if (in_aArrayModel != 0) + { + intt count = 0; + for (const INT16 * get = in_aArrayModel; count < nNrOfBranches; count++, get++) + dpBranches[count] = *get; + } + else // + { + memset(dpBranches, 0, nNrOfBranches); + } // endif +} + +StmArrayStatus::~StmArrayStatus() +{ + delete [] dpBranches; +} + +void +StmArrayStatus::SetBranches( intt in_nStartBranchIx, + StmStatus::Branch * in_aBranchValues, + intt in_nNrofValues ) +{ + precond(in_nStartBranchIx >= 0); + precond(in_aBranchValues != 0); + precond( in_nNrofValues > 0 + AND in_nStartBranchIx + in_nNrofValues <= nNrOfBranches ); + + memcpy(&dpBranches[in_nStartBranchIx],in_aBranchValues,in_nNrofValues); +} + + + +bool +StmArrayStatus::SetBranch( intt in_nBranchIx, + StmStatus::Branch in_nBranch ) +{ + if ( csv::in_range(intt(0), in_nBranchIx, intt(nNrOfBranches) ) ) + { + dpBranches[in_nBranchIx] = in_nBranch; + return true; + } + return false; +} + + +StmStatus::Branch +StmArrayStatus::NextBy(intt in_nIndex) const +{ + if (in_nIndex < 0) + throw X_Parser(X_Parser::x_InvalidChar, "", udmstri::Null_(), 0); + + return in_nIndex < nNrOfBranches + ? dpBranches[in_nIndex] + : dpBranches[nNrOfBranches - 1]; +} + + +bool +StmArrayStatus::IsADefault() const +{ + return bIsADefault; +} + +StmArrayStatus * +StmArrayStatus::AsArray() +{ + return this; +} + diff --git a/autodoc/source/parser/tokens/stmstate.cxx b/autodoc/source/parser/tokens/stmstate.cxx new file mode 100644 index 000000000000..9b1523c7e636 --- /dev/null +++ b/autodoc/source/parser/tokens/stmstate.cxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * $RCSfile: stmstate.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <tokens/stmstate.hxx> + + +// NOT FULLY DECLARED SERVICES + +StmArrayStatus * +StmStatus::AsArray() +{ + return 0; +} + +StmBoundsStatus * +StmStatus::AsBounds() +{ + return 0; +} + + diff --git a/autodoc/source/parser/tokens/stmstfin.cxx b/autodoc/source/parser/tokens/stmstfin.cxx new file mode 100644 index 000000000000..2dbff7817708 --- /dev/null +++ b/autodoc/source/parser/tokens/stmstfin.cxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * $RCSfile: stmstfin.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:33 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <tokens/stmstfin.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <tokens/tkpcontx.hxx> + + +StmBoundsStatus::StmBoundsStatus( StateMachineContext & + o_rOwner, + TkpContext & i_rFollowUpContext, + uintt i_nStatusFunctionNr, + bool i_bIsDefault ) + : pOwner(&o_rOwner), + pFollowUpContext(&i_rFollowUpContext), + nStatusFunctionNr(i_nStatusFunctionNr), + bIsDefault(i_bIsDefault) +{ +} + +bool +StmBoundsStatus::IsADefault() const +{ + return bIsDefault; +} + +StmBoundsStatus * +StmBoundsStatus::AsBounds() +{ + return this; +} + + + diff --git a/autodoc/source/parser/tokens/tkp.cxx b/autodoc/source/parser/tokens/tkp.cxx new file mode 100644 index 000000000000..b2991c12e8f9 --- /dev/null +++ b/autodoc/source/parser/tokens/tkp.cxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * $RCSfile: tkp.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:34 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <tokens/tkp.hxx> + +// NOT FULLY DECLARED SERVICES +#include <tools/tkpchars.hxx> +#include <tokens/tkpcontx.hxx> + + + +TokenParser::TokenParser() + : pChars(0), + bHasMore(false) +{ +} + +void +TokenParser::Start( CharacterSource & i_rSource ) +{ + InitSource(i_rSource); +} + +void +TokenParser::GetNextToken() +{ + csv_assert(pChars != 0); + + bHasMore = NOT pChars->IsFinished(); + + for ( bool bDone = NOT bHasMore; NOT bDone; ) + { + CurrentContext().ReadCharChain(*pChars); + bDone = CurrentContext().PassNewToken(); + SetCurrentContext(CurrentContext().FollowUpContext()); + } +} + +void +TokenParser::InitSource( CharacterSource & i_rSource ) +{ + pChars = &i_rSource; + bHasMore = true; + SetStartContext(); +} + + diff --git a/autodoc/source/parser/tokens/tkpcontx.cxx b/autodoc/source/parser/tokens/tkpcontx.cxx new file mode 100644 index 000000000000..e74c384dc812 --- /dev/null +++ b/autodoc/source/parser/tokens/tkpcontx.cxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * $RCSfile: tkpcontx.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:34 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <tokens/tkpcontx.hxx> + +// NOT FULLY DECLARED SERVICES + + + +TkpNullContext G_aNullContext; + +TkpNullContext & +TkpContext::Null_() +{ + return G_aNullContext; +} + +TkpNullContext::~TkpNullContext() +{ +} + +void +TkpNullContext::ReadCharChain( CharacterSource & ) +{ +} + +bool +TkpNullContext::PassNewToken() +{ + return false; +} + +TkpContext & +TkpNullContext::FollowUpContext() +{ + return *this; +} + + + + + + diff --git a/autodoc/source/parser/tokens/tkpstama.cxx b/autodoc/source/parser/tokens/tkpstama.cxx new file mode 100644 index 000000000000..901e8370506a --- /dev/null +++ b/autodoc/source/parser/tokens/tkpstama.cxx @@ -0,0 +1,239 @@ +/************************************************************************* + * + * $RCSfile: tkpstama.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:34 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <tokens/tkpstama.hxx> + +// NOT FULLY DECLARED SERVICES +// #include <srcfind.hxx> +#include <tokens/stmstarr.hxx> +//#include <parseinc.hxx> +#include <tools/tkpchars.hxx> + + +const intt C_nStatuslistResizeValue = 32; +const intt C_nTopStatus = 0; + +StateMachine::StateMachine( intt in_nStatusSize, + intt in_nInitial_StatusListSize ) + : pStati(new StmStatus*[in_nInitial_StatusListSize]), + nCurrentStatus(C_nTopStatus), + nPeekedStatus(C_nTopStatus), + nStatusSize(in_nStatusSize), + nNrofStati(0), + nStatiSpace(in_nInitial_StatusListSize) +{ + precond(in_nStatusSize > 0); + precond(in_nInitial_StatusListSize > 0); + + memset(pStati, 0, sizeof(StmStatus*) * nStatiSpace); +} + +intt +StateMachine::AddStatus(StmStatus * let_dpStatus) +{ + if (nNrofStati == nStatiSpace) + { + ResizeStati(); + } + pStati[nNrofStati] = let_dpStatus; + return nNrofStati++; +} + +void +StateMachine::AddToken( const char * in_sToken, + TextToken::F_CRTOK in_fTokenCreateFunction, + const INT16 * in_aBranches, + INT16 in_nBoundsStatus ) +{ + if (csv::no_str(in_sToken)) + return; + + // Durch existierende Stati durchhangeln: + nCurrentStatus = 0; + nPeekedStatus = 0; + + for ( const char * pChar = in_sToken; + *pChar != NULCH; + ++pChar ) + { + Peek(*pChar); + StmStatus & rPst = Status(nPeekedStatus); + if ( rPst.IsADefault() OR rPst.AsBounds() != 0 ) + { + nPeekedStatus = AddStatus( new StmArrayStatus(nStatusSize, in_aBranches, 0, false ) ); + CurrentStatus().SetBranch( *pChar, nPeekedStatus ); + } + nCurrentStatus = nPeekedStatus; + } // end for + StmArrayStatus & rLastStatus = CurrentStatus(); + rLastStatus.SetTokenCreateFunction(in_fTokenCreateFunction); + for (intt i = 0; i < nStatusSize; i++) + { + if (Status(rLastStatus.NextBy(i)).AsBounds() != 0) + rLastStatus.SetBranch(i,in_nBoundsStatus); + } // end for +} + +StateMachine::~StateMachine() +{ + for (intt i = 0; i < nNrofStati; i++) + { + delete pStati[i]; + } + delete [] pStati; +} + +StmBoundsStatus & +StateMachine::GetCharChain( TextToken::F_CRTOK & o_nTokenCreateFunction, + CharacterSource & io_rText ) +{ + nCurrentStatus = C_nTopStatus; + Peek(io_rText.CurChar()); + while (BoundsStatus() == 0) + { + nCurrentStatus = nPeekedStatus; + Peek(io_rText.MoveOn()); + } + o_nTokenCreateFunction = CurrentStatus().TokenCreateFunction(); + + return *BoundsStatus(); +} + +void +StateMachine::ResizeStati() +{ + intt nNewSize = nStatiSpace + C_nStatuslistResizeValue; + intt i = 0; + StatusList pNewStati = new StmStatus*[nNewSize]; + + for ( ; i < nNrofStati; i++) + { + pNewStati[i] = pStati[i]; + } + memset( pNewStati+i, + 0, + (nNewSize-i) * sizeof(StmStatus*) ); + + delete [] pStati; + pStati = pNewStati; + nStatiSpace = nNewSize; +} + +StmStatus & +StateMachine::Status(intt in_nStatusNr) const +{ + csv_assert( csv::in_range(intt(0), in_nStatusNr, intt(nNrofStati)) ); + return *pStati[in_nStatusNr]; +} + +StmArrayStatus & +StateMachine::CurrentStatus() const +{ + StmArrayStatus * pCurSt = Status(nCurrentStatus).AsArray(); + if(pCurSt == 0) + csv_assert(false); + return *pCurSt; +} + +StmBoundsStatus * +StateMachine::BoundsStatus() const +{ + return Status(nPeekedStatus).AsBounds(); +} + +void +StateMachine::Peek(intt in_nBranch) +{ + StmArrayStatus & rSt = CurrentStatus(); + nPeekedStatus = rSt.NextBy(in_nBranch); +} + +void +StateMachine::PrintOut() +{ + const anzahl = nNrofStati; + for (int i = 0; i < anzahl; i++) + { + Cout() << i << ':'; + StmArrayStatus * pArrSt = pStati[i]->AsArray(); + if (pArrSt != 0) + { + Cout() << Endl(); + for (int b = 0; b < 128; b++) + { + Cout().width(4); + Cout() << pArrSt->NextBy(b); + if (b%16 == 15) + Cout() << Endl(); + } + } + else if (pStati[i]->AsBounds() != 0) + { + Cout() << "Bounds "; + } + else + Cout() << "Error! "; + Cout() << (pStati[i]->IsADefault() ? "DEF" : "---") + << Endl(); + } // for +} + diff --git a/autodoc/source/parser/tokens/tokdeal.cxx b/autodoc/source/parser/tokens/tokdeal.cxx new file mode 100644 index 000000000000..36474e9d28a2 --- /dev/null +++ b/autodoc/source/parser/tokens/tokdeal.cxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * $RCSfile: tokdeal.cxx,v $ + * + * $Revision: 1.1.1.1 $ + * + * last change: $Author: np $ $Date: 2002-03-08 14:45:34 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <precomp.h> +#include <tokens/tokdeal.hxx> +#include <tokens/token.hxx> + + +// NOT FULLY DEFINED SERVICES + + + +void +Tok_Eof::DealOut( TokenDealer & o_rDealer ) +{ + o_rDealer.Deal_Eof(); +}; + +const char * +Tok_Eof::Text() const +{ + return ""; +} + + + |