diff options
Diffstat (limited to 'autodoc/source/parser/inc/tokens')
-rw-r--r-- | autodoc/source/parser/inc/tokens/parseinc.hxx | 205 | ||||
-rw-r--r-- | autodoc/source/parser/inc/tokens/stmstarr.hxx | 87 | ||||
-rw-r--r-- | autodoc/source/parser/inc/tokens/stmstate.hxx | 70 | ||||
-rw-r--r-- | autodoc/source/parser/inc/tokens/stmstfin.hxx | 82 | ||||
-rw-r--r-- | autodoc/source/parser/inc/tokens/tkp.hxx | 95 | ||||
-rw-r--r-- | autodoc/source/parser/inc/tokens/tkpcontx.hxx | 142 | ||||
-rw-r--r-- | autodoc/source/parser/inc/tokens/tkpstama.hxx | 125 | ||||
-rw-r--r-- | autodoc/source/parser/inc/tokens/tokdeal.hxx | 59 | ||||
-rw-r--r-- | autodoc/source/parser/inc/tokens/token.hxx | 68 | ||||
-rw-r--r-- | autodoc/source/parser/inc/tokens/tokproct.hxx | 85 |
10 files changed, 1018 insertions, 0 deletions
diff --git a/autodoc/source/parser/inc/tokens/parseinc.hxx b/autodoc/source/parser/inc/tokens/parseinc.hxx new file mode 100644 index 000000000000..0f01fab399c0 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/parseinc.hxx @@ -0,0 +1,205 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/parser/inc/tokens/stmstarr.hxx b/autodoc/source/parser/inc/tokens/stmstarr.hxx new file mode 100644 index 000000000000..640177faf363 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/stmstarr.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * 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 + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/parser/inc/tokens/stmstate.hxx b/autodoc/source/parser/inc/tokens/stmstate.hxx new file mode 100644 index 000000000000..e966b4740b75 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/stmstate.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * 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 + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/parser/inc/tokens/stmstfin.hxx b/autodoc/source/parser/inc/tokens/stmstfin.hxx new file mode 100644 index 000000000000..7ded64933bb5 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/stmstfin.hxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * 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 + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/parser/inc/tokens/tkp.hxx b/autodoc/source/parser/inc/tokens/tkp.hxx new file mode 100644 index 000000000000..97fc9578ae5c --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tkp.hxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * 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. +*/ + +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 + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/parser/inc/tokens/tkpcontx.hxx b/autodoc/source/parser/inc/tokens/tkpcontx.hxx new file mode 100644 index 000000000000..c8818b4bfc20 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tkpcontx.hxx @@ -0,0 +1,142 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * 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 + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/parser/inc/tokens/tkpstama.hxx b/autodoc/source/parser/inc/tokens/tkpstama.hxx new file mode 100644 index 000000000000..9c09ba6bc808 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tkpstama.hxx @@ -0,0 +1,125 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * 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 + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/parser/inc/tokens/tokdeal.hxx b/autodoc/source/parser/inc/tokens/tokdeal.hxx new file mode 100644 index 000000000000..3d70cdd4ad03 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tokdeal.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * 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; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/parser/inc/tokens/token.hxx b/autodoc/source/parser/inc/tokens/token.hxx new file mode 100644 index 000000000000..f44ca2917372 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/token.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * 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 + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/parser/inc/tokens/tokproct.hxx b/autodoc/source/parser/inc/tokens/tokproct.hxx new file mode 100644 index 000000000000..8fdcef957290 --- /dev/null +++ b/autodoc/source/parser/inc/tokens/tokproct.hxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |