diff options
Diffstat (limited to 'autodoc/source/parser_i/inc/tokens')
-rw-r--r-- | autodoc/source/parser_i/inc/tokens/stmstar2.hxx | 83 | ||||
-rw-r--r-- | autodoc/source/parser_i/inc/tokens/stmstat2.hxx | 68 | ||||
-rw-r--r-- | autodoc/source/parser_i/inc/tokens/stmstfi2.hxx | 80 | ||||
-rw-r--r-- | autodoc/source/parser_i/inc/tokens/tkp2.hxx | 84 | ||||
-rw-r--r-- | autodoc/source/parser_i/inc/tokens/tkpcont2.hxx | 123 | ||||
-rw-r--r-- | autodoc/source/parser_i/inc/tokens/tkpstam2.hxx | 121 | ||||
-rw-r--r-- | autodoc/source/parser_i/inc/tokens/token2.hxx | 63 |
7 files changed, 622 insertions, 0 deletions
diff --git a/autodoc/source/parser_i/inc/tokens/stmstar2.hxx b/autodoc/source/parser_i/inc/tokens/stmstar2.hxx new file mode 100644 index 000000000000..9e248a3538a8 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/stmstar2.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_STMSTAR2_HXX +#define ADC_STMSTAR2_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/stmstat2.hxx> + // COMPONENTS + // PARAMETERS + // SERVICES + + +class StmArrayStatu2 : public StmStatu2 +{ + public: + // LIFECYCLE + StmArrayStatu2( + intt i_nStatusSize, + const INT16 * in_aArrayModel, + uintt i_nTokenId, + bool in_bIsDefault ); + ~StmArrayStatu2(); + + // INQUIRY + StmStatu2::Branch NextBy( + intt in_nFollowersIndex) const; + UINT16 TokenId() const { return nTokenId; } + virtual bool IsADefault() const; + + // ACCESS + virtual StmArrayStatu2 * + AsArray(); + bool SetBranch( + intt in_nBranchIx, + StmStatu2::Branch + in_nBranch ); + void SetTokenId( + UINT16 in_nTokenId ); + private: + StmStatu2::Branch * dpBranches; + intt nNrOfBranches; + UINT16 nTokenId; + bool bIsADefault; +}; + + +// IMPLEMENTATION + +inline void +StmArrayStatu2::SetTokenId( UINT16 in_nTokenId ) + { nTokenId = in_nTokenId; } + + + +#endif + + diff --git a/autodoc/source/parser_i/inc/tokens/stmstat2.hxx b/autodoc/source/parser_i/inc/tokens/stmstat2.hxx new file mode 100644 index 000000000000..7117d7202df4 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/stmstat2.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_STMSTAT2_HXX +#define ADC_STMSTAT2_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +class StmArrayStatu2; +class StmBoundsStatu2; + +/** A StmStatu2 is a state within a StateMachin2. + 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 StateMachin2. +**/ +class StmStatu2 // := "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 ~StmStatu2() {} + + // OPERATIONS + virtual StmArrayStatu2 * + AsArray(); + virtual StmBoundsStatu2 * + AsBounds(); + + // INQUIRY + virtual bool IsADefault() const = 0; +}; + + + +#endif + + diff --git a/autodoc/source/parser_i/inc/tokens/stmstfi2.hxx b/autodoc/source/parser_i/inc/tokens/stmstfi2.hxx new file mode 100644 index 000000000000..dc50159ff0cf --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/stmstfi2.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_STMSTFI2_HXX +#define ADC_STMSTFI2_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/stmstat2.hxx> + // COMPONENTS + // PARAMETERS + + +class TkpContext; +class StateMachineContext; + +/** +**/ +class StmBoundsStatu2 : public StmStatu2 +{ + public: + // LIFECYCLE + StmBoundsStatu2( + StateMachineContext & + o_rOwner, + TkpContext & i_rFollowUpContext, + uintt i_nStatusFunctionNr, + bool i_bIsDefault ); + // INQUIRY + TkpContext * FollowUpContext(); + uintt StatusFunctionNr() const; + virtual bool IsADefault() const; + + // ACCESS + virtual StmBoundsStatu2 * + AsBounds(); + + private: + StateMachineContext * + pOwner; + TkpContext * pFollowUpContext; + uintt nStatusFunctionNr; + bool bIsDefault; +}; + +inline TkpContext * +StmBoundsStatu2::FollowUpContext() + { return pFollowUpContext; } +inline uintt +StmBoundsStatu2::StatusFunctionNr() const + { return nStatusFunctionNr; } + + +#endif + + diff --git a/autodoc/source/parser_i/inc/tokens/tkp2.hxx b/autodoc/source/parser_i/inc/tokens/tkp2.hxx new file mode 100644 index 000000000000..5f3be22d0147 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/tkp2.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * 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_TKP2_HXX +#define ADC_TKP2_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +class CharacterSource; +class TkpContext; + // PARAMETRS + + + +/** This is the interface for parser classes, which get a sequence of Token s 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. The last time GetNextToken() + returns NULL. + + The algorithms for parsing tokens from the text are an issue of + the derived classes. +*/ +class TokenParse2 +{ + public: + // LIFECYCLE + TokenParse2(); + virtual ~TokenParse2() {} + + // OPERATIONS + virtual void Start( + CharacterSource & + i_rSource ); + + /** @short Gets the next identifiable token out of the + source code. + @return true, if there was passed a valid token. + false, if the parsed stream is finished or + an error occured. + */ + bool GetNextToken(); + + private: + virtual void SetStartContext() = 0; + virtual void SetCurrentContext( + TkpContext & io_rContext ) = 0; + virtual TkpContext & + CurrentContext() = 0; + // DATA + CharacterSource * pChars; +}; + + +#endif + + diff --git a/autodoc/source/parser_i/inc/tokens/tkpcont2.hxx b/autodoc/source/parser_i/inc/tokens/tkpcont2.hxx new file mode 100644 index 000000000000..96f92030b9de --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/tkpcont2.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_TKPCONT2_HXX +#define ADC_TKPCONT2_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +class CharacterSource; +class TkpNullContext; +class TkpNullContex2; + +/** @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. +**/ +class TkpContext +{ + public: + // LIFECYCLE + virtual ~TkpContext() {} + + // OPERATIONS + /** @descr + The functions starts to parse with the CurToken() of io_rText. + It leaves io_rText 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, PassNewToken() returns false + and cuts the token from io_rText. + If the token is to be parsed further in a different context, + PassNewToken() returns false, but the token is + NOT cut from io_rText. + + 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. + @return true, if a token was passed. + false, if no token was parsed complete by this context. + */ + virtual bool PassNewToken() = 0; + virtual TkpContext & + FollowUpContext() = 0; + + static TkpNullContext & + Null_(); +}; + +TkpNullContex2 & TkpContext_Null2_(); + +class StateMachineContext +{ + public: + virtual ~StateMachineContext() {} + + /// Is used by StmBoundsStatu2 only. + virtual void PerformStatusFunction( + uintt i_nStatusSignal, + UINT16 i_nTokenId, + CharacterSource & io_rText ) = 0; +}; + +class TkpNullContex2 : public TkpContext +{ + public: + ~TkpNullContex2(); + + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); +}; + +class TkpDocuContext : public TkpContext +{ + public: + virtual void SetParentContext( + TkpContext & io_rParentContext, + const char * i_sMultiLineEndToken ) = 0; + virtual void SetMode_IsMultiLine( + bool i_bTrue ) = 0; +}; + + + +#endif + + diff --git a/autodoc/source/parser_i/inc/tokens/tkpstam2.hxx b/autodoc/source/parser_i/inc/tokens/tkpstam2.hxx new file mode 100644 index 000000000000..e6f76f7ee552 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/tkpstam2.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * 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_TKPSTAM2_HXX +#define ADC_TKPSTAM2_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcont2.hxx> + // COMPONENTS +#include <tokens/stmstar2.hxx> +#include <tokens/stmstfi2.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. + + StateMachin2 needs the array-size of all stati as a guess, how many stati + the state machine will contain, when at work. + + +**/ +class StateMachin2 +{ + public: + // Types + typedef StmStatu2::Branch Branch; + typedef StmStatu2 * * StatusList; + + //# Interface self + // LIFECYCLE + StateMachin2( + 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 StmStatu2 * let_dpStatus); + /// @#AddToken + void AddToken( + const char * in_sToken, + UINT16 in_nTokenId, + const INT16 * in_aBranches, + INT16 in_nBoundsStatus ); + ~StateMachin2(); + + // OPERATIONS + StmBoundsStatu2 & + GetCharChain( + UINT16 & o_nTokenId, + CharacterSource & io_rText ); + private: + // SERVICE FUNCTIONS + StmStatu2 & Status( + intt in_nStatusNr) const; + StmArrayStatu2 & + CurrentStatus() const; + StmBoundsStatu2 * + 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_i/inc/tokens/token2.hxx b/autodoc/source/parser_i/inc/tokens/token2.hxx new file mode 100644 index 000000000000..a980d28e8c93 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/token2.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_TOKEN2_HXX +#define ADC_TOKEN2_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETRS + + + +/** This is the interface for parser classes, which get a sequence of Token s 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. The last time GetNextToken() + returns NULL. + + The algorithms for parsing tokens from the text are an issue of + the derived classes. +*/ +class TextToken +{ + public: + // LIFECYCLE + virtual ~TextToken() {} + + + // INQUIRY + virtual const char* Text() const = 0; +}; + + +#endif + + |