diff options
Diffstat (limited to 'autodoc/source/parser/inc')
29 files changed, 3038 insertions, 0 deletions
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..a58b80da1ec9 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/a_rdocu.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..dc1d372d99b3 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/adoc_tok.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..b3e98dba2d0d --- /dev/null +++ b/autodoc/source/parser/inc/adoc/atokdeal.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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 : virtual public ::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..b0f9bb0ce881 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/cx_a_std.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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 * pParentContext; + TkpContext * pFollowUpContext; + 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..e447ce416c65 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/cx_a_sub.hxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..166eeb02fd24 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/docu_pe.hxx @@ -0,0 +1,192 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DOCU_PE_HXX +#define ADC_DOCU_PE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <adoc/tokintpr.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ +namespace doc +{ + class OldCppDocu; +} +namespace info +{ + 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_since( + const Tok_at_since & + 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::doc::OldCppDocu * + ReleaseJustParsedDocu(); + + bool IsComplete() const; + + private: + void InstallAtTag( + DYN ary::info::AtTag * + let_dpTag, + bool i_bImplicit = false ); /// True for implicit @short and @descr. + ary::doc::OldCppDocu & + 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::doc::OldCppDocu> + 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..ac4758be371f --- /dev/null +++ b/autodoc/source/parser/inc/adoc/prs_adoc.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..f5f87a4c21cc --- /dev/null +++ b/autodoc/source/parser/inc/adoc/tk_attag.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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); +DECL_TOKEN_CLASS(at_since); + + +#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..dc20a63a4332 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/tk_docw.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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 + String 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..6c2ff2bc0204 --- /dev/null +++ b/autodoc/source/parser/inc/adoc/tokintpr.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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_since; +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_since); + 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..676bb8b40240 --- /dev/null +++ b/autodoc/source/parser/inc/cpp/ctokdeal.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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 : virtual public ::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..1b324eeebd18 --- /dev/null +++ b/autodoc/source/parser/inc/cpp/prs_cpp.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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 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..5ff17ee2264d --- /dev/null +++ b/autodoc/source/parser/inc/doc_deal.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DOC_DEAL_HXX +#define ADC_DOC_DEAL_HXX + +// BASE CLASSES +#include <tokens/tokproct.hxx> +// USED SERVICES +#include <ary/cpp/c_types4cpp.hxx> + +namespace ary +{ +namespace doc +{ + class OldCppDocu; +} +} + + + + +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::doc::OldCppDocu & + let_drInfo ); + private: + virtual void do_TakeDocu( + DYN ary::doc::OldCppDocu & + let_drInfo ) = 0; +}; + + + + +// IMPLEMENTATION +inline void +DocuDealer::TakeDocu( DYN ary::doc::OldCppDocu & 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..a76da81e280c --- /dev/null +++ b/autodoc/source/parser/inc/semantic/callf.hxx @@ -0,0 +1,287 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_CPP_CALLF_HXX +#define ADC_CPP_CALLF_HXX + +// USED SERVICES + + + + +/** 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 typename CallFunction<PE>::F_Tok F_Tok; + + PeStatus( + PE & i_rMyPE, + uintt i_nSize, + F_Tok * i_pFuncArray, + INT16 * i_pTokTypeArray, + F_Tok i_pDefault ); + virtual ~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 typename 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 < 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..d6ba3daf661a --- /dev/null +++ b/autodoc/source/parser/inc/semantic/parseenv.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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; + 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..84775f2e9425 --- /dev/null +++ b/autodoc/source/parser/inc/semantic/sub_pe.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..c939f295c373 --- /dev/null +++ b/autodoc/source/parser/inc/semantic/sub_peu.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..c1a20a2a11e3 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/parseinc.hxx @@ -0,0 +1,203 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..d95ac2b6aa1c --- /dev/null +++ b/autodoc/source/parser/inc/tokens/stmstarr.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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(); + 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..59c40733de74 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/stmstate.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..67e8e4525f5a --- /dev/null +++ b/autodoc/source/parser/inc/tokens/stmstfin.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..6623230e9603 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tkp.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..becc5c356051 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tkpcontx.hxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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; + + virtual ~StateMachineContext() {} + + /// 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..47d443275e8f --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tkpstama.hxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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(); + + + // 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..0ab4155a42e3 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tokdeal.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_TOKDEAL_HXX +#define ADC_TOKDEAL_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +namespace cpp +{ + class Distributor; +} + + +class TokenDealer + +{ + public: + virtual ~TokenDealer() {} + + virtual void Deal_Eol() = 0; + virtual void Deal_Eof() = 0; + virtual cpp::Distributor * + AsDistributor() = 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..82d70b066fdf --- /dev/null +++ b/autodoc/source/parser/inc/tokens/token.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..940b7482ff8c --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tokproct.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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_docu.hxx b/autodoc/source/parser/inc/x_docu.hxx new file mode 100644 index 000000000000..bc75b96f5743 --- /dev/null +++ b/autodoc/source/parser/inc/x_docu.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_X_DOCU_HXX +#define ADC_X_DOCU_HXX + +// BASE CLASSES +#include <autodoc/x_parsing.hxx> + + + + +class X_Docu : public autodoc::X_Parser_Ifc +{ + public: + // LIFECYCLE + X_Docu( + const char * i_tag, + const char * i_explanation ); + ~X_Docu(); + // INQUIRY + virtual E_Event GetEvent() const; + virtual void GetInfo( + std::ostream & o_rOutputMedium ) const; + + private: + String sTagName; + String sExplanation; +}; + + + + +#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..7ccfa80056e7 --- /dev/null +++ b/autodoc/source/parser/inc/x_parse.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_X_PARSE_HXX +#define ADC_X_PARSE_HXX + +// BASE CLASSES +#include <autodoc/x_parsing.hxx> + + + + +class X_Parser : public autodoc::X_Parser_Ifc +{ + public: + // LIFECYCLE + X_Parser( + E_Event i_eEvent, + const char * i_sObject, + const String & i_sCausingFile_FullPath, + uintt i_nCausingLineNr ); + ~X_Parser(); + // INQUIRY + virtual E_Event GetEvent() const; + virtual void GetInfo( + std::ostream & o_rOutputMedium ) const; + + private: + E_Event eEvent; + String sObject; + String sCausingFile_FullPath; + uintt nCausingLineNr; + +}; + + + + +#endif |