diff options
Diffstat (limited to 'autodoc/source/parser_i')
97 files changed, 16020 insertions, 0 deletions
diff --git a/autodoc/source/parser_i/idl/cx_idlco.cxx b/autodoc/source/parser_i/idl/cx_idlco.cxx new file mode 100644 index 000000000000..e8dec0c0b714 --- /dev/null +++ b/autodoc/source/parser_i/idl/cx_idlco.cxx @@ -0,0 +1,548 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_idlco.cxx,v $ + * $Revision: 1.12 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/cx_idlco.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <s2_luidl/cx_sub.hxx> +#include <s2_dsapi/cx_dsapi.hxx> +#include <tools/tkpchars.hxx> +#include <tokens/tkpstam2.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tokrecv.hxx> +#include <x_parse2.hxx> + + +namespace csi +{ +namespace uidl +{ + + +const intt C_nCppInitialNrOfStati = 400; +const intt C_nStatusSize = 128; + + + +const uintt nF_fin_Error = 1; +const uintt nF_fin_Ignore = 2; +const uintt nF_fin_Identifier = 3; +const uintt nF_fin_Keyword = 4; +const uintt nF_fin_Punctuation = 5; +const uintt nF_fin_EOL = 6; +const uintt nF_fin_EOF = 7; + +const uintt nF_goto_MLDocu = 10; +const uintt nF_goto_SLDocu = 11; +const uintt nF_goto_MLComment = 12; +const uintt nF_goto_SLComment = 13; +const uintt nF_goto_Praeprocessor = 14; +const uintt nF_goto_Assignment = 15; + + + +const UINT16 nTok_bty_any = 100 + TokBuiltInType::bty_any; +const UINT16 nTok_bty_boolean = 100 + TokBuiltInType::bty_boolean; +const UINT16 nTok_bty_byte = 100 + TokBuiltInType::bty_byte; +const UINT16 nTok_bty_char = 100 + TokBuiltInType::bty_char; +const UINT16 nTok_bty_double = 100 + TokBuiltInType::bty_double; +const UINT16 nTok_bty_hyper = 100 + TokBuiltInType::bty_hyper; +const UINT16 nTok_bty_long = 100 + TokBuiltInType::bty_long; +const UINT16 nTok_bty_short = 100 + TokBuiltInType::bty_short; +const UINT16 nTok_bty_string = 100 + TokBuiltInType::bty_string; +const UINT16 nTok_bty_void = 100 + TokBuiltInType::bty_void; +const UINT16 nTok_bty_ellipse = 100 + TokBuiltInType::bty_ellipse; + +const UINT16 nTok_tmod_unsigned = 200 + TokTypeModifier::tmod_unsigned; +const UINT16 nTok_tmod_sequence = 200 + TokTypeModifier::tmod_sequence; + +const UINT16 nTok_ph_in = 250 + TokParameterHandling::ph_in; +const UINT16 nTok_ph_out = 250 + TokParameterHandling::ph_out; +const UINT16 nTok_ph_inout = 250 + TokParameterHandling::ph_inout; + +const UINT16 nTok_mt_attribute = 300 + TokMetaType::mt_attribute; +const UINT16 nTok_mt_constants = 300 + TokMetaType::mt_constants; +const UINT16 nTok_mt_enum = 300 + TokMetaType::mt_enum; +const UINT16 nTok_mt_exception = 300 + TokMetaType::mt_exception; +const UINT16 nTok_mt_ident = 300 + TokMetaType::mt_ident; +const UINT16 nTok_mt_interface = 300 + TokMetaType::mt_interface; +const UINT16 nTok_mt_module = 300 + TokMetaType::mt_module; +const UINT16 nTok_mt_property = 300 + TokMetaType::mt_property; +const UINT16 nTok_mt_service = 300 + TokMetaType::mt_service; +const UINT16 nTok_mt_singleton = 300 + TokMetaType::mt_singleton; +const UINT16 nTok_mt_struct = 300 + TokMetaType::mt_struct; +const UINT16 nTok_mt_typedef = 300 + TokMetaType::mt_typedef; +const UINT16 nTok_mt_uik = 300 + TokMetaType::mt_uik; + +const UINT16 nTok_ste_bound = 400 + TokStereotype::ste_bound; +const UINT16 nTok_ste_constrained = 400 + TokStereotype::ste_constrained; +const UINT16 nTok_ste_const = 400 + TokStereotype::ste_const; +const UINT16 nTok_ste_maybeambiguous = 400 + TokStereotype::ste_maybeambiguous; +const UINT16 nTok_ste_maybedefault = 400 + TokStereotype::ste_maybedefault; +const UINT16 nTok_ste_maybevoid = 400 + TokStereotype::ste_maybevoid; +const UINT16 nTok_ste_oneway = 400 + TokStereotype::ste_oneway; +const UINT16 nTok_ste_optional = 400 + TokStereotype::ste_optional; +const UINT16 nTok_ste_readonly = 400 + TokStereotype::ste_readonly; +const UINT16 nTok_ste_removable = 400 + TokStereotype::ste_removable; +const UINT16 nTok_ste_virtual = 400 + TokStereotype::ste_virtual; +const UINT16 nTok_ste_transient = 400 + TokStereotype::ste_transient; +const UINT16 nTok_ste_published = 400 + TokStereotype::ste_published; + +const UINT16 nTok_raises = 501; +const UINT16 nTok_needs = 502; +const UINT16 nTok_observes = 503; + +const UINT16 nTok_assignment = 550; + +const UINT16 nTok_ignore = 600; +const UINT16 nTok_none_MLCommentBegin = 601; +const UINT16 nTok_none_SLCommentBegin = 602; +const UINT16 nTok_none_MLDocuBegin = 603; +const UINT16 nTok_none_SLDocuBegin = 604; +const UINT16 nTok_none_PraeprocessorBegin = 605; + + +const UINT16 nTok_punct_BracketOpen = 700 + TokPunctuation::BracketOpen; +const UINT16 nTok_punct_BracketClose = 700 + TokPunctuation::BracketClose; +const UINT16 nTok_punct_ArrayBracketOpen = 700 + TokPunctuation::ArrayBracketOpen; +const UINT16 nTok_punct_ArrayBracketClose = 700 + TokPunctuation::ArrayBracketClose; +const UINT16 nTok_punct_CurledBracketOpen = 700 + TokPunctuation::CurledBracketOpen; +const UINT16 nTok_punct_CurledBracketClose = 700 + TokPunctuation::CurledBracketClose; +const UINT16 nTok_punct_Semicolon = 700 + TokPunctuation::Semicolon; +const UINT16 nTok_punct_Colon = 700 + TokPunctuation::Colon; +const UINT16 nTok_punct_DoubleColon = 700 + TokPunctuation::DoubleColon; +const UINT16 nTok_punct_Comma = 700 + TokPunctuation::Comma; +const UINT16 nTok_punct_Minus = 700 + TokPunctuation::Minus; +const UINT16 nTok_punct_Fullstop = 700 + TokPunctuation::Fullstop; +const UINT16 nTok_punct_Lesser = 700 + TokPunctuation::Lesser; +const UINT16 nTok_punct_Greater = 700 + TokPunctuation::Greater; + +const UINT16 nTok_EOL = 801; +const UINT16 nTok_EOF = 802; + + + +Context_UidlCode::Context_UidlCode( Token_Receiver & o_rReceiver, + DYN TkpDocuContext & let_drContext_Docu ) + : aStateMachine(C_nStatusSize,C_nCppInitialNrOfStati), + pReceiver(&o_rReceiver), + pDocuContext(&let_drContext_Docu), + dpContext_MLComment(0), + dpContext_SLComment(0), + dpContext_Preprocessor(0), + dpContext_Assignment(0), + pNewToken(0), + pFollowUpContext(0) +{ + dpContext_MLComment = new Context_MLComment(o_rReceiver,*this), + dpContext_SLComment = new Context_SLComment(o_rReceiver,*this), + dpContext_Preprocessor = new Context_Praeprocessor(o_rReceiver,*this), + dpContext_Assignment = new Context_Assignment(o_rReceiver,*this), + + pDocuContext->SetParentContext(*this,"*/"); + SetupStateMachine(); +} + +Context_UidlCode::~Context_UidlCode() +{ +} + +void +Context_UidlCode::ReadCharChain( CharacterSource & io_rText ) +{ + pNewToken = 0; + + UINT16 nTokenId = 0; + StmBoundsStatu2 & rBound = aStateMachine.GetCharChain(nTokenId, io_rText); + + // !!! + // The order of the next two lines is essential, because + // pFollowUpContext may be changed by PerformStatusFunction() also, + // which then MUST override the previous assignment. + pFollowUpContext = rBound.FollowUpContext(); + PerformStatusFunction(rBound.StatusFunctionNr(), nTokenId, io_rText); +} + +bool +Context_UidlCode::PassNewToken() +{ + if (pNewToken) + { + pReceiver->Receive(*pNewToken.Release()); + return true; + } + return false; +} + +TkpContext & +Context_UidlCode::FollowUpContext() +{ + csv_assert(pFollowUpContext != 0); + return *pFollowUpContext; +} + +void +Context_UidlCode::PerformStatusFunction( uintt i_nStatusSignal, + UINT16 i_nTokenId, + CharacterSource & io_rText ) +{ + switch (i_nStatusSignal) + { + case nF_fin_Error: + // KORR_FUTURE + throw X_AutodocParser(X_AutodocParser::x_InvalidChar); + // no break, because of throw + case nF_fin_Ignore: + pNewToken = 0; + io_rText.CutToken(); + break; + case nF_fin_Identifier: + pNewToken = new TokIdentifier(io_rText.CutToken()); + break; + case nF_fin_Keyword: + io_rText.CutToken(); + switch ( i_nTokenId / 50 ) + { + case 2: + pNewToken = new TokBuiltInType(i_nTokenId - 100); + break; + case 4: + pNewToken = new TokTypeModifier(i_nTokenId - 200); + break; + case 5: + pNewToken = new TokParameterHandling(i_nTokenId - 250); + break; + case 6: + pNewToken = new TokMetaType(i_nTokenId - 300); + break; + case 8: + pNewToken = new TokStereotype(i_nTokenId - 400); + break; + case 10: + switch (i_nTokenId-500) + { + case 1: + pNewToken = new TokRaises; + break; + case 2: + pNewToken = new TokNeeds; + break; + case 3: + pNewToken = new TokObserves; + break; + default: + csv_assert(false); + } + break; + default: + csv_assert(false); + } // end switch ( i_nTokenId / 50 ) + break; + case nF_fin_Punctuation: + io_rText.CutToken(); + if (i_nTokenId == nTok_punct_DoubleColon) + pNewToken = new TokNameSeparator; + else + pNewToken = new TokPunctuation(i_nTokenId - 700); + break; + case nF_fin_EOL: + io_rText.CutToken(); + pNewToken = new Tok_EOL; + pReceiver->Increment_CurLine(); + break; + case nF_fin_EOF: + pNewToken = new Tok_EOF; + break; + case nF_goto_MLDocu: + while ( io_rText.CurChar() == '*') + io_rText.MoveOn(); + io_rText.CutToken(); + pDocuContext->SetMode_IsMultiLine(true); + break; + case nF_goto_SLDocu: + io_rText.CutToken(); + pDocuContext->SetMode_IsMultiLine(false); + break; + case nF_goto_MLComment: + break; + case nF_goto_SLComment: + break; + case nF_goto_Praeprocessor: + break; + case nF_goto_Assignment: + break; + default: + csv_assert(false); + } // end switch (i_nStatusSignal) +} + +void +Context_UidlCode::SetupStateMachine() +{ + // Besondere Array-Stati (kein Tokenabschluss oder Kontextwechsel): +// const INT16 top = 0; // Top-Status + const INT16 wht = 1; // Whitespace-überlese-Status + const INT16 bez = 2; // Bezeichner-lese-Status + + // Tokenfinish-Stati: + const INT16 finErr = 3; + const INT16 finIgn = 4; + const INT16 finBez = 5; + const INT16 finKeyw = 6; + const INT16 finPunct = 7; + const INT16 finEOL = 8; + const INT16 finEOF = 9; + + // Kontextwechsel-Stati: + const INT16 gotoMld = 10; + const INT16 gotoSld = 11; + const INT16 gotoMlc = 12; + const INT16 gotoSlc = 13; + const INT16 gotoPrp = 14; + const INT16 gotoAsg = 15; + + // Konstanten zur Benutzung in der Tabelle: + const INT16 err = finErr; + const INT16 fbz = finBez; + const INT16 fig = finIgn; + const INT16 fof = finEOF; +// const INT16 fkw = finKeyw; +// const INT16 fpc = finPunct; + + /// Die '0'en werden spaeter durch AddToken() ersetzt. + + const INT16 A_nTopStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht, 0,wht,wht, 0,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // 16 ... + wht,err,wht, 0,err,err,err,err, 0, 0,err,err, 0, 0, 0,err, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,err,err,err,err,err,err, // 48 ... + err,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 0,err, 0,err,bez, // 80 ... + err,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 0,err, 0,err,err, // 112 ... + }; + + const INT16 A_nWhitespaceStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht,fig,wht,wht,fig,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // 16 ... + wht,fig,wht,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, // 48 ... + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, // 80 ... + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, + fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,err // 112 ... + }; + + const INT16 A_nBezeichnerStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fbz,err,err,err,err,err,err,err,err,fbz,fbz,fbz,fbz,fbz,err,err, + err,err,err,err,err,err,err,err,err,err,fbz,err,err,err,err,err, // 16 ... + fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,fbz,fbz, // 48 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,bez, // 80 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,err // 112 ... + }; + + const INT16 A_nPunctDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 16 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 48 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 80 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err // 112 ... + }; + + const INT16 A_nKeywordDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fbz,err,err,err,err,err,err,err,err,fbz,fbz,fbz,fbz,fbz,err,err, + err,err,err,err,err,err,err,err,err,err,fbz,err,err,err,err,err, // 16 ... + fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,fbz,fbz, // 48 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,bez, // 80 ... + fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, + bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,err // 112 ... + }; + + DYN StmArrayStatu2 * dpStatusTop + = new StmArrayStatu2( C_nStatusSize, A_nTopStatus, 0, true); + DYN StmArrayStatu2 * dpStatusWhite + = new StmArrayStatu2( C_nStatusSize, A_nWhitespaceStatus, 0, true); + DYN StmArrayStatu2 * dpStatusBez + = new StmArrayStatu2( C_nStatusSize, A_nBezeichnerStatus, 0, true); + + DYN StmBoundsStatu2 * dpBst_finErr + = new StmBoundsStatu2( *this, TkpContext_Null2_(), nF_fin_Error, true ); + DYN StmBoundsStatu2 * dpBst_finIgn + = new StmBoundsStatu2( *this, *this, nF_fin_Ignore, true ); + DYN StmBoundsStatu2 * dpBst_finBez + = new StmBoundsStatu2( *this, *this, nF_fin_Identifier, true ); + DYN StmBoundsStatu2 * dpBst_finKeyw + = new StmBoundsStatu2( *this, *this, nF_fin_Keyword, false ); + DYN StmBoundsStatu2 * dpBst_finPunct + = new StmBoundsStatu2( *this, *this, nF_fin_Punctuation, false ); + DYN StmBoundsStatu2 * dpBst_finEOL + = new StmBoundsStatu2( *this, *this, nF_fin_EOL, false ); + DYN StmBoundsStatu2 * dpBst_finEOF + = new StmBoundsStatu2( *this, TkpContext_Null2_(), nF_fin_EOF, false ); + + DYN StmBoundsStatu2 * dpBst_gotoMld + = new StmBoundsStatu2( *this, *pDocuContext, nF_goto_MLDocu, false ); + DYN StmBoundsStatu2 * dpBst_gotoSld + = new StmBoundsStatu2( *this, *pDocuContext, nF_goto_SLDocu, false ); + DYN StmBoundsStatu2 * dpBst_gotoMlc + = new StmBoundsStatu2( *this, *dpContext_MLComment, nF_goto_MLComment, false ); + DYN StmBoundsStatu2 * dpBst_gotoSlc + = new StmBoundsStatu2( *this, *dpContext_SLComment, nF_goto_SLComment, false ); + DYN StmBoundsStatu2 * dpBst_gotoPrp + = new StmBoundsStatu2( *this, *dpContext_Preprocessor, nF_goto_Praeprocessor, false ); + DYN StmBoundsStatu2 * dpBst_gotoAsg + = new StmBoundsStatu2( *this, *dpContext_Assignment, nF_goto_Assignment, false ); + + // dpMain aufbauen: + aStateMachine.AddStatus(dpStatusTop); + + aStateMachine.AddStatus(dpStatusWhite); + aStateMachine.AddStatus(dpStatusBez); + + aStateMachine.AddStatus(dpBst_finErr); + aStateMachine.AddStatus(dpBst_finIgn); + aStateMachine.AddStatus(dpBst_finBez); + aStateMachine.AddStatus(dpBst_finKeyw); + aStateMachine.AddStatus(dpBst_finPunct); + aStateMachine.AddStatus(dpBst_finEOL); + aStateMachine.AddStatus(dpBst_finEOF); + + aStateMachine.AddStatus(dpBst_gotoMld); + aStateMachine.AddStatus(dpBst_gotoSld); + aStateMachine.AddStatus(dpBst_gotoMlc); + aStateMachine.AddStatus(dpBst_gotoSlc); + aStateMachine.AddStatus(dpBst_gotoPrp); + aStateMachine.AddStatus(dpBst_gotoAsg); + + aStateMachine.AddToken("any", nTok_bty_any, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("attribute", nTok_mt_attribute, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("boolean", nTok_bty_boolean, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("bound", nTok_ste_bound, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("byte", nTok_bty_byte, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("char", nTok_bty_char, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("const", nTok_ste_const, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("constants", nTok_mt_constants, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("constrained", + nTok_ste_constrained, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("double", nTok_bty_double, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("enum", nTok_mt_enum, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("exception", nTok_mt_exception, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("hyper", nTok_bty_hyper, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("ident", nTok_mt_ident, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("in", nTok_ph_in, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("inout", nTok_ph_inout, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("interface", nTok_mt_interface, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("long", nTok_bty_long, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("maybeambiguous", + nTok_ste_maybeambiguous,A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("maybedefault", + nTok_ste_maybedefault, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("maybevoid", nTok_ste_maybevoid, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("module", nTok_mt_module, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("needs", nTok_needs, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("observes", nTok_observes, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("oneway", nTok_ste_oneway, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("optional", nTok_ste_optional, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("out", nTok_ph_out, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("property", nTok_mt_property, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("published", nTok_ste_published, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("raises", nTok_raises, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("readonly", nTok_ste_readonly, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("removable", nTok_ste_removable, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("sequence", nTok_tmod_sequence, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("service", nTok_mt_service, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("short", nTok_bty_short, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("singleton", nTok_mt_singleton, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("string", nTok_bty_string, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("struct", nTok_mt_struct, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("transient", nTok_ste_transient, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("typedef", nTok_mt_typedef, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("uik", nTok_mt_uik, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("unsigned", nTok_tmod_unsigned, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("virtual", nTok_ste_virtual, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("void", nTok_bty_void, A_nKeywordDefStatus, finKeyw); + aStateMachine.AddToken("...", nTok_bty_ellipse, A_nPunctDefStatus, finKeyw); + + aStateMachine.AddToken("=", nTok_assignment, A_nPunctDefStatus, gotoAsg); + + aStateMachine.AddToken("(", nTok_punct_BracketOpen, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken(")", nTok_punct_BracketClose,A_nPunctDefStatus, finPunct); + aStateMachine.AddToken("[", nTok_punct_ArrayBracketOpen, + A_nPunctDefStatus, finIgn); + aStateMachine.AddToken("]", nTok_punct_ArrayBracketClose, + A_nPunctDefStatus, finIgn); + aStateMachine.AddToken("{", nTok_punct_CurledBracketOpen, + A_nPunctDefStatus, finPunct); + aStateMachine.AddToken("}", nTok_punct_CurledBracketClose, + A_nPunctDefStatus, finPunct); + aStateMachine.AddToken("<", nTok_punct_Lesser, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken(">", nTok_punct_Greater, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken(";", nTok_punct_Semicolon, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken(":", nTok_punct_Colon, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken("::", nTok_punct_DoubleColon, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken(",", nTok_punct_Comma, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken("-", nTok_punct_Minus, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken(".", nTok_punct_Fullstop, A_nPunctDefStatus, finPunct); + aStateMachine.AddToken("/**", nTok_none_MLDocuBegin, A_nPunctDefStatus, gotoMld); + aStateMachine.AddToken("///", nTok_none_SLDocuBegin, A_nPunctDefStatus, gotoSld); + aStateMachine.AddToken("/*", nTok_none_MLCommentBegin, + A_nPunctDefStatus, gotoMlc); + aStateMachine.AddToken("//", nTok_none_SLCommentBegin, + A_nPunctDefStatus, gotoSlc); + aStateMachine.AddToken("/**/", nTok_ignore, A_nPunctDefStatus, finIgn); + aStateMachine.AddToken("#", nTok_none_PraeprocessorBegin, + A_nPunctDefStatus, gotoPrp); + aStateMachine.AddToken("\r\n", nTok_EOL, A_nPunctDefStatus, finEOL); + aStateMachine.AddToken("\r", nTok_EOL, A_nPunctDefStatus, finEOL); + aStateMachine.AddToken("\n", nTok_EOL, A_nPunctDefStatus, finEOL); + aStateMachine.AddToken("\n\r", nTok_EOL, A_nPunctDefStatus, finEOL); +}; + + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/cx_sub.cxx b/autodoc/source/parser_i/idl/cx_sub.cxx new file mode 100644 index 000000000000..a6efcf508ed1 --- /dev/null +++ b/autodoc/source/parser_i/idl/cx_sub.cxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_sub.cxx,v $ + * $Revision: 1.6 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/cx_sub.hxx> + + + +// NOT FULLY DECLARED SERVICES +#include <s2_luidl/tokrecv.hxx> +#include <../../parser/inc/tokens/parseinc.hxx> +#include <x_parse2.hxx> +#include <s2_luidl/tk_const.hxx> + + + +namespace csi +{ +namespace uidl +{ + +bool +Cx_Base::PassNewToken() +{ + if (pNewToken) + { + rReceiver.Receive(*pNewToken.Release()); + return true; + } + return false; +} + +TkpContext & +Cx_Base::FollowUpContext() +{ + csv_assert(pFollowUpContext != 0); + return *pFollowUpContext; +} + +void +Context_MLComment::ReadCharChain( CharacterSource & io_rText ) +{ + char cNext = NULCH; + + do { + do { + cNext = jumpTo(io_rText,'*','\n'); + if (cNext == '\n') + { + Receiver().Increment_CurLine(); + cNext = io_rText.MoveOn(); + } + else if (cNext == NULCH) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + } while (cNext != '*'); + + cNext = jumpOver(io_rText,'*'); + if (cNext == NULCH) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + } while (cNext != '/'); + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(0); +} + +void +Context_SLComment::ReadCharChain( CharacterSource & io_rText ) +{ + jumpToEol(io_rText); + if (io_rText.CurChar() != NULCH) + jumpOverEol(io_rText); + io_rText.CutToken(); + SetToken(0); + + Receiver().Increment_CurLine(); +} + +void +Context_Praeprocessor::ReadCharChain( CharacterSource & io_rText ) +{ + jumpToEol(io_rText); + if (io_rText.CurChar() != NULCH) + jumpOverEol(io_rText); + io_rText.CutToken(); + SetToken(0); + + Receiver().Increment_CurLine(); +} + +void +Context_Assignment::ReadCharChain( CharacterSource & io_rText ) +{ + // KORR_FUTURE + // How to handle new lines within this, so he y get realised by + // ParserInfo? + + char cNext = NULCH; + do { + if ( (cNext = jumpTo(io_rText,';',',','"','}')) == NULCH ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + if (cNext == '"') + { + cNext = io_rText.MoveOn(); + while (cNext != '"') + { + if ( (cNext = jumpTo(io_rText,'"','\\')) == NULCH ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + if (cNext == '\\') + io_rText.MoveOn(); + } + cNext = io_rText.MoveOn(); + } // endif (cNext == '"') + } while (cNext != ';' AND cNext != ',' AND cNext != '}'); + + if (cNext == ',' OR cNext == ';') + io_rText.MoveOn(); + SetToken(new TokAssignment(io_rText.CutToken())); +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/distrib.cxx b/autodoc/source/parser_i/idl/distrib.cxx new file mode 100644 index 000000000000..ced4dec7a2e0 --- /dev/null +++ b/autodoc/source/parser_i/idl/distrib.cxx @@ -0,0 +1,267 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: distrib.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/distrib.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/doc/d_oldidldocu.hxx> +#include <parser/parserinfo.hxx> +#include <s2_luidl/tkp_uidl.hxx> +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_dsapi/docu_pe2.hxx> +#include <adc_cl.hxx> +#include <x_parse2.hxx> + + + +const uintt C_nNO_TRY = uintt(-1); + + +namespace csi +{ +namespace uidl +{ + +TokenDistributor::TokenDistributor( ary::Repository & io_rRepository, + ParserInfo & io_rParserInfo ) + : pTokenSource(0), + aDocumentation(io_rParserInfo), + aProcessingData( io_rRepository, aDocumentation, io_rParserInfo ) +{ +} + +TokenDistributor::~TokenDistributor() +{ +} + +void +TokenDistributor::TradeToken() +{ + bool bGoon = true; + while (bGoon AND NOT aProcessingData.NextTokenExists()) + { + bGoon = pTokenSource->GetNextToken(); + } + if (bGoon) + aProcessingData.ProcessCurToken(); +} + +TokenDistributor::ProcessingData::ProcessingData( + ary::Repository & io_rRepository, + Documentation & i_rDocuProcessor, + ParserInfo & io_rParserInfo ) + : // aEnvironments + // aTokenQueue + // itCurToken + // aCurResult + nTryCount(0), + bFinished(false), + rRepository(io_rRepository), + rParserInfo(io_rParserInfo), + pDocuProcessor(&i_rDocuProcessor), + bPublishedRecentlyOn(false) +{ + itCurToken = aTokenQueue.end(); +} + +TokenDistributor::ProcessingData::~ProcessingData() +{ +} + +void +TokenDistributor::ProcessingData::SetTopParseEnvironment( UnoIDL_PE & io_pTopParseEnvironment ) +{ + csv::erase_container(aEnvironments); + aEnvironments.push_back( EnvironmentInfo( &io_pTopParseEnvironment, 0 ) ); + io_pTopParseEnvironment.EstablishContacts(0,rRepository,aCurResult); +} + +void +TokenDistributor::ProcessingData::Receive( DYN csi::uidl::Token & let_drToken ) +{ + aTokenQueue.push_back( &let_drToken ); + itCurToken = aTokenQueue.end()-1; +} + +void +TokenDistributor::ProcessingData::Increment_CurLine() +{ + rParserInfo.Increment_CurLine(); +} + +void +TokenDistributor::ProcessingData::ProcessCurToken() +{ + +if (DEBUG_ShowTokens()) +{ + Cout() << (*itCurToken)->Text() << Endl(); +} + + aCurResult.reset(); + + CurEnvironment().ProcessToken( CurToken() ); + AcknowledgeResult(); +} + + +UnoIDL_PE & +TokenDistributor::ProcessingData::CurEnvironment() const +{ + csv_assert(aEnvironments.size() > 0); + csv_assert(aEnvironments.back().first != 0); + + return *aEnvironments.back().first; +} + +bool +TokenDistributor::ProcessingData::NextTokenExists() const +{ + return itCurToken != aTokenQueue.end(); +} + +void +TokenDistributor::ProcessingData::AcknowledgeResult() +{ + if (aCurResult.eDone == done) + ++itCurToken; + + switch ( aCurResult.eStackAction ) + { + case stay: + if (aCurResult.eDone != done) + { + csv_assert(false); + } + break; + case push_sure: + CurEnv().Leave(push_sure); + aEnvironments.push_back( EnvironmentInfo(&PushEnv(), C_nNO_TRY) ); + PushEnv().Enter(push_sure); + PushEnv().SetDocu(pDocuProcessor->ReleaseLastParsedDocu()); + if (bPublishedRecentlyOn) + { + PushEnv().SetPublished(); + bPublishedRecentlyOn = false; + } + + break; + case push_try: + Cout() << "TestInfo: Environment tried." << Endl(); + CurEnv().Leave(push_try); + aEnvironments.push_back( EnvironmentInfo(&PushEnv(), CurTokenPosition()) ); + nTryCount++; + PushEnv().Enter(push_try); + break; + case pop_success: + CurEnv().Leave(pop_success); + if ( CurEnv_TriedTokenPosition() > 0 ) + DecrementTryCount(); + aEnvironments.pop_back(); + CurEnv().Enter(pop_success); + break; + case pop_failure: + { + CurEnv().Leave(pop_failure); + if (aCurResult.eDone == done) + { + csv_assert(false); + } + + if ( CurEnv_TriedTokenPosition() == C_nNO_TRY ) + throw X_AutodocParser( X_AutodocParser::x_UnexpectedToken, (*itCurToken)->Text() ); + + itCurToken = aTokenQueue.begin() + CurEnv_TriedTokenPosition(); + DecrementTryCount(); + aEnvironments.pop_back(); + CurEnv().Enter(pop_failure); + } break; + default: + csv_assert(false); + } // end switch(aCurResult.eStackAction) +} + +void +TokenDistributor::ProcessingData::DecrementTryCount() +{ + nTryCount--; + if (nTryCount == 0) + { + aTokenQueue.erase(aTokenQueue.begin(), itCurToken); + itCurToken = aTokenQueue.begin(); + } +} + +TokenDistributor:: +Documentation::Documentation(ParserInfo & io_rParserInfo) + : pDocuParseEnv(new csi::dsapi::SapiDocu_PE(io_rParserInfo)), + rParserInfo(io_rParserInfo), + pMostRecentDocu(0), + bIsPassedFirstDocu(false) +{ +} + +TokenDistributor:: +Documentation::~Documentation() +{ +} + +void +TokenDistributor:: +Documentation::Receive( DYN csi::dsapi::Token & let_drToken ) +{ + csv_assert(pDocuParseEnv); + + pDocuParseEnv->ProcessToken(let_drToken); + if ( pDocuParseEnv->IsComplete() ) + { + pMostRecentDocu = pDocuParseEnv->ReleaseJustParsedDocu(); + if (NOT bIsPassedFirstDocu) + { + pMostRecentDocu = 0; // Deletes the most recent docu. + bIsPassedFirstDocu = true; + } + } +} + +void +TokenDistributor:: +Documentation::Increment_CurLine() +{ + rParserInfo.Increment_CurLine(); +} + + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/makefile.mk b/autodoc/source/parser_i/idl/makefile.mk new file mode 100644 index 000000000000..e39b74b075af --- /dev/null +++ b/autodoc/source/parser_i/idl/makefile.mk @@ -0,0 +1,88 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.5 $ +# +# 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. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=parser2_s2_luidl + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + + +OBJFILES= \ + $(OBJ)$/cx_idlco.obj \ + $(OBJ)$/cx_sub.obj \ + $(OBJ)$/distrib.obj \ + $(OBJ)$/parsenv2.obj \ + $(OBJ)$/pe_attri.obj \ + $(OBJ)$/pe_const.obj \ + $(OBJ)$/pe_enum2.obj \ + $(OBJ)$/pe_evalu.obj \ + $(OBJ)$/pe_excp.obj \ + $(OBJ)$/pe_file2.obj \ + $(OBJ)$/pe_func2.obj \ + $(OBJ)$/pe_iface.obj \ + $(OBJ)$/pe_property.obj \ + $(OBJ)$/pe_selem.obj \ + $(OBJ)$/pe_servi.obj \ + $(OBJ)$/pe_singl.obj \ + $(OBJ)$/pe_struc.obj \ + $(OBJ)$/pe_tydf2.obj \ + $(OBJ)$/pe_type2.obj \ + $(OBJ)$/pe_vari2.obj \ + $(OBJ)$/pestate.obj \ + $(OBJ)$/semnode.obj \ + $(OBJ)$/tk_const.obj \ + $(OBJ)$/tk_ident.obj \ + $(OBJ)$/tk_keyw.obj \ + $(OBJ)$/tk_punct.obj \ + $(OBJ)$/tkp_uidl.obj \ + $(OBJ)$/unoidl.obj + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser_i/idl/parsenv2.cxx b/autodoc/source/parser_i/idl/parsenv2.cxx new file mode 100644 index 000000000000..bb77ba8aa1d6 --- /dev/null +++ b/autodoc/source/parser_i/idl/parsenv2.cxx @@ -0,0 +1,215 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: parsenv2.cxx,v $ + * $Revision: 1.14 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/parsenv2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/ary.hxx> +#include <ary/getncast.hxx> +#include <ary/qualiname.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_enum.hxx> +#include <ary/idl/i_enumvalue.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/ip_ce.hxx> +#include <parser/parserinfo.hxx> +#include <adc_msg.hxx> +#include <s2_luidl/uidl_tok.hxx> +#include <x_parse2.hxx> + + + + +namespace csi +{ +namespace uidl +{ + + +UnoIDL_PE::~UnoIDL_PE() +{ +} + +void +UnoIDL_PE::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + pRepository = &io_rRepository; + aMyNode.EstablishContacts(io_pParentPE, io_rRepository.Gate_Idl(), o_rResult); +} + +//void +//UnoIDL_PE::EstablishContacts( UnoIDL_PE * io_pParentPE, +// ary::idl::Gate & io_rGate, +// TokenProcessing_Result & o_rResult ) +//{ +// aMyNode.EstablishContacts(io_pParentPE, io_rGate, o_rResult); +//} + +void +UnoIDL_PE::Enter( E_EnvStackAction i_eWayOfEntering ) +{ + switch (i_eWayOfEntering) + { + case push_sure: + InitData(); + break; + case push_try: + csv_assert(false); + break; + case pop_success: + ReceiveData(); + break; + case pop_failure: + throw X_AutodocParser(X_AutodocParser::x_Any); + // no break because of throw + default: + csv_assert(false); + } // end switch +} + +void +UnoIDL_PE::Leave( E_EnvStackAction i_eWayOfLeaving ) +{ + switch (i_eWayOfLeaving) + { + case push_sure: + break; + case push_try: + csv_assert(false); + break; + case pop_success: + TransferData(); + break; + case pop_failure: + throw X_AutodocParser(X_AutodocParser::x_Any); + // no break because of throw + default: + csv_assert(false); + } // end switch +} + +void +UnoIDL_PE::SetDocu( DYN ary::doc::OldIdlDocu * let_dpDocu ) +{ + pDocu = let_dpDocu; +} + +void +UnoIDL_PE::SetPublished() +{ + if (NOT pDocu) + { + pDocu = new ary::doc::OldIdlDocu; + } + pDocu->SetPublished(); +} + +void +UnoIDL_PE::SetOptional() +{ + if (NOT pDocu) + { + pDocu = new ary::doc::OldIdlDocu; + } + pDocu->SetOptional(); +} + +void +UnoIDL_PE::PassDocuAt( ary::idl::CodeEntity & io_rCe ) +{ + if (pDocu) + { + io_rCe.Set_Docu(*pDocu.Release()); + } + else if // KORR_FUTURE + // Re-enable doc-warning for Enum Values, as soon as there is a + // @option -no-doc-for-enumvalues. + ( NOT ary::is_type<ary::idl::Module>(io_rCe) + AND NOT ary::is_type<ary::idl::Enum>(io_rCe) ) + { + TheMessages().Out_MissingDoc( + io_rCe.LocalName(), + ParseInfo().CurFile(), + ParseInfo().CurLine() ); + } +} + +void +UnoIDL_PE::InitData() +{ + // Needs not anything to do. +} + +void +UnoIDL_PE::ReceiveData() +{ + // Needs not anything to do. +} + +const ary::idl::Module & +UnoIDL_PE::CurNamespace() const +{ + if ( Parent() != 0 ) + return Parent()->CurNamespace(); + else + { + csv_assert(false); + return *(const ary::idl::Module*)0; + } +} + +const ParserInfo & +UnoIDL_PE::ParseInfo() const +{ + if ( Parent() != 0 ) + return Parent()->ParseInfo(); + else + { + csv_assert(false); + return *(const ParserInfo*)0; + } +} + +UnoIDL_PE::UnoIDL_PE() + : aMyNode(), + pDocu(), + pRepository(0) +{ +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_attri.cxx b/autodoc/source/parser_i/idl/pe_attri.cxx new file mode 100644 index 000000000000..096a7bd7269d --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_attri.cxx @@ -0,0 +1,297 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_attri.cxx,v $ + * $Revision: 1.8 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_attri.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_attribute.hxx> +#include <ary/idl/i_service.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/pe_vari2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + + +namespace csi +{ +namespace uidl +{ + + + +PE_Attribute::PE_Attribute( const Ce_id & i_rCurOwner ) + : eState(e_none), + pCurOwner(&i_rCurOwner), + pPE_Variable(0), + pPE_Exception(0), + pCurAttribute(0), + nCurParsedType(0), + sCurParsedName(), + bReadOnly(false), + bBound(false) +{ + pPE_Variable = new PE_Variable(nCurParsedType, sCurParsedName); + pPE_Exception = new PE_Type(nCurParsedType); +} + +void +PE_Attribute::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Variable->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Exception->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Attribute::~PE_Attribute() +{ +} + +void +PE_Attribute::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Attribute::Process_Identifier( const TokIdentifier & i_rToken ) +{ + switch (eState) + { + case e_start: + SetResult(not_done, push_sure, pPE_Variable.Ptr()); + eState = in_variable; + break; + case in_raise_std: + if (strcmp(i_rToken.Text(),"get") == 0) + { + SetResult(done, stay); + eState = in_get; + } + else if (strcmp(i_rToken.Text(),"set") == 0) + { + SetResult(done, stay); + eState = in_set; + } + else + { + SetResult(not_done, pop_failure); + eState = e_none; + } + break; + case in_get: + case in_set: + SetResult(not_done, push_sure, pPE_Exception.Ptr()); + break; + default: + SetResult(not_done, pop_failure); + } // end switch +} + +void +PE_Attribute::Process_Stereotype( const TokStereotype & i_rToken ) +{ + if (eState != e_start) + { + SetResult(not_done, pop_failure); + eState = e_none; + return; + } + + switch (i_rToken.Id()) + { + case TokStereotype::ste_readonly: + bReadOnly = true; + break; + case TokStereotype::ste_bound: + bBound = true; + break; + default: + SetResult(not_done, pop_failure); + eState = e_none; + return; + } // end switch + + SetResult(done, stay); +} + +void +PE_Attribute::Process_MetaType( const TokMetaType & i_rToken ) +{ + if (eState != e_start OR i_rToken.Id() != TokMetaType::mt_attribute) + { + SetResult(not_done, pop_failure); + eState = e_none; + return; + } + + SetResult(done, stay); +} + +void +PE_Attribute::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + switch (eState) + { + case e_start: + SetResult(done, stay); + break; + case expect_end: + switch(i_rToken.Id()) + { + case TokPunctuation::Semicolon: + SetResult(done, pop_success); + eState = e_none; + break; + case TokPunctuation::Comma: + SetResult(not_done, pop_failure); + Cerr() << "Autodoc does not support comma separated attributes, because those are discouraged by IDL policies." << Endl(); + break; + case TokPunctuation::CurledBracketOpen: + SetResult(done, stay); + eState = in_raise_std; + break; + default: + SetResult(not_done, pop_failure); + } // end switch + break; + case in_raise_std: + SetResult(done, stay); + if (i_rToken.Id() == TokPunctuation::CurledBracketClose) + { + eState = expect_end; + } + break; + case in_get: + case in_set: + SetResult(done, stay); + if (i_rToken.Id() == TokPunctuation::Semicolon) + { + eState = in_raise_std; + } + break; + default: + csv_assert(false); + } +} + +void +PE_Attribute::Process_Raises() +{ + if (eState == in_get OR eState == in_set) + { + SetResult(done, stay); + } + else + SetResult(not_done, pop_failure); +} + +void +PE_Attribute::Process_Default() +{ + if (eState == e_start) + { + SetResult(not_done, push_sure, pPE_Variable.Ptr()); + eState = in_variable; + } + else if (eState == in_get OR eState == in_set) + SetResult(not_done, push_sure, pPE_Exception.Ptr()); + else + SetResult(not_done, pop_failure); +} + +void +PE_Attribute::InitData() +{ + eState = e_start; + + pCurAttribute = 0; + nCurParsedType = 0; + sCurParsedName = ""; + bReadOnly = false; + bBound = false; +} + +void +PE_Attribute::TransferData() +{ + eState = e_none; +} + +void +PE_Attribute::ReceiveData() +{ + switch (eState) + { + case in_variable: + csv_assert(pCurOwner->IsValid()); + pCurAttribute = &Gate().Ces().Store_Attribute( + *pCurOwner, + sCurParsedName, + nCurParsedType, + bReadOnly, + bBound ); + PassDocuAt(*pCurAttribute); + nCurParsedType = 0; + eState = expect_end; + break; + case in_get: + csv_assert(pCurAttribute != 0); + pCurAttribute->Add_GetException(nCurParsedType); + nCurParsedType = 0; + break; + case in_set: + csv_assert(pCurAttribute != 0); + pCurAttribute->Add_SetException(nCurParsedType); + nCurParsedType = 0; + break; + default: + csv_assert(false); + } // end switch +} + + +UnoIDL_PE & +PE_Attribute::MyPE() +{ + return *this; +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_const.cxx b/autodoc/source/parser_i/idl/pe_const.cxx new file mode 100644 index 000000000000..bb7c65517b6b --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_const.cxx @@ -0,0 +1,283 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_const.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_const.hxx> + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_constant.hxx> +#include <ary/idl/i_constgroup.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/pe_evalu.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_keyw.hxx> + + +namespace csi +{ +namespace uidl +{ + + +#ifdef DF +#undef DF +#endif +#define DF &PE_Constant::On_Default + +PE_Constant::F_TOK +PE_Constant::aDispatcher[PE_Constant::e_STATES_MAX][PE_Constant::tt_MAX] = + { { DF, DF, DF }, // e_none + { DF, &PE_Constant::On_expect_name_Identifier, + DF }, // expect_name + { DF, DF, &PE_Constant::On_expect_curl_bracket_open_Punctuation }, // expect_curl_bracket_open + { &PE_Constant::On_expect_const_Stereotype, + DF, &PE_Constant::On_expect_const_Punctuation }, // expect_const + { DF, &PE_Constant::On_expect_value_Identifier, + DF }, // expect_value + { DF, DF, &PE_Constant::On_expect_finish_Punctuation } // expect_finish + }; + + + +inline void +PE_Constant::CallHandler( const char * i_sTokenText, + E_TokenType i_eTokenType ) + { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); } + + + + +PE_Constant::PE_Constant() + : eState(e_none), + sData_Name(), + nDataId(0), + pPE_Type(0), + nType(0), + pPE_Value(0), + sName(), + sAssignment() +{ + pPE_Type = new PE_Type(nType); + pPE_Value = new PE_Value(sName, sAssignment, true); +} + +void +PE_Constant::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Value->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Constant::~PE_Constant() +{ +} + +void +PE_Constant::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Constant::Process_Identifier( const TokIdentifier & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_identifier); +} + +void +PE_Constant::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_punctuation); +} + +void +PE_Constant::Process_Stereotype( const TokStereotype & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_stereotype); +} + +void +PE_Constant::On_expect_name_Identifier(const char * i_sText) +{ + sName = i_sText; + + SetResult(done,stay); + eState = expect_curl_bracket_open; +} + +void +PE_Constant::On_expect_curl_bracket_open_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == '{') + { + sData_Name = sName; + + ary::idl::ConstantsGroup & + rCe = Gate().Ces(). + Store_ConstantsGroup(CurNamespace().CeId(),sData_Name); + PassDocuAt(rCe); + nDataId = rCe.CeId(); + + SetResult(done,stay); + eState = expect_const; + } + else + { + On_Default(i_sText); + } +} + +void +PE_Constant::On_expect_const_Stereotype(const char *) +{ + SetResult( done, push_sure, pPE_Type.Ptr() ); +} + +void +PE_Constant::On_expect_const_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == '}') + { + SetResult(done,stay); + eState = expect_finish; + } + else + { + On_Default(i_sText); + } +} + +void +PE_Constant::On_expect_value_Identifier(const char *) +{ + SetResult( not_done, push_sure, pPE_Value.Ptr() ); +} + +void +PE_Constant::On_expect_finish_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == ';') + { + SetResult(done,pop_success); + eState = e_none; + } + else + { + On_Default(i_sText); + } +} + +void +PE_Constant::On_Default(const char * ) +{ + SetResult(not_done,pop_failure); + eState = e_none; +} + +void +PE_Constant::EmptySingleConstData() +{ + nType = 0; + sName = ""; + sAssignment = ""; +} + +void +PE_Constant::CreateSingleConstant() +{ + ary::idl::Constant & + rCe = Gate().Ces().Store_Constant( nDataId, + sName, + nType, + sAssignment ); + pPE_Type->PassDocuAt(rCe); +} + +void +PE_Constant::InitData() +{ + eState = expect_name; + + sData_Name.clear(); + nDataId = 0; + + EmptySingleConstData(); +} + +void +PE_Constant::ReceiveData() +{ + switch (eState) + { + case expect_const: + eState = expect_value; + break; + case expect_value: + { + if (sName.length() == 0 OR sAssignment.length() == 0 OR NOT nType.IsValid()) + { + Cerr() << "Constant without value found." << Endl(); + eState = expect_const; + break; + } + + CreateSingleConstant(); + EmptySingleConstData(); + eState = expect_const; + } break; + default: + SetResult(not_done, pop_failure); + eState = e_none; + } // end switch +} + +void +PE_Constant::TransferData() +{ + csv_assert(nDataId.IsValid()); + eState = e_none; +} + +UnoIDL_PE & +PE_Constant::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_enum2.cxx b/autodoc/source/parser_i/idl/pe_enum2.cxx new file mode 100644 index 000000000000..2990830461b9 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_enum2.cxx @@ -0,0 +1,254 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_enum2.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_enum2.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_enum.hxx> +#include <ary/idl/i_enumvalue.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_evalu.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_keyw.hxx> + + +namespace csi +{ +namespace uidl +{ + + +#ifdef DF +#undef DF +#endif +#define DF &PE_Enum::On_Default + +PE_Enum::F_TOK +PE_Enum::aDispatcher[PE_Enum::e_STATES_MAX][PE_Enum::tt_MAX] = + { { DF, DF }, // e_none + { &PE_Enum::On_expect_name_Identifier, + DF }, // expect_name + { DF, &PE_Enum::On_expect_curl_bracket_open_Punctuation }, // expect_curl_bracket_open + { &PE_Enum::On_expect_value_Identifier, + &PE_Enum::On_expect_value_Punctuation }, // expect_value + { DF, &PE_Enum::On_expect_finish_Punctuation } // expect_finish + }; + + + +inline void +PE_Enum::CallHandler( const char * i_sTokenText, + E_TokenType i_eTokenType ) + { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); } + + + + +PE_Enum::PE_Enum() + : eState(e_none), + sData_Name(), + nDataId(0), + pPE_Value(0), + sName(), + sAssignment() +{ + pPE_Value = new PE_Value(sName, sAssignment, false); +} + +void +PE_Enum::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Value->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Enum::~PE_Enum() +{ +} + +void +PE_Enum::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Enum::Process_Identifier( const TokIdentifier & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_identifier); +} + +void +PE_Enum::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_punctuation); +} + +void +PE_Enum::On_expect_name_Identifier(const char * i_sText) +{ + sName = i_sText; + + SetResult(done,stay); + eState = expect_curl_bracket_open; +} + +void +PE_Enum::On_expect_curl_bracket_open_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == '{') + { + sData_Name = sName; + ary::idl::Enum & + rCe = Gate().Ces().Store_Enum(CurNamespace().CeId(), sData_Name); + PassDocuAt(rCe); + nDataId = rCe.CeId(); + + SetResult(done,stay); + eState = expect_value; + } + else + { + On_Default(i_sText); + } +} + +void +PE_Enum::On_expect_value_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == '}' ) + { + SetResult(done,stay); + eState = expect_finish; + } + else + { + On_Default(i_sText); + } +} + +void +PE_Enum::On_expect_value_Identifier(const char *) +{ + SetResult( not_done, push_sure, pPE_Value.Ptr() ); +} + +void +PE_Enum::On_expect_finish_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == ';') + { + SetResult(done,pop_success); + eState = e_none; + } + else + { + On_Default(i_sText); + } +} + +void +PE_Enum::On_Default(const char * ) +{ + SetResult(not_done,pop_failure); + eState = e_none; +} + +void +PE_Enum::EmptySingleValueData() +{ + sName = ""; + sAssignment = ""; +} + +void +PE_Enum::CreateSingleValue() +{ + ary::idl::EnumValue & + rCe = Gate().Ces().Store_EnumValue( nDataId, sName, sAssignment ); + pPE_Value->PassDocuAt(rCe); +} + +void +PE_Enum::InitData() +{ + eState = expect_name; + + sData_Name.clear(); + nDataId = 0; + + EmptySingleValueData(); +} + +void +PE_Enum::ReceiveData() +{ + switch (eState) + { + case expect_value: + { + if (sName.length() == 0) + { + On_Default(""); + break; + } + + CreateSingleValue(); + EmptySingleValueData(); + } break; + default: + SetResult(not_done, pop_failure); + eState = e_none; + } // end switch +} + +void +PE_Enum::TransferData() +{ + csv_assert(sData_Name.length() > 0); + eState = e_none; +} + +UnoIDL_PE & +PE_Enum::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_evalu.cxx b/autodoc/source/parser_i/idl/pe_evalu.cxx new file mode 100644 index 000000000000..623ac93bfd59 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_evalu.cxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_evalu.cxx,v $ + * $Revision: 1.9 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_evalu.hxx> + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_enumvalue.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tk_const.hxx> + + +namespace csi +{ +namespace uidl +{ + + +#ifdef DF +#undef DF +#endif +#define DF &PE_Value::On_Default + +PE_Value::F_TOK +PE_Value::aDispatcher[PE_Value::e_STATES_MAX][PE_Value::tt_MAX] = + { { DF, DF, DF }, // e_none + { &PE_Value::On_expect_name_Identifier, + DF, DF }, // expect_name + { DF, &PE_Value::On_got_name_Punctuation, + &PE_Value::On_got_name_Assignment } // got_name + }; + + + +inline void +PE_Value::CallHandler( const char * i_sTokenText, + E_TokenType i_eTokenType ) + { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); } + + + + + +PE_Value::PE_Value( String & o_rName, + String & o_rAssignment, + bool i_bIsConst ) + : eState(e_none), + pName(&o_rName), + pAssignment(&o_rAssignment), + bIsConst(i_bIsConst) +{ +} + +void +PE_Value::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); +} + +PE_Value::~PE_Value() +{ +} + +void +PE_Value::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Value::Process_Identifier( const TokIdentifier & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_identifier); +} + +void +PE_Value::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_punctuation); +} + +void +PE_Value::Process_Assignment( const TokAssignment & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_assignment); +} + +void +PE_Value::On_expect_name_Identifier(const char * i_sText) +{ + *pName = i_sText; + SetResult(done,stay); + eState = got_name; +} + +void +PE_Value::On_got_name_Punctuation(const char * i_sText) +{ + if ( (i_sText[0] == ',' AND NOT IsConst()) + OR (i_sText[0] == ';' AND IsConst()) ) + { + SetResult(done,pop_success); + eState = e_none; + } + else if (i_sText[0] == '}' AND NOT IsConst()) + { + SetResult(not_done,pop_success); + eState = e_none; + } + else + On_Default(i_sText); +} + +void +PE_Value::On_got_name_Assignment(const char * i_sText) +{ + *pAssignment = i_sText; + SetResult(done,pop_success); + eState = e_none; +} + +void +PE_Value::On_Default(const char * ) +{ + SetResult(not_done,pop_failure); +} + +void +PE_Value::InitData() +{ + eState = expect_name; + + *pName = ""; + *pAssignment = ""; +} + +void +PE_Value::TransferData() +{ + csv_assert(pName->length() > 0); + eState = e_none; +} + +UnoIDL_PE & +PE_Value::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_excp.cxx b/autodoc/source/parser_i/idl/pe_excp.cxx new file mode 100644 index 000000000000..468faf09c1d6 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_excp.cxx @@ -0,0 +1,301 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_excp.cxx,v $ + * $Revision: 1.8 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_excp.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_exception.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_structelem.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/pe_selem.hxx> + + + +namespace csi +{ +namespace uidl +{ + + +PE_Exception::PE_Exception() + // : aWork, + // pStati +{ + pStati = new S_Stati(*this); +} + +void +PE_Exception::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + Work().pPE_Element->EstablishContacts(this,io_rRepository,o_rResult); + Work().pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Exception::~PE_Exception() +{ +} + +void +PE_Exception::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*Stati().pCurStatus); +} + + +void +PE_Exception::InitData() +{ + Work().InitData(); + Stati().pCurStatus = &Stati().aWaitForName; +} + +void +PE_Exception::TransferData() +{ + if (NOT Work().bIsPreDeclaration) + { + csv_assert(Work().sData_Name.size() > 0); + csv_assert(Work().nCurStruct.IsValid()); + } + Stati().pCurStatus = &Stati().aNone; +} + +void +PE_Exception::ReceiveData() +{ + Stati().pCurStatus->On_SubPE_Left(); +} + +PE_Exception::S_Work::S_Work() + : sData_Name(), + bIsPreDeclaration(false), + nCurStruct(0), + pPE_Element(0), + nCurParsed_ElementRef(0), + pPE_Type(0), + nCurParsed_Base(0) + +{ + pPE_Element = new PE_StructElement(nCurParsed_ElementRef,nCurStruct); + pPE_Type = new PE_Type(nCurParsed_Base); +} + +void +PE_Exception::S_Work::InitData() +{ + sData_Name.clear(); + bIsPreDeclaration = false; + nCurStruct = 0; + + nCurParsed_ElementRef = 0; + nCurParsed_Base = 0; +} + +void +PE_Exception::S_Work::Prepare_PE_QualifiedName() +{ + nCurParsed_ElementRef = 0; +} + +void +PE_Exception::S_Work::Prepare_PE_Element() +{ + nCurParsed_Base = 0; +} + +void +PE_Exception::S_Work::Data_Set_Name( const char * i_sName ) +{ + sData_Name = i_sName; +} + +PE_Exception::S_Stati::S_Stati(PE_Exception & io_rStruct) + : aNone(io_rStruct), + aWaitForName(io_rStruct), + aGotName(io_rStruct), + aWaitForBase(io_rStruct), + aGotBase(io_rStruct), + aWaitForElement(io_rStruct), + aWaitForFinish(io_rStruct), + pCurStatus(0) +{ + pCurStatus = &aNone; +} + + +//*********************** Stati ***************************// + + +UnoIDL_PE & +PE_Exception::PE_StructState::MyPE() +{ + return rStruct; +} + + +void +PE_Exception::State_WaitForName::Process_Identifier( const TokIdentifier & i_rToken ) +{ + Work().Data_Set_Name(i_rToken.Text()); + MoveState( Stati().aGotName ); + SetResult(done,stay); +} + +void +PE_Exception::State_GotName::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if ( i_rToken.Id() != TokPunctuation::Semicolon ) + { + switch (i_rToken.Id()) + { + case TokPunctuation::Colon: + MoveState( Stati().aWaitForBase ); + SetResult(done,push_sure,Work().pPE_Type.Ptr()); + Work().Prepare_PE_QualifiedName(); + break; + case TokPunctuation::CurledBracketOpen: + PE().store_Exception(); + MoveState( Stati().aWaitForElement ); + SetResult(done,stay); + break; + default: + SetResult(not_done,pop_failure); + } // end switch + } + else + { + Work().sData_Name.clear(); + SetResult(done,pop_success); + } +} + +void +PE_Exception::State_WaitForBase::On_SubPE_Left() +{ + MoveState(Stati().aGotBase); +} + +void +PE_Exception::State_GotBase::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if ( i_rToken.Id() == TokPunctuation::CurledBracketOpen ) + { + PE().store_Exception(); + MoveState( Stati().aWaitForElement ); + SetResult(done,stay); + } + else + { + SetResult(not_done,pop_failure); + } +} + +void +PE_Exception::State_WaitForElement::Process_Identifier( const TokIdentifier & ) +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr() ); + Work().Prepare_PE_Element(); +} + +void +PE_Exception::State_WaitForElement::Process_NameSeparator() +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr()); + Work().Prepare_PE_Element(); +} + +void +PE_Exception::State_WaitForElement::Process_BuiltInType( const TokBuiltInType & ) +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr()); + Work().Prepare_PE_Element(); +} + +void +PE_Exception::State_WaitForElement::Process_TypeModifier(const TokTypeModifier & ) +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr()); + Work().Prepare_PE_Element(); +} + +void +PE_Exception::State_WaitForElement::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if ( i_rToken.Id() == TokPunctuation::CurledBracketClose ) + { + MoveState( Stati().aWaitForFinish ); + SetResult( done, stay ); + } + else + { + SetResult( not_done, pop_failure ); + } +} + +void +PE_Exception::State_WaitForFinish::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if (i_rToken.Id() == TokPunctuation::Semicolon) + { + MoveState( Stati().aNone ); + SetResult( done, pop_success ); + } + else + { + SetResult( not_done, pop_failure ); + } +} + +void +PE_Exception::store_Exception() +{ + ary::idl::Exception & + rCe = Gate().Ces().Store_Exception( + CurNamespace().CeId(), + Work().sData_Name, + Work().nCurParsed_Base ); + PassDocuAt(rCe); + Work().nCurStruct = rCe.Id(); +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_file2.cxx b/autodoc/source/parser_i/idl/pe_file2.cxx new file mode 100644 index 000000000000..327952dca04e --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_file2.cxx @@ -0,0 +1,321 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_file2.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_file2.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/distrib.hxx> +#include <s2_luidl/pe_servi.hxx> +#include <s2_luidl/pe_iface.hxx> +#include <s2_luidl/pe_singl.hxx> +#include <s2_luidl/pe_struc.hxx> +#include <s2_luidl/pe_excp.hxx> +#include <s2_luidl/pe_const.hxx> +#include <s2_luidl/pe_enum2.hxx> +#include <s2_luidl/pe_tydf2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + + + +namespace csi +{ +namespace uidl +{ + + +PE_File::PE_File( TokenDistributor & i_rTokenAdmin, + const ParserInfo & i_parseInfo ) + : pTokenAdmin(&i_rTokenAdmin), + pPE_Service(new PE_Service), + pPE_Singleton(new PE_Singleton), + pPE_Interface(new PE_Interface), + pPE_Struct(new PE_Struct), + pPE_Exception(new PE_Exception), + pPE_Constant(new PE_Constant), + pPE_Enum(new PE_Enum), + pPE_Typedef(new PE_Typedef), + pCurNamespace(0), + pParseInfo(&i_parseInfo), + eState(e_none), + nBracketCount_inDefMode(0) +{ +} + +void +PE_File::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Service->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Singleton->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Interface->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Struct->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Exception->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Constant->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Enum->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Typedef->EstablishContacts(this,io_rRepository,o_rResult); + + pCurNamespace = &Gate().Ces().GlobalNamespace(); +} + +PE_File::~PE_File() +{ +} + +void +PE_File::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_File::Process_Identifier( const TokIdentifier & i_rToken ) +{ + switch (eState) + { + case wait_for_module: + { + csv_assert(pCurNamespace != 0); + + ary::idl::Module & rCe = Gate().Ces().CheckIn_Module(pCurNamespace->CeId(), i_rToken.Text()); + pCurNamespace = &rCe; + + // Get docu out of normal: + SetDocu(pTokenAdmin->ReleaseLastParsedDocu()); + PassDocuAt(rCe); + + csv_assert(pCurNamespace != 0); + + SetResult(done, stay); + eState = wait_for_module_bracket; + } break; + case on_default: + SetResult(done, stay); + break; + default: + csv_assert(false); + } +} + +void +PE_File::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + switch (eState) + { + case e_std: + if (i_rToken.Id() == TokPunctuation::CurledBracketClose) + { + csv_assert(pCurNamespace != 0); + + pCurNamespace = &Gate().Ces().Find_Module(pCurNamespace->Owner()); + + SetResult(done, stay); + eState = wait_for_module_semicolon; + } + else + { + csv_assert(false); + } + break; + case wait_for_module_bracket: + if (i_rToken.Id() == TokPunctuation::CurledBracketOpen) + { + SetResult(done, stay); + eState = e_std; + } + else + { + csv_assert(false); + } + break; + case wait_for_module_semicolon: + if (i_rToken.Id() == TokPunctuation::Semicolon) + { + SetResult(done, stay); + eState = e_std; + } + else + { + csv_assert(false); + } + break; + case on_default: + if (i_rToken.Id() == TokPunctuation::CurledBracketClose) + { + nBracketCount_inDefMode--; + } + else if (i_rToken.Id() == TokPunctuation::CurledBracketOpen) + { + nBracketCount_inDefMode++; + } + else if (i_rToken.Id() == TokPunctuation::Semicolon) + { + if (nBracketCount_inDefMode <= 0) + { + eState = e_std; + } + } + SetResult(done, stay); + break; + default: + csv_assert(false); + } +} + +void +PE_File::Process_MetaType( const TokMetaType & i_rToken ) +{ + switch (i_rToken.Id()) + { + case TokMetaType::mt_service: + eState = in_sub_pe; + SetResult( not_done, push_sure, pPE_Service.Ptr()); + break; + case TokMetaType::mt_singleton: + eState = in_sub_pe; + SetResult( not_done, push_sure, pPE_Singleton.Ptr()); + break; + case TokMetaType::mt_uik: + Cerr() << "Syntax error: [uik ....] is obsolete now." << Endl(); + SetResult( not_done, pop_failure); + break; + case TokMetaType::mt_interface: + eState = in_sub_pe; + SetResult( not_done, push_sure, pPE_Interface.Ptr()); + break; + case TokMetaType::mt_module: + eState = wait_for_module; + SetResult( done, stay ); + break; + case TokMetaType::mt_struct: + eState = in_sub_pe; + SetResult( done, push_sure, pPE_Struct.Ptr()); + break; + case TokMetaType::mt_exception: + eState = in_sub_pe; + SetResult( done, push_sure, pPE_Exception.Ptr()); + break; + case TokMetaType::mt_constants: + eState = in_sub_pe; + SetResult( done, push_sure, pPE_Constant.Ptr()); + break; + case TokMetaType::mt_enum: + eState = in_sub_pe; + SetResult( done, push_sure, pPE_Enum.Ptr()); + break; + case TokMetaType::mt_typedef: + eState = in_sub_pe; + SetResult( done, push_sure, pPE_Typedef.Ptr()); + break; + + default: + Process_Default(); + } // end switch +} + +void +PE_File::Process_Stereotype( const TokStereotype & i_rToken ) +{ + if (i_rToken.Id() == TokStereotype::ste_published) + { + pTokenAdmin->Set_PublishedOn(); + + SetResult(done, stay); + } + else + { + Process_Default(); + } +} + +void +PE_File::Process_Default() +{ + if (eState != on_default) + { + eState = on_default; + nBracketCount_inDefMode = 0; + } + SetResult(done, stay); +} + +const ary::idl::Module & +PE_File::CurNamespace() const +{ + csv_assert(pCurNamespace); + return *pCurNamespace; +} + +const ParserInfo & +PE_File::ParseInfo() const +{ + csv_assert(pParseInfo); + return *pParseInfo; +} + +void +PE_File::InitData() +{ + eState = e_std; +} + +void +PE_File::TransferData() +{ + eState = e_none; +} + +void +PE_File::ReceiveData() +{ + eState = e_std; +} + + +UnoIDL_PE & +PE_File::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi + + diff --git a/autodoc/source/parser_i/idl/pe_func2.cxx b/autodoc/source/parser_i/idl/pe_func2.cxx new file mode 100644 index 000000000000..d41491c9a195 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_func2.cxx @@ -0,0 +1,448 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_func2.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_func2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_function.hxx> +#include <ary/idl/i_type.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/idl/ip_type.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/pe_vari2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <x_parse2.hxx> + + +namespace csi +{ +namespace uidl +{ + + +PE_Function::PE_Function( const RParent & i_rCurInterface ) + : eState(e_none), + sData_Name(), + nData_ReturnType(0), + bData_Oneway(false), + pCurFunction(0), + pCurParent(&i_rCurInterface), + pPE_Type(0), + nCurParsedType(0), + sName(), + pPE_Variable(0), + eCurParsedParam_Direction(ary::idl::param_in), + nCurParsedParam_Type(0), + sCurParsedParam_Name(), + bIsForConstructors(false) +{ + pPE_Type = new PE_Type(nCurParsedType); + pPE_Variable = new PE_Variable(nCurParsedParam_Type, sCurParsedParam_Name); +} + +PE_Function::PE_Function( const RParent & i_rCurService, + E_Constructor ) + : eState(expect_name), + sData_Name(), + nData_ReturnType(0), + bData_Oneway(false), + pCurFunction(0), + pCurParent(&i_rCurService), + pPE_Type(0), + nCurParsedType(0), + sName(), + pPE_Variable(0), + eCurParsedParam_Direction(ary::idl::param_in), + nCurParsedParam_Type(0), + sCurParsedParam_Name(), + bIsForConstructors(true) +{ + pPE_Type = new PE_Type(nCurParsedType); + pPE_Variable = new PE_Variable(nCurParsedParam_Type, sCurParsedParam_Name); +} + +void +PE_Function::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Variable->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Function::~PE_Function() +{ +} + +void +PE_Function::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Function::Process_Stereotype( const TokStereotype & i_rToken ) +{ + if (eState == e_start) + { + switch (i_rToken.Id()) + { + case TokStereotype::ste_oneway: + bData_Oneway = true; + SetResult(done, stay); + break; + default: + OnDefault(); + } // end switch + } + else + OnDefault(); +} + +void +PE_Function::Process_Identifier( const TokIdentifier & i_rToken ) +{ + switch (eState) + { + case e_start: + GoIntoReturnType(); + break; + case expect_name: + sData_Name = i_rToken.Text(); + SetResult(done,stay); + eState = expect_params_list; + + if (NOT bIsForConstructors) + { + pCurFunction = &Gate().Ces().Store_Function( + *pCurParent, + sData_Name, + nData_ReturnType, + bData_Oneway ); + } + else + { + pCurFunction = &Gate().Ces().Store_ServiceConstructor( + *pCurParent, + sData_Name ); + } + PassDocuAt(*pCurFunction); + break; + case expect_parameter_variable: + GoIntoParameterVariable(); + break; + case expect_exception: + GoIntoException(); + break; + default: + OnDefault(); + } +} + +void +PE_Function::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + switch (eState) + { + case e_start: + SetResult(done,stay); + break; + case expect_params_list: + if (i_rToken.Id() != TokPunctuation::BracketOpen) + { + OnDefault(); + return; + } + SetResult(done,stay); + eState = expect_parameter; + break; + case expect_parameter: + if (i_rToken.Id() == TokPunctuation::BracketClose) + { + SetResult(done,stay); + eState = params_finished; + } + else + { + OnDefault(); + return; + } + break; + case expect_parameter_separator: + if (i_rToken.Id() == TokPunctuation::Comma) + { + SetResult(done,stay); + eState = expect_parameter; + } + else if (i_rToken.Id() == TokPunctuation::BracketClose) + { + SetResult(done,stay); + eState = params_finished; + } + else + { + OnDefault(); + return; + } + break; + case params_finished: + case exceptions_finished: + if (i_rToken.Id() != TokPunctuation::Semicolon) + { + OnDefault(); + return; + } + SetResult(done,pop_success); + eState = e_none; + break; + case expect_exceptions_list: + if (i_rToken.Id() != TokPunctuation::BracketOpen) + { + OnDefault(); + return; + } + SetResult(done,stay); + eState = expect_exception; + break; + case expect_exception_separator: + if (i_rToken.Id() == TokPunctuation::Comma) + { + SetResult(done,stay); + eState = expect_exception; + } + else if (i_rToken.Id() == TokPunctuation::BracketClose) + { + SetResult(done,stay); + eState = exceptions_finished; + } + else + { + OnDefault(); + return; + } + break; + default: + OnDefault(); + } +} + +void +PE_Function::Process_BuiltInType( const TokBuiltInType & i_rToken ) +{ + switch (eState) + { + case e_start: + GoIntoReturnType(); + break; + case expect_parameter_variable: + GoIntoParameterVariable(); + break; + case expect_parameter_separator: + if (i_rToken.Id() != TokBuiltInType::bty_ellipse) + { + OnDefault(); + } + else + { + pCurFunction->Set_Ellipse(); + SetResult(done,stay); + // eState stays the same, because we wait for the closing ")" now. + } + break; + case expect_exception: + GoIntoException(); + break; + default: + OnDefault(); + } // end switch +} + +void +PE_Function::Process_ParameterHandling( const TokParameterHandling & i_rToken ) +{ + if (eState != expect_parameter) + { + OnDefault(); + return; + } + + switch (i_rToken.Id()) + { + case TokParameterHandling::ph_in: + eCurParsedParam_Direction = ary::idl::param_in; + break; + case TokParameterHandling::ph_out: + eCurParsedParam_Direction = ary::idl::param_out; + break; + case TokParameterHandling::ph_inout: + eCurParsedParam_Direction = ary::idl::param_inout; + break; + default: + csv_assert(false); + } + SetResult(done,stay); + eState = expect_parameter_variable; +} + +void +PE_Function::Process_Raises() +{ + if (eState != params_finished) + { + OnDefault(); + return; + } + SetResult(done,stay); + eState = expect_exceptions_list; +} + +void +PE_Function::Process_Default() +{ + switch (eState) + { + case e_start: + GoIntoReturnType(); + break; + case expect_parameter_variable: + GoIntoParameterVariable(); + break; + case expect_exception: + GoIntoException(); + break; + default: + OnDefault(); + } // end switch +} + +void +PE_Function::GoIntoReturnType() +{ + SetResult(not_done, push_sure, pPE_Type.Ptr()); + eState = in_return_type; +} + +void +PE_Function::GoIntoParameterVariable() +{ + SetResult(not_done, push_sure, pPE_Variable.Ptr()); + eState = in_parameter_variable; +} + +void +PE_Function::GoIntoException() +{ + SetResult(not_done, push_sure, pPE_Type.Ptr()); + eState = in_exception; +} + +void +PE_Function::OnDefault() +{ + throw X_AutodocParser(X_AutodocParser::x_Any); +} + +void +PE_Function::InitData() +{ + eState = e_start; + + sData_Name.clear(); + nData_ReturnType = 0; + bData_Oneway = false; + pCurFunction = 0; + + nCurParsedType = 0; + eCurParsedParam_Direction = ary::idl::param_in; + nCurParsedParam_Type = 0; + sCurParsedParam_Name.clear(); + + if (bIsForConstructors) + { + eState = expect_name; + } +} + +void +PE_Function::ReceiveData() +{ + switch (eState) + { + case in_return_type: + nData_ReturnType = nCurParsedType; + nCurParsedType = 0; + eState = expect_name; + break; + case in_parameter_variable: + csv_assert(pCurFunction != 0); + pCurFunction->Add_Parameter( + sCurParsedParam_Name, + nCurParsedParam_Type, + eCurParsedParam_Direction ); + sCurParsedParam_Name = ""; + nCurParsedParam_Type = 0; + eCurParsedParam_Direction = ary::idl::param_in; + eState = expect_parameter_separator; + break; + case in_exception: + csv_assert(pCurFunction != 0); + pCurFunction->Add_Exception(nCurParsedType); + eState = expect_exception_separator; + break; + default: + csv_assert(false); + } // end switch +} + +void +PE_Function::TransferData() +{ + pCurFunction = 0; + eState = e_none; +} + +UnoIDL_PE & +PE_Function::MyPE() +{ + return *this; +} + + + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_iface.cxx b/autodoc/source/parser_i/idl/pe_iface.cxx new file mode 100644 index 000000000000..d6418dfcf1d9 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_iface.cxx @@ -0,0 +1,470 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_iface.cxx,v $ + * $Revision: 1.14 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_iface.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_interface.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_func2.hxx> +#include <s2_luidl/pe_attri.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <adc_cl.hxx> + + + +namespace csi +{ +namespace uidl +{ + +#ifdef DF +#undef DF +#endif +#define DF &PE_Interface::On_Default + +PE_Interface::F_TOK +PE_Interface::aDispatcher[PE_Interface::e_STATES_MAX][PE_Interface::tt_MAX] = + { { DF, DF, DF, DF, DF }, // e_none + { &PE_Interface::On_need_uik_MetaType, + DF, DF, DF, DF }, // need_uik + { DF, &PE_Interface::On_uik_Identifier, + &PE_Interface::On_uik_Punctuation, + DF, DF }, // uik + { &PE_Interface::On_need_ident_MetaType, + DF, DF, DF, DF }, // need_ident + { DF, &PE_Interface::On_ident_Identifier, + &PE_Interface::On_ident_Punctuation, + DF, DF }, // ident + { &PE_Interface::On_need_interface_MetaType, + DF, DF, DF, DF }, // need_interface + { DF, &PE_Interface::On_need_name_Identifer, + DF, DF, DF }, // need_name + { DF, DF, &PE_Interface::On_wait_for_base_Punctuation, + DF, DF }, // wait_for_base + { DF, DF, DF, DF, DF }, // in_base + { DF, DF, &PE_Interface::On_need_curlbr_open_Punctuation, + DF, DF }, // need_curlbr_open + { &PE_Interface::On_std_Metatype, + &PE_Interface::On_std_GotoFunction, + &PE_Interface::On_std_Punctuation, + &PE_Interface::On_std_GotoFunction, + &PE_Interface::On_std_Stereotype }, // e_std + { DF, DF, DF, DF, DF }, // in_function + { DF, DF, DF, DF, DF }, // in_attribute + { DF, DF, &PE_Interface::On_need_finish_Punctuation, + DF, DF }, // need_finish + { DF, DF, DF, DF, DF } // in_base_interface + }; + + + +inline void +PE_Interface::CallHandler( const char * i_sTokenText, + E_TokenType i_eTokenType ) + { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); } + + + +PE_Interface::PE_Interface() + : eState(e_none), + sData_Name(), + bIsPreDeclaration(false), + pCurInterface(0), + nCurInterface(0), + pPE_Function(0), + pPE_Attribute(0), + pPE_Type(0), + nCurParsed_Base(0), + bOptionalMember(false) +{ + pPE_Function = new PE_Function(nCurInterface); + pPE_Type = new PE_Type(nCurParsed_Base); + pPE_Attribute = new PE_Attribute(nCurInterface); +} + +void +PE_Interface::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Function->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Attribute->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Interface::~PE_Interface() +{ +} + +void +PE_Interface::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + + +void +PE_Interface::Process_MetaType( const TokMetaType & i_rToken ) +{ + CallHandler( i_rToken.Text(), tt_metatype ); +} + +void +PE_Interface::Process_Identifier( const TokIdentifier & i_rToken ) +{ + CallHandler( i_rToken.Text(), tt_identifier ); +} + +void +PE_Interface::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + CallHandler( i_rToken.Text(), tt_punctuation ); +} + +void +PE_Interface::Process_NameSeparator() +{ + CallHandler( "", tt_startoftype ); +} + +void +PE_Interface::Process_BuiltInType( const TokBuiltInType & i_rToken ) +{ + CallHandler( i_rToken.Text(), tt_startoftype ); +} + +void +PE_Interface::Process_TypeModifier( const TokTypeModifier & i_rToken ) +{ + CallHandler( i_rToken.Text(), tt_startoftype ); +} + +void +PE_Interface::Process_Stereotype( const TokStereotype & i_rToken ) +{ + CallHandler( i_rToken.Text(), tt_stereotype ); +} + +void +PE_Interface::Process_Default() +{ + SetResult(done, stay); +} + + +void +PE_Interface::On_need_uik_MetaType(const char *) +{ + // Deprecated, data will be ignored + SetResult(done, stay); + eState = uik; +} + +void +PE_Interface::On_uik_Identifier(const char *) +{ + // Deprecated, data will be ignored + SetResult(done, stay); +} + +void +PE_Interface::On_uik_Punctuation(const char * i_sText) +{ + // Deprecated, data will be ignored + SetResult(done, stay); + if (strcmp(",",i_sText) == 0) + { + eState = need_ident; + } +} + +void +PE_Interface::On_need_ident_MetaType(const char *) +{ + SetResult(done, stay); + eState = ident; +} + +void +PE_Interface::On_ident_Identifier(const char *) +{ + SetResult(done, stay); +} + +void +PE_Interface::On_ident_Punctuation(const char * i_sText) +{ + SetResult(done, stay); + if (strcmp(")",i_sText) == 0) + { + eState = need_interface; + } +} + +void +PE_Interface::On_need_interface_MetaType(const char *) +{ + SetResult(done, stay); + eState = need_name; +} + +void +PE_Interface::On_need_name_Identifer(const char * i_sText) +{ + SetResult(done, stay); + sData_Name = i_sText; + eState = wait_for_base; +} + +void +PE_Interface::On_wait_for_base_Punctuation(const char * i_sText) +{ + if (i_sText[0] != ';') + { + switch (i_sText[0]) + { + case ':': + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_base; + break; + case '{': + store_Interface(); + + SetResult(done,stay); + eState = e_std; + break; + default: + SetResult(not_done, pop_failure); + eState = e_none; + } // end switch + } + else + { + bIsPreDeclaration = true; + SetResult(done, pop_success); + eState = e_none; + } +} + +void +PE_Interface::On_need_curlbr_open_Punctuation(const char * i_sText) +{ + if (i_sText[0] == '{') + { + store_Interface(); + + SetResult(done, stay); + eState = e_std; + } + else { + csv_assert(false); + } +} + + +void +PE_Interface::On_std_Metatype(const char * i_sText) +{ + if (strcmp(i_sText,"attribute") == 0) + On_std_GotoAttribute(i_sText); + else if (strcmp(i_sText,"interface") == 0) + On_std_GotoBaseInterface(i_sText); + else + On_std_GotoFunction(i_sText); +} + +void +PE_Interface::On_std_Punctuation(const char * i_sText) +{ + switch (i_sText[0]) + { + case '}': + SetResult(done, stay); + eState = need_finish; + break; + case ';': // Appears after base interface declarations. + SetResult(done, stay); + break; + default: + SetResult(not_done, pop_failure); + eState = e_none; + } // end switch +} + +void +PE_Interface::On_std_Stereotype(const char * i_sText) +{ + if (strcmp(i_sText,"oneway") == 0) + On_std_GotoFunction(i_sText); + else if ( strcmp(i_sText,"readonly") == 0 + OR strcmp(i_sText,"bound") == 0 ) + On_std_GotoAttribute(i_sText); + else if (strcmp(i_sText,"optional") == 0) + { + bOptionalMember = true; + SetResult(done, stay); + } + else + SetResult(not_done, pop_failure); +} + +void +PE_Interface::On_std_GotoFunction(const char * ) +{ + SetResult(not_done, push_sure, pPE_Function.Ptr()); + eState = in_function; +} + +void +PE_Interface::On_std_GotoAttribute(const char * ) +{ + SetResult(not_done, push_sure, pPE_Attribute.Ptr()); + eState = in_attribute; +} + +void +PE_Interface::On_std_GotoBaseInterface(const char * ) +{ + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_base_interface; +} + +void +PE_Interface::On_need_finish_Punctuation(const char * i_sText) +{ + switch (i_sText[0]) + { + case ';': + SetResult(done, pop_success); + eState = e_none; + break; + default: + SetResult(not_done, pop_failure); + eState = e_none; + } // end switch +} + +void +PE_Interface::On_Default(const char *) +{ + SetResult(not_done, pop_failure); +} + +void +PE_Interface::InitData() +{ + eState = need_interface; + + sData_Name.clear(); + bIsPreDeclaration = false; + pCurInterface = 0; + nCurInterface = 0; + nCurParsed_Base = 0; + bOptionalMember = false; +} + +void +PE_Interface::TransferData() +{ + if (NOT bIsPreDeclaration) + { + csv_assert(sData_Name.size() > 0); + csv_assert(nCurInterface.IsValid()); + } + else + { + sData_Name.clear(); + pCurInterface = 0; + nCurInterface = 0; + } + + eState = e_none; +} + +void +PE_Interface::ReceiveData() +{ + switch (eState) + { + case in_base: + eState = need_curlbr_open; + break; + case in_function: + eState = e_std; + break; + case in_attribute: + eState = e_std; + break; + case in_base_interface: + if (bOptionalMember) + { + pPE_Type->SetOptional(); + bOptionalMember = false; + } + pCurInterface->Add_Base( + nCurParsed_Base, + pPE_Type->ReleaseDocu()); + nCurParsed_Base = 0; + eState = e_std; + break; + default: + csv_assert(false); + } +} + +UnoIDL_PE & +PE_Interface::MyPE() +{ + return *this; +} + +void +PE_Interface::store_Interface() +{ + pCurInterface = & Gate().Ces().Store_Interface( + CurNamespace().CeId(), + sData_Name, + nCurParsed_Base ); + nCurInterface = pCurInterface->CeId(); + PassDocuAt(*pCurInterface); +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_property.cxx b/autodoc/source/parser_i/idl/pe_property.cxx new file mode 100644 index 000000000000..7b065879d012 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_property.cxx @@ -0,0 +1,241 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_property.cxx,v $ + * $Revision: 1.7 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_property.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_property.hxx> +#include <ary/idl/i_service.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_vari2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + + +namespace csi +{ +namespace uidl +{ + + + +PE_Property::PE_Property( const Ce_id & i_rCurOwner ) + : eState(e_none), + pCurOwner(&i_rCurOwner), + pPE_Variable(0), + nCurParsedType(0), + sCurParsedName(), + bIsOptional(false), + aStereotypes() +{ + pPE_Variable = new PE_Variable(nCurParsedType, sCurParsedName); +} + +void +PE_Property::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Variable->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Property::~PE_Property() +{ +} + +void +PE_Property::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Property::Process_Stereotype( const TokStereotype & i_rToken ) +{ + switch (i_rToken.Id()) + { + case TokStereotype::ste_optional: + bIsOptional = true; + break; + case TokStereotype::ste_readonly: + aStereotypes.Set_Flag(Stereotypes::readonly); + break; + case TokStereotype::ste_bound: + aStereotypes.Set_Flag(Stereotypes::bound); + break; + case TokStereotype::ste_constrained: + aStereotypes.Set_Flag(Stereotypes::constrained); + break; + case TokStereotype::ste_maybeambiguous: + aStereotypes.Set_Flag(Stereotypes::maybeambiguous); + break; + case TokStereotype::ste_maybedefault: + aStereotypes.Set_Flag(Stereotypes::maybedefault); + break; + case TokStereotype::ste_maybevoid: + aStereotypes.Set_Flag(Stereotypes::maybevoid); + break; + case TokStereotype::ste_removable: + aStereotypes.Set_Flag(Stereotypes::removable); + break; + case TokStereotype::ste_transient: + aStereotypes.Set_Flag(Stereotypes::transient); + break; + + default: + SetResult(not_done, pop_failure); + eState = e_none; + return; + } + + SetResult(done, stay); +} + +void +PE_Property::Process_MetaType( const TokMetaType & i_rToken ) +{ + if (eState == e_start) + { + if ( i_rToken.Id() == TokMetaType::mt_property ) + { + SetResult(done, stay); + eState = expect_variable; + return; + } + } // endif (eState == e_start) + + SetResult(not_done, pop_failure); + eState = e_none; +} + +void +PE_Property::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + switch (eState) + { + case e_start: + SetResult(done, stay); + break; + case expect_variable: + if (i_rToken.Id() == TokPunctuation::Semicolon) + { + SetResult(done, pop_success); + eState = e_none; + } + else if (i_rToken.Id() == TokPunctuation::Comma) + SetResult(done, stay); + else + SetResult(not_done, pop_failure); + break; + default: + csv_assert(false); + } +} + +void +PE_Property::Process_Default() +{ + if (eState == expect_variable) + { + SetResult(not_done, push_sure, pPE_Variable.Ptr()); + eState = in_variable; + } + else + SetResult(not_done, pop_failure); +} + +void +PE_Property::InitData() +{ + eState = e_start; + + nCurParsedType = 0; + sCurParsedName = ""; + + // bIsOptional and + // aStereotypes + // may be preset by the PE_Service-(or PE_Interface-)parent + // with PresetOptional() or + // PresetStereotype() + // - therefore it must not be set here! +} + +void +PE_Property::TransferData() +{ + if (bIsOptional) + { + SetOptional(); + bIsOptional = false; + } + + ary::idl::CodeEntity * + pCe = 0; + csv_assert(pCurOwner->IsValid()); + + pCe = &Gate().Ces().Store_Property( *pCurOwner, + sCurParsedName, + nCurParsedType, + aStereotypes ); + + csv_assert(pCe != 0); + PassDocuAt(*pCe); + + nCurParsedType = 0; + sCurParsedName.clear(); + aStereotypes = Stereotypes(); + + eState = e_none; +} + +void +PE_Property::ReceiveData() +{ + eState = expect_variable; +} + + +UnoIDL_PE & +PE_Property::MyPE() +{ + return *this; +} + + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_selem.cxx b/autodoc/source/parser_i/idl/pe_selem.cxx new file mode 100644 index 000000000000..3a525f8b0b2c --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_selem.cxx @@ -0,0 +1,208 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_selem.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_selem.hxx> + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_struct.hxx> +#include <ary/idl/i_structelem.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + +namespace csi +{ +namespace uidl +{ + +namespace +{ + const String C_sNone; +} + +PE_StructElement::PE_StructElement( RStructElement & o_rResult, + const RStruct & i_rCurStruct, + const String & i_rCurStructTemplateParam ) + : eState(e_none), + pResult(&o_rResult), + pCurStruct(&i_rCurStruct), + bIsExceptionElement(false), + pPE_Type(0), + nType(0), + sName(), + pCurStructTemplateParam(&i_rCurStructTemplateParam) +{ + pPE_Type = new PE_Type(nType); +} + +PE_StructElement::PE_StructElement( RStructElement & o_rResult, + const RStruct & i_rCurExc ) + : eState(e_none), + pResult(&o_rResult), + pCurStruct(&i_rCurExc), + bIsExceptionElement(true), + pPE_Type(0), + nType(0), + sName(), + pCurStructTemplateParam(&C_sNone) +{ + pPE_Type = new PE_Type(nType); +} + +void +PE_StructElement::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_StructElement::~PE_StructElement() +{ +} + +void +PE_StructElement::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_StructElement::Process_Default() +{ + if (eState == expect_type) + { + SetResult( not_done, push_sure, pPE_Type.Ptr() ); + eState = expect_name; + } + else { + csv_assert(false); + } +} + +void +PE_StructElement::Process_Identifier( const TokIdentifier & i_rToken ) +{ + csv_assert(*i_rToken.Text() != 0); + + if (eState == expect_type) + { + if ( *pCurStructTemplateParam == i_rToken.Text() ) + { + nType = lhf_FindTemplateParamType(); + SetResult( done, stay ); + eState = expect_name; + } + else // No template parameter type existing, or not matching: + { + SetResult( not_done, push_sure, pPE_Type.Ptr() ); + eState = expect_name; + } + } + else if (eState == expect_name) + { + sName = i_rToken.Text(); + SetResult( done, stay ); + eState = expect_finish; + } + else { + csv_assert(false); + } +} + +void +PE_StructElement::Process_Punctuation( const TokPunctuation &) +{ + csv_assert(eState == expect_finish); + + SetResult( done, pop_success ); +} + +void +PE_StructElement::InitData() +{ + eState = expect_type; + + nType = 0; + sName = ""; +} + +void +PE_StructElement::TransferData() +{ + csv_assert(pResult != 0 AND pCurStruct != 0); + + ary::idl::StructElement * + pCe = 0; + if (bIsExceptionElement) + { + pCe = & Gate().Ces().Store_ExceptionMember( + *pCurStruct, + sName, + nType ); + } + else + { + pCe = & Gate().Ces().Store_StructMember( + *pCurStruct, + sName, + nType ); + } + *pResult = pCe->CeId(); + PassDocuAt(*pCe); + + eState = e_none; +} + +UnoIDL_PE & +PE_StructElement::MyPE() +{ + return *this; +} + +ary::idl::Type_id +PE_StructElement::lhf_FindTemplateParamType() const +{ + const ary::idl::CodeEntity & + rCe = Gate().Ces().Find_Ce(*pCurStruct); + const ary::idl::Struct & + rStruct = static_cast< const ary::idl::Struct& >(rCe); + return rStruct.TemplateParameterType(); +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_servi.cxx b/autodoc/source/parser_i/idl/pe_servi.cxx new file mode 100644 index 000000000000..c540ff1d1820 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_servi.cxx @@ -0,0 +1,396 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_servi.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_servi.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_service.hxx> +#include <ary/idl/i_siservice.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_func2.hxx> +#include <s2_luidl/pe_property.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + + +namespace csi +{ +namespace uidl +{ + + + +PE_Service::PE_Service() + : eState(e_none), + sData_Name(), + bIsPreDeclaration(false), + pCurService(0), + pCurSiService(0), + nCurService(0), + pPE_Property(0), + nCurParsed_Property(0), + pPE_Type(0), + nCurParsed_Type(0), + pPE_Constructor(0), + bOptionalMember(false) +{ + pPE_Property = new PE_Property(nCurService); + pPE_Type = new PE_Type(nCurParsed_Type); + pPE_Constructor = new PE_Function(nCurService, PE_Function::constructor); +} + +void +PE_Service::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Property->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); + pPE_Constructor->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Service::~PE_Service() +{ +} + +void +PE_Service::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + + +void +PE_Service::Process_MetaType( const TokMetaType & i_rToken ) +{ + switch ( i_rToken.Id() ) + { + case TokMetaType::mt_service: + if (eState == need_name) + SetResult(done, stay ); + else if (eState == e_std) + { + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_service_type; + } + else + On_Default(); + break; + case TokMetaType::mt_interface: + if (eState == e_std) + { + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_ifc_type; + } + else + On_Default(); + break; + case TokMetaType::mt_property: + if (eState == e_std) + { + StartProperty(); + } + else + On_Default(); + break; + default: + // KORR_FUTURE: + // Should throw syntax error warning. + ; + } // end switch +} + +void +PE_Service::Process_Identifier( const TokIdentifier & i_rToken ) +{ + if (eState == need_name) + { + sData_Name = i_rToken.Text(); + SetResult(done, stay); + eState = need_curlbr_open; + } + else if (eState == e_std_sib) + { + SetResult(not_done, push_sure, pPE_Constructor.Ptr()); + } + else + On_Default(); +} + +void +PE_Service::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + switch (i_rToken.Id()) + { + case TokPunctuation::Colon: + if (eState == need_curlbr_open) + { + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = need_base_interface; + } + else + On_Default(); + break; + + case TokPunctuation::CurledBracketOpen: + if (eState == need_curlbr_open) + { + pCurService = &Gate().Ces().Store_Service( + CurNamespace().CeId(), + sData_Name ); + nCurService = pCurService->CeId(); + PassDocuAt(*pCurService); + SetResult(done, stay); + eState = e_std; + } + else if (eState == need_curlbr_open_sib) + { + SetResult(done, stay); + eState = e_std_sib; + } + else + On_Default(); + break; + case TokPunctuation::CurledBracketClose: + if (eState == e_std OR eState == e_std_sib) + { + SetResult(done, stay); + eState = need_finish; + } + else + On_Default(); + break; + case TokPunctuation::Comma: + if (eState == expect_ifc_separator) + { + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_ifc_type; + } + else if (eState == expect_service_separator) + { + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_service_type; + } + else if (eState == e_std) + { + SetResult(done, stay); + } + else + On_Default(); + break; + case TokPunctuation::Semicolon: + switch (eState) + { + case need_curlbr_open: + sData_Name.clear(); + bIsPreDeclaration = true; + SetResult(done, pop_success); + eState = e_none; + break; + case need_curlbr_open_sib: + SetResult(done, pop_success); + eState = e_none; + break; + case expect_ifc_separator: + case expect_service_separator: + SetResult(done, stay); + eState = e_std; + break; + case need_finish: + SetResult(done, pop_success); + eState = e_none; + break; + case at_ignore: + SetResult(done, stay); + eState = e_std; + break; + default: + On_Default(); + } // end switch + break; + default: + On_Default(); + } // end switch +} + +void +PE_Service::Process_Stereotype( const TokStereotype & i_rToken ) +{ + if (i_rToken.Id() == TokStereotype::ste_optional) + { + bOptionalMember = true; + SetResult(done, stay); + } + else if ( eState == e_std ) + { + StartProperty(); + } + else + On_Default(); +} + +void +PE_Service::Process_Needs() +{ + SetResult(done,stay); + eState = at_ignore; +} + +void +PE_Service::Process_Observes() +{ + SetResult(done,stay); + eState = at_ignore; +} + +void +PE_Service::Process_Default() +{ + On_Default(); +} + + +void +PE_Service::On_Default() +{ + if (eState == at_ignore) + SetResult(done, stay); + else + SetResult(not_done, pop_failure); +} + +void +PE_Service::InitData() +{ + eState = need_name; + sData_Name.clear(); + bIsPreDeclaration = false; + pCurService = 0; + pCurSiService = 0; + nCurService = 0; + nCurParsed_Property = 0; + nCurParsed_Type = 0; + bOptionalMember = false; +} + +void +PE_Service::TransferData() +{ + if (NOT bIsPreDeclaration) + { + csv_assert(sData_Name.size() > 0); + csv_assert( (pCurService != 0) != (pCurSiService != 0) ); + } + + eState = e_none; +} + +void +PE_Service::ReceiveData() +{ + switch (eState) + { + case in_property: + eState = e_std; + break; + case in_ifc_type: + if (bOptionalMember) + { + pPE_Type->SetOptional(); + } + pCurService->AddRef_SupportedInterface( + nCurParsed_Type, + pPE_Type->ReleaseDocu()); + nCurParsed_Type = 0; + eState = expect_ifc_separator; + break; + case in_service_type: + if (bOptionalMember) + { + pPE_Type->SetOptional(); + } + pCurService->AddRef_IncludedService( + nCurParsed_Type, + pPE_Type->ReleaseDocu()); + nCurParsed_Type = 0; + eState = expect_service_separator; + break; + case need_base_interface: + pCurSiService = &Gate().Ces().Store_SglIfcService( + CurNamespace().CeId(), + sData_Name, + nCurParsed_Type ); + nCurService = pCurSiService->CeId(); + PassDocuAt(*pCurSiService); + + nCurParsed_Type = 0; + eState = need_curlbr_open_sib; + break; + case e_std_sib: + break; + default: + csv_assert(false); + } + + bOptionalMember = false; +} + + +UnoIDL_PE & +PE_Service::MyPE() +{ + return *this; +} + +void +PE_Service::StartProperty() +{ + SetResult(not_done, push_sure, pPE_Property.Ptr()); + eState = in_property; + + if (bOptionalMember) + { + pPE_Property->PresetOptional(); + bOptionalMember = false; + } +} + + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_singl.cxx b/autodoc/source/parser_i/idl/pe_singl.cxx new file mode 100644 index 000000000000..2d6cbfa93181 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_singl.cxx @@ -0,0 +1,275 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_singl.cxx,v $ + * $Revision: 1.8 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_singl.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_singleton.hxx> +#include <ary/idl/i_sisingleton.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + + +namespace csi +{ +namespace uidl +{ + + + +#if 0 +#ifdef DF +#undef DF +#endif +#define DF &PE_Singleton::On_Default + + +PE_Singleton::F_TOK +PE_Singleton::aDispatcher[PE_Singleton::e_STATES_MAX][PE_Singleton::tt_MAX] = + { { DF, DF, DF }, // e_none + { DF, &PE_Singleton::On_need_name_Identifer, + DF }, // need_name + { DF, DF, &PE_Singleton::On_need_curlbr_open_Punctuation, + }, // need_curlbr_open + { &PE_Singleton::On_std_GotoService, + DF, &PE_Singleton::On_std_Punctuation, + }, // e_std + { DF, DF, DF }, // in_service + { DF, DF, &PE_Interface::On_need_finish_Punctuation, + } // need_finish + }; +#endif // 0 + + +PE_Singleton::PE_Singleton() + : eState(e_none), + sData_Name(), + bIsPreDeclaration(false), + pCurSingleton(0), + pCurSiSingleton(0), + pPE_Type(0), + nCurParsed_Type(0) +{ + pPE_Type = new PE_Type(nCurParsed_Type); +} + +void +PE_Singleton::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Singleton::~PE_Singleton() +{ +} + +void +PE_Singleton::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + + +void +PE_Singleton::Process_MetaType( const TokMetaType & i_rToken ) +{ + switch ( i_rToken.Id() ) + { + case TokMetaType::mt_service: + if (eState == e_std) + { + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_service; + } + else + On_Default(); + break; + case TokMetaType::mt_singleton: + if (eState == need_name) + SetResult(done, stay); + else + On_Default(); + break; + default: + // KORR_FUTURE + // Should throw syntax error warning + ; + + } // end switch +} + +void +PE_Singleton::Process_Identifier( const TokIdentifier & i_rToken ) +{ + if (eState == need_name) + { + sData_Name = i_rToken.Text(); + SetResult(done, stay); + eState = need_curlbr_open; + } + else + On_Default(); +} + +void +PE_Singleton::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + switch (i_rToken.Id()) + { + case TokPunctuation::CurledBracketOpen: + if (eState == need_curlbr_open) + { + pCurSingleton = &Gate().Ces().Store_Singleton( + CurNamespace().CeId(), + sData_Name ); + PassDocuAt(*pCurSingleton); + SetResult(done, stay); + eState = e_std; + } + else + On_Default(); + break; + case TokPunctuation::CurledBracketClose: + if (eState == e_std) + { + SetResult(done, stay); + eState = need_finish; + } + else + On_Default(); + break; + case TokPunctuation::Semicolon: + switch (eState) + { + case e_std: SetResult(done, stay); + break; + case need_finish: + SetResult(done, pop_success); + eState = e_none; + break; + default: + On_Default(); + } // end switch + break; + case TokPunctuation::Colon: + switch (eState) + { + case need_curlbr_open: + SetResult(done, push_sure, pPE_Type.Ptr()); + eState = in_base_interface; + break; + default: + On_Default(); + } // end switch + break; + default: + On_Default(); + } // end switch +} + +void +PE_Singleton::Process_Default() +{ + On_Default(); +} + + +void +PE_Singleton::On_Default() +{ + SetResult(not_done, pop_failure); +} + +void +PE_Singleton::InitData() +{ + eState = need_name; + sData_Name.clear(); + bIsPreDeclaration = false; + pCurSingleton = 0; + pCurSiSingleton = 0; + nCurParsed_Type = 0; +} + +void +PE_Singleton::TransferData() +{ + if (NOT bIsPreDeclaration) + { + csv_assert(sData_Name.size() > 0); + csv_assert( (pCurSingleton != 0) != (pCurSiSingleton != 0) ); + } + + eState = e_none; +} + +void +PE_Singleton::ReceiveData() +{ + switch (eState) + { + case in_service: + pCurSingleton->Set_Service(nCurParsed_Type); + nCurParsed_Type = 0; + eState = e_std; + break; + case in_base_interface: + pCurSiSingleton = &Gate().Ces().Store_SglIfcSingleton( + CurNamespace().CeId(), + sData_Name, + nCurParsed_Type ); + PassDocuAt(*pCurSiSingleton); + nCurParsed_Type = 0; + eState = need_finish; + break; + default: + csv_assert(false); + } // end switch +} + +UnoIDL_PE & +PE_Singleton::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_struc.cxx b/autodoc/source/parser_i/idl/pe_struc.cxx new file mode 100644 index 000000000000..fac3cc5304bc --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_struc.cxx @@ -0,0 +1,330 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_struc.cxx,v $ + * $Revision: 1.9 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_struc.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_struct.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/pe_selem.hxx> + + + +namespace csi +{ +namespace uidl +{ + + +PE_Struct::PE_Struct() + // : aWork, + // pStati +{ + pStati = new S_Stati(*this); +} + +void +PE_Struct::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + Work().pPE_Element->EstablishContacts(this,io_rRepository,o_rResult); + Work().pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Struct::~PE_Struct() +{ +} + +void +PE_Struct::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*Stati().pCurStatus); +} + + +void +PE_Struct::InitData() +{ + Work().InitData(); + Stati().pCurStatus = &Stati().aWaitForName; +} + +void +PE_Struct::TransferData() +{ + if (NOT Work().bIsPreDeclaration) + { + csv_assert(Work().sData_Name.size() > 0); + csv_assert(Work().nCurStruct.IsValid()); + } + Stati().pCurStatus = &Stati().aNone; +} + +void +PE_Struct::ReceiveData() +{ + Stati().pCurStatus->On_SubPE_Left(); +} + +PE_Struct::S_Work::S_Work() + : sData_Name(), + sData_TemplateParam(), + bIsPreDeclaration(false), + nCurStruct(0), + pPE_Element(0), + nCurParsed_ElementRef(0), + pPE_Type(0), + nCurParsed_Base(0) + +{ + pPE_Element = new PE_StructElement(nCurParsed_ElementRef,nCurStruct,sData_TemplateParam); + pPE_Type = new PE_Type(nCurParsed_Base); +} + +void +PE_Struct::S_Work::InitData() +{ + sData_Name.clear(); + sData_TemplateParam.clear(); + bIsPreDeclaration = false; + nCurStruct = 0; + nCurParsed_ElementRef = 0; + nCurParsed_Base = 0; +} + +void +PE_Struct::S_Work::Prepare_PE_QualifiedName() +{ + nCurParsed_ElementRef = 0; +} + +void +PE_Struct::S_Work::Prepare_PE_Element() +{ + nCurParsed_Base = 0; +} + +void +PE_Struct::S_Work::Data_Set_Name( const char * i_sName ) +{ + sData_Name = i_sName; +} + +void +PE_Struct::S_Work::Data_Set_TemplateParam( const char * i_sTemplateParam ) +{ + sData_TemplateParam = i_sTemplateParam; +} + +PE_Struct::S_Stati::S_Stati(PE_Struct & io_rStruct) + : aNone(io_rStruct), + aWaitForName(io_rStruct), + aGotName(io_rStruct), + aWaitForTemplateParam(io_rStruct), + aWaitForTemplateEnd(io_rStruct), + aWaitForBase(io_rStruct), + aGotBase(io_rStruct), + aWaitForElement(io_rStruct), + aWaitForFinish(io_rStruct), + pCurStatus(0) +{ + pCurStatus = &aNone; +} + + +//*********************** Stati ***************************// + + +UnoIDL_PE & +PE_Struct::PE_StructState::MyPE() +{ + return rStruct; +} + + +void +PE_Struct::State_WaitForName::Process_Identifier( const TokIdentifier & i_rToken ) +{ + Work().Data_Set_Name(i_rToken.Text()); + MoveState( Stati().aGotName ); + SetResult(done,stay); +} + +void +PE_Struct::State_GotName::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if ( i_rToken.Id() != TokPunctuation::Semicolon ) + { + switch (i_rToken.Id()) + { + case TokPunctuation::Colon: + MoveState( Stati().aWaitForBase ); + SetResult(done,push_sure,Work().pPE_Type.Ptr()); + Work().Prepare_PE_QualifiedName(); + break; + case TokPunctuation::CurledBracketOpen: + PE().store_Struct(); + MoveState( Stati().aWaitForElement ); + SetResult(done,stay); + break; + case TokPunctuation::Lesser: + MoveState( Stati().aWaitForTemplateParam ); + SetResult(done,stay); + break; + default: + SetResult(not_done,pop_failure); + } // end switch + } + else + { + Work().sData_Name.clear(); + SetResult(done,pop_success); + } +} + +void +PE_Struct::State_WaitForTemplateParam::Process_Identifier( const TokIdentifier & i_rToken ) +{ + Work().Data_Set_TemplateParam(i_rToken.Text()); + MoveState( Stati().aWaitForTemplateEnd ); + SetResult(done,stay); +} + +void +PE_Struct::State_WaitForTemplateEnd::Process_Punctuation( const TokPunctuation & ) +{ + // Assume: TokPunctuation::Greater + MoveState( Stati().aGotName ); + SetResult(done,stay); +} + +void +PE_Struct::State_WaitForBase::On_SubPE_Left() +{ + MoveState(Stati().aGotBase); +} + +void +PE_Struct::State_GotBase::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if ( i_rToken.Id() == TokPunctuation::CurledBracketOpen ) + { + PE().store_Struct(); + MoveState( Stati().aWaitForElement ); + SetResult(done,stay); + } + else + { + SetResult(not_done,pop_failure); + } +} + +void +PE_Struct::State_WaitForElement::Process_Identifier( const TokIdentifier & ) +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr() ); + Work().Prepare_PE_Element(); +} + +void +PE_Struct::State_WaitForElement::Process_NameSeparator() +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr()); + Work().Prepare_PE_Element(); +} + +void +PE_Struct::State_WaitForElement::Process_BuiltInType( const TokBuiltInType & ) +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr()); + Work().Prepare_PE_Element(); +} + +void +PE_Struct::State_WaitForElement::Process_TypeModifier(const TokTypeModifier & ) +{ + SetResult( not_done, push_sure, Work().pPE_Element.Ptr()); + Work().Prepare_PE_Element(); +} + +void +PE_Struct::State_WaitForElement::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if ( i_rToken.Id() == TokPunctuation::CurledBracketClose ) + { + MoveState( Stati().aWaitForFinish ); + SetResult( done, stay ); + } + else + { + SetResult( not_done, pop_failure ); + } +} + +void +PE_Struct::State_WaitForFinish::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if (i_rToken.Id() == TokPunctuation::Semicolon) + { + MoveState( Stati().aNone ); + SetResult( done, pop_success ); + } + else + { + SetResult( not_done, pop_failure ); + } +} + +void +PE_Struct::store_Struct() +{ + ary::idl::Struct & + rCe = Gate().Ces().Store_Struct( + CurNamespace().CeId(), + Work().sData_Name, + Work().nCurParsed_Base, + Work().sData_TemplateParam ); + PassDocuAt(rCe); + Work().nCurStruct = rCe.CeId(); +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_tydf2.cxx b/autodoc/source/parser_i/idl/pe_tydf2.cxx new file mode 100644 index 000000000000..eaac60f0c360 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_tydf2.cxx @@ -0,0 +1,187 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_tydf2.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_tydf2.hxx> + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_typedef.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> +#include <s2_luidl/tk_const.hxx> + + +namespace csi +{ +namespace uidl +{ + + +#ifdef DF +#undef DF +#endif +#define DF &PE_Typedef::On_Default + +PE_Typedef::F_TOK +PE_Typedef::aDispatcher[PE_Typedef::e_STATES_MAX][PE_Typedef::tt_MAX] = + { { DF, DF, DF }, // e_none + { &PE_Typedef::On_expect_description_Any, + &PE_Typedef::On_expect_description_Any, + DF }, // expect_description + { DF, &PE_Typedef::On_expect_name_Identifier, + DF }, // expect_name + { DF, DF, &PE_Typedef::On_got_name_Punctuation } // got_name + }; + + + +inline void +PE_Typedef::CallHandler( const char * i_sTokenText, + E_TokenType i_eTokenType ) + { (this->*aDispatcher[eState][i_eTokenType])(i_sTokenText); } + + + + + +PE_Typedef::PE_Typedef() + : eState(e_none), + pPE_Type(0), + nType(0), + sName() +{ + pPE_Type = new PE_Type(nType); +} + +void +PE_Typedef::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Typedef::~PE_Typedef() +{ +} + +void +PE_Typedef::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Typedef::Process_Identifier( const TokIdentifier & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_identifier); +} + +void +PE_Typedef::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + CallHandler(i_rToken.Text(), tt_punctuation); +} + +void +PE_Typedef::Process_Default() +{ + CallHandler("", tt_any); +} + +void +PE_Typedef::On_expect_description_Any(const char *) +{ + SetResult(not_done,push_sure, pPE_Type.Ptr()); +} + +void +PE_Typedef::On_expect_name_Identifier(const char * i_sText) +{ + sName = i_sText; + SetResult(done,stay); + eState = got_name; +} + +void +PE_Typedef::On_got_name_Punctuation(const char * i_sText) +{ + if ( i_sText[0] == ';' ) + { + SetResult(done,pop_success); + eState = e_none; + } + else + On_Default(i_sText); +} + +void +PE_Typedef::On_Default(const char * ) +{ + SetResult(not_done,pop_failure); +} + +void +PE_Typedef::InitData() +{ + eState = expect_description; + nType = 0; + sName = ""; +} + +void +PE_Typedef::ReceiveData() +{ + eState = expect_name; +} + +void +PE_Typedef::TransferData() +{ + ary::idl::Typedef & + rCe = Gate().Ces().Store_Typedef(CurNamespace().CeId(), sName, nType); + PassDocuAt(rCe); + eState = e_none; +} + +UnoIDL_PE & +PE_Typedef::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pe_type2.cxx b/autodoc/source/parser_i/idl/pe_type2.cxx new file mode 100644 index 000000000000..1752a45d2b59 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_type2.cxx @@ -0,0 +1,317 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_type2.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_type2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_type.hxx> +#include <ary/idl/ip_type.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/uidl_tok.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_punct.hxx> + + + +/** Implementation Concept for Parsing a Type + +Example Type: + sequence < ::abc::TName< TplType > > AnyName; + +Status Changes: + +expect_type: + sequence -> expect_type + < -> expect_type + :: -> expect_quname_part + abc -> expect_quname_separator + :: -> expect_quname_part + TName -> expect_quname_separator + < -> in_template_type (process in nested PE_Type instance) + + expect_type: + TplType ->expect_quname_separator + > -> e_none (finish, '>' not handled) + + > -> expect_quname_separator + > -> expect_quname_separator (not finish, because sequencecounter > 0) + AnyName -> e_none (finish) +*/ + + +namespace csi +{ +namespace uidl +{ + + +PE_Type::PE_Type( ary::idl::Type_id & o_rResult ) + : pResult(&o_rResult), + nIsSequenceCounter(0), + nSequenceDownCounter(0), + bIsUnsigned(false), + sFullType(), + eState(e_none), + sLastPart(), + pPE_TemplateType(0), // @attention Recursion, only initiate, if needed! + nTemplateType(0), + aTemplateParameters() +{ +} + +PE_Type::~PE_Type() +{ +} + +void +PE_Type::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + +void +PE_Type::Process_Identifier( const TokIdentifier & i_rToken ) +{ + if (eState == expect_type) + { + sLastPart = i_rToken.Text(); + eState = expect_quname_separator; + SetResult(done, stay); + } + else if (eState == expect_quname_part) + { + sLastPart = i_rToken.Text(); + eState = expect_quname_separator; + SetResult(done, stay); + } + else if (eState == expect_quname_separator) + { + Finish(); + } +} + +void +PE_Type::Process_NameSeparator() +{ + if (eState == expect_type) + { + sFullType.Init(true); + eState = expect_quname_part; + SetResult(done, stay); + } + else if (eState == expect_quname_separator) + { + sFullType += sLastPart; + eState = expect_quname_part; + SetResult(done, stay); + } +} + +void +PE_Type::Process_Punctuation( const TokPunctuation & i_rToken ) +{ + if (eState == expect_type) + { + csv_assert(i_rToken.Id() == TokPunctuation::Lesser); + SetResult(done, stay); + } + else if (eState == expect_quname_separator) + { + switch (i_rToken.Id()) + { + case TokPunctuation::Lesser: + eState = in_template_type; + SetResult( done, push_sure, &MyTemplateType() ); + break; + + case TokPunctuation::Greater: + if (nSequenceDownCounter > 0) + { + nSequenceDownCounter--; + SetResult(done, stay); + } + else + { + Finish(); + } + break; + + default: + Finish(); + } // end switch + } + else if (eState == in_template_type) + { + aTemplateParameters.push_back(nTemplateType); + nTemplateType = 0; + + if (i_rToken.Id() == TokPunctuation::Greater) + { + eState = expect_quname_separator; + SetResult(done, stay); + } + else if (i_rToken.Id() == TokPunctuation::Comma) + { + SetResult(done, push_sure, &MyTemplateType()); + } + else + { + csv_assert(false); + Finish(); + } + } +} + +void +PE_Type::Process_BuiltInType( const TokBuiltInType & i_rToken ) +{ + if (eState == expect_type) + { + sLastPart = i_rToken.Text(); + eState = expect_quname_separator; + SetResult(done, stay); + } + else if (eState == expect_quname_part) + { + // Can this happen? + + sLastPart = i_rToken.Text(); + eState = expect_quname_separator; + SetResult(done, stay); + } + else if (eState == expect_quname_separator) + { + // Can this happen? + + Finish(); + } +} + +void +PE_Type::Process_TypeModifier( const TokTypeModifier & i_rToken ) +{ + if (eState == expect_type) + { + switch ( i_rToken.Id() ) + { + case TokTypeModifier::tmod_unsigned: + bIsUnsigned = true; + break; + case TokTypeModifier::tmod_sequence: + nIsSequenceCounter++; + nSequenceDownCounter++; + break; + default: + csv_assert(false); + } + SetResult(done, stay); + } + else if (eState == expect_quname_separator) + { + // Can this happen? + + Finish(); + } +} + +void +PE_Type::Process_Default() +{ + Finish(); +} + +void +PE_Type::Finish() +{ + csv_assert(nSequenceDownCounter == 0); + + sFullType.SetLocalName(sLastPart); + SetResult(not_done, pop_success); +} + +PE_Type & +PE_Type::MyTemplateType() +{ + if (NOT pPE_TemplateType) + { + pPE_TemplateType = new PE_Type(nTemplateType); + pPE_TemplateType->EstablishContacts( this, + MyRepository(), + TokenResult() ); + } + return *pPE_TemplateType; +} + +void +PE_Type::InitData() +{ + eState = expect_type; + + nIsSequenceCounter = 0; + nSequenceDownCounter = 0; + bIsUnsigned = false; + sFullType.Empty(); + sLastPart.clear(); + nTemplateType = 0; + csv::erase_container(aTemplateParameters); +} + +void +PE_Type::TransferData() +{ + if (bIsUnsigned) + { + StreamLock sl(40); + String sName( sl() << "unsigned " << sFullType.LocalName() << c_str ); + sFullType.SetLocalName(sName); + } + + const ary::idl::Type & + result = Gate().Types().CheckIn_Type( sFullType, + nIsSequenceCounter, + CurNamespace().CeId(), + &aTemplateParameters ); + *pResult = result.TypeId(); + eState = e_none; +} + +UnoIDL_PE & +PE_Type::MyPE() +{ + return *this; +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/pe_vari2.cxx b/autodoc/source/parser_i/idl/pe_vari2.cxx new file mode 100644 index 000000000000..a06d90be8417 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_vari2.cxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_vari2.cxx,v $ + * $Revision: 1.11 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pe_vari2.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_property.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/pe_type2.hxx> +#include <s2_luidl/tk_keyw.hxx> +#include <s2_luidl/tk_ident.hxx> +#include <s2_luidl/tk_punct.hxx> + + +namespace csi +{ +namespace uidl +{ + + +PE_Variable::PE_Variable( ary::idl::Type_id & i_rResult_Type, + String & i_rResult_Name ) + : eState(e_none), + pResult_Type(&i_rResult_Type), + pResult_Name(&i_rResult_Name), + pPE_Type(0) +{ + pPE_Type = new PE_Type(i_rResult_Type); +} + +void +PE_Variable::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & o_rResult ) +{ + UnoIDL_PE::EstablishContacts(io_pParentPE,io_rRepository,o_rResult); + pPE_Type->EstablishContacts(this,io_rRepository,o_rResult); +} + +PE_Variable::~PE_Variable() +{ +} + +void +PE_Variable::ProcessToken( const Token & i_rToken ) +{ + i_rToken.Trigger(*this); +} + + +void +PE_Variable::Process_Default() +{ + if (eState == expect_type) + { + SetResult( not_done, push_sure, pPE_Type.Ptr() ); + } + else{ + csv_assert(false); + } +} + +void +PE_Variable::Process_Identifier( const TokIdentifier & i_rToken ) +{ + if (eState == expect_type) + { + SetResult( not_done, push_sure, pPE_Type.Ptr() ); + } + else if (eState == expect_name) + { + *pResult_Name = i_rToken.Text(); + SetResult( done, stay ); + eState = expect_finish; + } + else { + csv_assert(false); + } +} + +void +PE_Variable::Process_Punctuation( const TokPunctuation & ) +{ + if (eState == expect_finish) + { + SetResult( not_done, pop_success ); + eState = e_none; + } + else if (eState == expect_name) + { + SetResult( not_done, pop_success ); + eState = e_none; + } + else { + csv_assert(false); + } +} + +void +PE_Variable::Process_BuiltInType( const TokBuiltInType & i_rToken ) +{ + if (eState == expect_type) + { + SetResult( not_done, push_sure, pPE_Type.Ptr() ); + } + else if (eState == expect_name AND i_rToken.Id() == TokBuiltInType::bty_ellipse) + { + SetResult( not_done, pop_success ); + eState = e_none; + } + else { + csv_assert(false); + } +} + +void +PE_Variable::InitData() +{ + eState = expect_type; + + *pResult_Type = 0; + *pResult_Name = ""; +} + +void +PE_Variable::ReceiveData() +{ + eState = expect_name; +} + +void +PE_Variable::TransferData() +{ + eState = e_none; +} + +UnoIDL_PE & +PE_Variable::MyPE() +{ + return *this; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/pestate.cxx b/autodoc/source/parser_i/idl/pestate.cxx new file mode 100644 index 000000000000..3a427fa96da1 --- /dev/null +++ b/autodoc/source/parser_i/idl/pestate.cxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pestate.cxx,v $ + * $Revision: 1.7 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/pestate.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/parsenv2.hxx> + + + + +namespace csi +{ +namespace uidl +{ + +void +ParseEnvState::Process_Identifier( const TokIdentifier & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_NameSeparator() +{ + Process_Default(); +} + +void +ParseEnvState::Process_Punctuation( const TokPunctuation & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_BuiltInType( const TokBuiltInType & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_TypeModifier( const TokTypeModifier & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_MetaType( const TokMetaType & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_Stereotype( const TokStereotype & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_ParameterHandling( const TokParameterHandling & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_Raises() +{ + Process_Default(); +} + +void +ParseEnvState::Process_Needs() +{ + Process_Default(); +} + +void +ParseEnvState::Process_Observes() +{ + Process_Default(); +} + +void +ParseEnvState::Process_Assignment( const TokAssignment & ) +{ + Process_Default(); +} + +void +ParseEnvState::Process_EOL() +{ + MyPE().SetResult(done,stay); +} + + +void +ParseEnvState::On_SubPE_Left() +{ +} + +void +ParseEnvState::Process_Default() +{ + if (bDefaultIsError) + MyPE().SetResult(not_done, pop_failure); + else // ignore: + MyPE().SetResult(done, stay); +} + + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/semnode.cxx b/autodoc/source/parser_i/idl/semnode.cxx new file mode 100644 index 000000000000..7539dea56814 --- /dev/null +++ b/autodoc/source/parser_i/idl/semnode.cxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: semnode.cxx,v $ + * $Revision: 1.9 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/semnode.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/ary.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <s2_luidl/parsenv2.hxx> + + +namespace csi +{ +namespace uidl +{ + + + +SemanticNode::SemanticNode() + : pParentPE(0), + pAryGate(0), + pTokenResult(0) +{ +} + +void +SemanticNode::EstablishContacts( UnoIDL_PE * io_pParentPE, + ary::idl::Gate & io_rGate, + TokenProcessing_Result & o_rResult ) +{ + pParentPE = io_pParentPE; + pAryGate = &io_rGate; + pTokenResult = &o_rResult; +} + +SemanticNode::~SemanticNode() +{ +} + +void +SemanticNode::SetTokenResult( E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + UnoIDL_PE * i_pParseEnv2Push ) +{ + csv_assert(pTokenResult != 0); + + pTokenResult->eDone = i_eDone; + pTokenResult->eStackAction = i_eWhat2DoWithEnvStack; + pTokenResult->pEnv2Push = i_pParseEnv2Push; +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/tk_const.cxx b/autodoc/source/parser_i/idl/tk_const.cxx new file mode 100644 index 000000000000..603cc640e2d4 --- /dev/null +++ b/autodoc/source/parser_i/idl/tk_const.cxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_const.cxx,v $ + * $Revision: 1.5 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/tk_const.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <s2_luidl/tokintpr.hxx> + + + +namespace csi +{ +namespace uidl +{ + + +void +TokAssignment::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Assignment(*this); +} + +const char * +TokAssignment::Text() const +{ + return sText; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/tk_ident.cxx b/autodoc/source/parser_i/idl/tk_ident.cxx new file mode 100644 index 000000000000..6cd158772aef --- /dev/null +++ b/autodoc/source/parser_i/idl/tk_ident.cxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_ident.cxx,v $ + * $Revision: 1.5 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/tk_ident.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <s2_luidl/tokintpr.hxx> + + + +namespace csi +{ +namespace uidl +{ + +void +TokIdentifier::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Identifier(*this); +} + +const char * +TokIdentifier::Text() const +{ + return sText; +} + +void +TokNameSeparator::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_NameSeparator(); +} + +const char * +TokNameSeparator::Text() const +{ + return "::"; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/tk_keyw.cxx b/autodoc/source/parser_i/idl/tk_keyw.cxx new file mode 100644 index 000000000000..0a95666b7cdd --- /dev/null +++ b/autodoc/source/parser_i/idl/tk_keyw.cxx @@ -0,0 +1,228 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_keyw.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/tk_keyw.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <s2_luidl/tokintpr.hxx> + + +using csi::uidl::TokBuiltInType; +using csi::uidl::TokTypeModifier; +using csi::uidl::TokMetaType; +using csi::uidl::TokStereotype; +using csi::uidl::TokParameterHandling; + + +lux::EnumValueMap G_aTokBuiltInType_EV_TokenId_Values; +TokBuiltInType::EV_TokenId ev_bty_none(TokBuiltInType::e_none,""); +TokBuiltInType::EV_TokenId ev_bty_any(TokBuiltInType::bty_any,"any"); +TokBuiltInType::EV_TokenId ev_bty_boolean(TokBuiltInType::bty_boolean,"boolean"); +TokBuiltInType::EV_TokenId ev_bty_byte(TokBuiltInType::bty_byte,"byte"); +TokBuiltInType::EV_TokenId ev_bty_char(TokBuiltInType::bty_char,"char"); +TokBuiltInType::EV_TokenId ev_bty_double(TokBuiltInType::bty_double,"double"); +TokBuiltInType::EV_TokenId ev_bty_hyper(TokBuiltInType::bty_hyper,"hyper"); +TokBuiltInType::EV_TokenId ev_bty_long(TokBuiltInType::bty_long,"long"); +TokBuiltInType::EV_TokenId ev_bty_short(TokBuiltInType::bty_short,"short"); +TokBuiltInType::EV_TokenId ev_bty_string(TokBuiltInType::bty_string,"string"); +TokBuiltInType::EV_TokenId ev_bty_void(TokBuiltInType::bty_void,"void"); +TokBuiltInType::EV_TokenId ev_bty_ellipse(TokBuiltInType::bty_ellipse,"..."); + + +lux::EnumValueMap G_aTokTypeModifier_EV_TokenId_Values; +TokTypeModifier::EV_TokenId ev_tmod_none(TokTypeModifier::e_none,""); +TokTypeModifier::EV_TokenId ev_tmod_unsigned(TokTypeModifier::tmod_unsigned,"unsigned"); +TokTypeModifier::EV_TokenId ev_tmod_sequence(TokTypeModifier::tmod_sequence,"sequence"); + + +lux::EnumValueMap G_aTokMetaType_EV_TokenId_Values; +TokMetaType::EV_TokenId ev_mt_none(TokMetaType::e_none,""); +TokMetaType::EV_TokenId ev_mt_attribute(TokMetaType::mt_attribute,"attribute"); +TokMetaType::EV_TokenId ev_mt_constants(TokMetaType::mt_constants,"constants"); +TokMetaType::EV_TokenId ev_mt_enum(TokMetaType::mt_enum,"enum"); +TokMetaType::EV_TokenId ev_mt_exception(TokMetaType::mt_exception,"exception"); +TokMetaType::EV_TokenId ev_mt_ident(TokMetaType::mt_ident,"ident"); +TokMetaType::EV_TokenId ev_mt_interface(TokMetaType::mt_interface,"interface"); +TokMetaType::EV_TokenId ev_mt_module(TokMetaType::mt_module,"module"); +TokMetaType::EV_TokenId ev_mt_property(TokMetaType::mt_property,"property"); +TokMetaType::EV_TokenId ev_mt_service(TokMetaType::mt_service,"service"); +TokMetaType::EV_TokenId ev_mt_singleton(TokMetaType::mt_singleton,"singleton"); +TokMetaType::EV_TokenId ev_mt_struct(TokMetaType::mt_struct,"struct"); +TokMetaType::EV_TokenId ev_mt_typedef(TokMetaType::mt_typedef,"typedef"); +TokMetaType::EV_TokenId ev_mt_uik(TokMetaType::mt_uik,"uik"); + + +lux::EnumValueMap G_aTokStereotype_EV_TokenId_Values; +TokStereotype::EV_TokenId ev_ste_none(TokStereotype::e_none,""); +TokStereotype::EV_TokenId ev_ste_bound(TokStereotype::ste_bound,"bound"); +TokStereotype::EV_TokenId ev_ste_const(TokStereotype::ste_const,"const"); +TokStereotype::EV_TokenId ev_ste_constrained(TokStereotype::ste_constrained,"constrained"); +TokStereotype::EV_TokenId ev_ste_maybeambiguous(TokStereotype::ste_maybeambiguous,"maybeambiguous"); +TokStereotype::EV_TokenId ev_ste_maybedefault(TokStereotype::ste_maybedefault,"maybedefault"); +TokStereotype::EV_TokenId ev_ste_maybevoid(TokStereotype::ste_maybevoid,"maybevoid"); +TokStereotype::EV_TokenId ev_ste_oneway(TokStereotype::ste_oneway,"oneway"); +TokStereotype::EV_TokenId ev_ste_optional(TokStereotype::ste_optional,"optional"); +TokStereotype::EV_TokenId ev_ste_readonly(TokStereotype::ste_readonly,"readonly"); +TokStereotype::EV_TokenId ev_ste_removable(TokStereotype::ste_removable,"removable"); +TokStereotype::EV_TokenId ev_ste_virtual(TokStereotype::ste_virtual,"virtual"); +TokStereotype::EV_TokenId ev_ste_transient(TokStereotype::ste_transient,"transient"); +TokStereotype::EV_TokenId ev_ste_published(TokStereotype::ste_published,"published"); + + +lux::EnumValueMap G_aTokParameterHandling_EV_TokenId_Values; +TokParameterHandling::EV_TokenId ev_ph_none(TokParameterHandling::e_none,""); +TokParameterHandling::EV_TokenId ev_ph_in(TokParameterHandling::ph_in,"in"); +TokParameterHandling::EV_TokenId ev_ph_out(TokParameterHandling::ph_out,"out"); +TokParameterHandling::EV_TokenId ev_ph_inout(TokParameterHandling::ph_inout,"inout"); + + +namespace lux +{ + +template<> EnumValueMap & +TokBuiltInType::EV_TokenId::Values_() { return G_aTokBuiltInType_EV_TokenId_Values; } +template<> EnumValueMap & +TokTypeModifier::EV_TokenId::Values_() { return G_aTokTypeModifier_EV_TokenId_Values; } +template<> EnumValueMap & +TokMetaType::EV_TokenId::Values_() { return G_aTokMetaType_EV_TokenId_Values; } +template<> EnumValueMap & +TokStereotype::EV_TokenId::Values_() { return G_aTokStereotype_EV_TokenId_Values; } +template<> EnumValueMap & +TokParameterHandling::EV_TokenId::Values_() { return G_aTokParameterHandling_EV_TokenId_Values; } + +} // namespace lux + + + +namespace csi +{ +namespace uidl +{ + +void +TokBuiltInType::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_BuiltInType(*this); +} + +const char * +TokBuiltInType::Text() const +{ + return eTag.Text(); +} + +void +TokTypeModifier::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_TypeModifier(*this); +} + +const char * +TokTypeModifier::Text() const +{ + return eTag.Text(); +} + +void +TokMetaType::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_MetaType(*this); +} + +const char * +TokMetaType::Text() const +{ + return eTag.Text(); +} + +void +TokStereotype::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Stereotype(*this); +} + +const char * +TokStereotype::Text() const +{ + return eTag.Text(); +} + +void +TokParameterHandling::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_ParameterHandling(*this); +} + +const char * +TokParameterHandling::Text() const +{ + return eTag.Text(); +} + +void +TokRaises::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Raises(); +} + +const char * +TokRaises::Text() const +{ + return "raises"; +} + +void +TokNeeds::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Needs(); +} + +const char * +TokNeeds::Text() const +{ + return "needs"; +} +void +TokObserves::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Observes(); +} + +const char * +TokObserves::Text() const +{ + return "observes"; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/tk_punct.cxx b/autodoc/source/parser_i/idl/tk_punct.cxx new file mode 100644 index 000000000000..64bfe2d9e21d --- /dev/null +++ b/autodoc/source/parser_i/idl/tk_punct.cxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_punct.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/tk_punct.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <parser/parserinfo.hxx> +#include <s2_luidl/tokintpr.hxx> + + +using csi::uidl::TokPunctuation; + + +lux::EnumValueMap G_aTokPunctuation_EV_TokenId_Values; +TokPunctuation::EV_TokenId ev_none(TokPunctuation::e_none,""); +TokPunctuation::EV_TokenId BracketOpen(TokPunctuation::BracketOpen,"("); +TokPunctuation::EV_TokenId BracketClose(TokPunctuation::BracketClose,")"); +TokPunctuation::EV_TokenId ArrayBracketOpen(TokPunctuation::ArrayBracketOpen,"["); +TokPunctuation::EV_TokenId ArrayBracketClose(TokPunctuation::ArrayBracketClose,"]"); +TokPunctuation::EV_TokenId CurledBracketOpen(TokPunctuation::CurledBracketOpen,"{"); +TokPunctuation::EV_TokenId CurledBracketClose(TokPunctuation::CurledBracketClose,"}"); +TokPunctuation::EV_TokenId Semicolon(TokPunctuation::Semicolon,";"); +TokPunctuation::EV_TokenId Colon(TokPunctuation::Colon,":"); +TokPunctuation::EV_TokenId DoubleColon(TokPunctuation::DoubleColon,"::"); +TokPunctuation::EV_TokenId Comma(TokPunctuation::Comma,","); +TokPunctuation::EV_TokenId Minus(TokPunctuation::Minus,"-"); +TokPunctuation::EV_TokenId Fullstop(TokPunctuation::Fullstop,"."); +TokPunctuation::EV_TokenId Lesser(TokPunctuation::Lesser,"<"); +TokPunctuation::EV_TokenId Greater(TokPunctuation::Greater,">"); + + + + +namespace lux +{ +template<> EnumValueMap & +TokPunctuation::EV_TokenId::Values_() { return G_aTokPunctuation_EV_TokenId_Values; } +} + + + + +namespace csi +{ +namespace uidl +{ + +void +TokPunctuation::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Punctuation(*this); +} + +const char * +TokPunctuation::Text() const +{ + return eTag.Text(); +} + +void +Tok_EOL::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_EOL(); +} + +const char * +Tok_EOL::Text() const +{ + return "\r\n"; +} + +void +Tok_EOF::Trigger( TokenInterpreter & ) const +{ + csv_assert(false); +// io_rInterpreter.Process_EOF(); +} + +const char * +Tok_EOF::Text() const +{ + return ""; +} + + +} // namespace uidl +} // namespace csi diff --git a/autodoc/source/parser_i/idl/tkp_uidl.cxx b/autodoc/source/parser_i/idl/tkp_uidl.cxx new file mode 100644 index 000000000000..7ee2e36683b7 --- /dev/null +++ b/autodoc/source/parser_i/idl/tkp_uidl.cxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkp_uidl.cxx,v $ + * $Revision: 1.5 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_luidl/tkp_uidl.hxx> + +// NOT FULLY DECLARED SERVICES +#include <s2_luidl/cx_idlco.hxx> + + + +namespace csi +{ +namespace uidl +{ + + +TokenParser_Uidl::TokenParser_Uidl( Token_Receiver & o_rUidlReceiver, + DYN ::TkpDocuContext & let_drDocuContext ) + : pBaseContext(new Context_UidlCode(o_rUidlReceiver, let_drDocuContext)), + pCurContext(0) +{ + SetStartContext(); +} + +TokenParser_Uidl::~TokenParser_Uidl() +{ +} + +void +TokenParser_Uidl::SetStartContext() +{ + pCurContext = pBaseContext.Ptr(); +} + +void +TokenParser_Uidl::SetCurrentContext( TkpContext & io_rContext ) +{ + pCurContext = &io_rContext; +} + +TkpContext & +TokenParser_Uidl::CurrentContext() +{ + return *pCurContext; +} + +} // namespace uidl +} // namespace csi + diff --git a/autodoc/source/parser_i/idl/unoidl.cxx b/autodoc/source/parser_i/idl/unoidl.cxx new file mode 100644 index 000000000000..e8f86c885363 --- /dev/null +++ b/autodoc/source/parser_i/idl/unoidl.cxx @@ -0,0 +1,179 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: unoidl.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <parser/unoidl.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <stdlib.h> +#include <cosv/file.hxx> +#include <ary/ary.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <../parser/inc/x_docu.hxx> +#include <parser/parserinfo.hxx> +#include <tools/filecoll.hxx> +#include <tools/tkpchars.hxx> +#include <s2_luidl/tkp_uidl.hxx> +#include <s2_luidl/distrib.hxx> +#include <s2_luidl/pe_file2.hxx> +#include <s2_dsapi/cx_dsapi.hxx> +#include <adc_msg.hxx> +#include <x_parse2.hxx> + + + +namespace autodoc +{ + + +class FileParsePerformers +{ + public: + FileParsePerformers( + ary::Repository & + io_rRepository, + ParserInfo & io_rParserInfo ); + + void ParseFile( + const char * i_sFullPath ); + + void ConnectLinks(); + + private: + CharacterSource aFileLoader; + Dyn<csi::uidl::TokenParser_Uidl> + pTokens; + csi::uidl::TokenDistributor + aDistributor; + Dyn<csi::uidl::PE_File> + pFileParseEnvironment; + ary::Repository & + rRepository; + ParserInfo & rParserInfo; +}; + + +IdlParser::IdlParser( ary::Repository & io_rRepository ) + : pRepository(&io_rRepository) +{ +} + +void +IdlParser::Run( const autodoc::FileCollector_Ifc & i_rFiles ) +{ + Dyn<FileParsePerformers> + pFileParsePerformers( + new FileParsePerformers(*pRepository, + static_cast< ParserInfo& >(*this)) ); + + FileCollector::const_iterator iEnd = i_rFiles.End(); + for ( FileCollector::const_iterator iter = i_rFiles.Begin(); + iter != iEnd; + ++iter ) + { + Cout() << (*iter) << " ..."<< Endl(); + + try + { + pFileParsePerformers->ParseFile(*iter); + } + catch (X_AutodocParser &) + { + /// Ignore and goon + TheMessages().Out_ParseError(CurFile(), CurLine()); + pFileParsePerformers + = new FileParsePerformers(*pRepository, + static_cast< ParserInfo& >(*this)); + } + catch (X_Docu & xd) + { + // Currently thic catches only wrong since tags, while since tags are + // transformed. In this case the program shall be terminated. + Cerr() << xd << Endl(); + exit(1); + } + catch (...) + { + Cout() << "Unknown error." << Endl(); + exit(0); +// pFileParsePerformers = new FileParsePerformers( *pRepository ); + } + } + + pFileParsePerformers->ConnectLinks(); +} + +FileParsePerformers::FileParsePerformers( ary::Repository & io_rRepository, + ParserInfo & io_rParserInfo ) + : pTokens(0), + aDistributor(io_rRepository, io_rParserInfo), + rRepository( io_rRepository ), + rParserInfo(io_rParserInfo) +{ + DYN csi::dsapi::Context_Docu * + dpDocuContext + = new csi::dsapi::Context_Docu( aDistributor.DocuTokens_Receiver() ); + pTokens = new csi::uidl::TokenParser_Uidl( aDistributor.CodeTokens_Receiver(), *dpDocuContext ); + pFileParseEnvironment + = new csi::uidl::PE_File(aDistributor,rParserInfo); + + aDistributor.SetTokenProvider(*pTokens); + aDistributor.SetTopParseEnvironment(*pFileParseEnvironment); +} + +void +FileParsePerformers::ParseFile( const char * i_sFullPath ) +{ + csv::File aFile(i_sFullPath); + + aFile.open( csv::CFM_READ ); + csv_assert( aFile.is_open() ); + aFileLoader.LoadText(aFile); + aFile.close(); + + rParserInfo.Set_CurFile(i_sFullPath, true); // true = count lines + pTokens->Start(aFileLoader); + aDistributor.Reset(); + + do { + aDistributor.TradeToken(); + } while ( NOT aFileLoader.IsFinished() ); +} + +void +FileParsePerformers::ConnectLinks() +{ + // KORR_FUTURE ? +// rRepository.RwGate_Idl().ConnectAdditionalLinks(); +} + +} // namespace autodoc diff --git a/autodoc/source/parser_i/idoc/cx_docu2.cxx b/autodoc/source/parser_i/idoc/cx_docu2.cxx new file mode 100644 index 000000000000..bee8c034ea66 --- /dev/null +++ b/autodoc/source/parser_i/idoc/cx_docu2.cxx @@ -0,0 +1,270 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_docu2.cxx,v $ + * $Revision: 1.8 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_dsapi/cx_docu2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <../../parser/inc/tokens/parseinc.hxx> +#include <s2_dsapi/tokrecv.hxx> +#include <s2_dsapi/tk_html.hxx> +#include <s2_dsapi/tk_xml.hxx> +#include <s2_dsapi/tk_docw2.hxx> +#include <x_parse2.hxx> + + + +namespace csi +{ +namespace dsapi +{ + + + +bool +Cx_Base::PassNewToken() +{ + if (pNewToken) + { + rReceiver.Receive(*pNewToken.Release()); + + return true; + } + return false; +} + +TkpContext & +Cx_Base::FollowUpContext() +{ + csv_assert(pFollowUpContext != 0); + return *pFollowUpContext; +} + +void +Cx_Base::Handle_DocuSyntaxError( CharacterSource & io_rText ) +{ + // KORR_FUTURE + // Put this into Error Log File + + Cerr() << "Error: Syntax error in documentation within " + << "this text:\n\"" + << io_rText.CutToken() + << "\"." + << Endl(); + SetToken( new Tok_Word(io_rText.CurToken()) ); +} + +void +Cx_EoHtml::ReadCharChain( CharacterSource & io_rText ) +{ + if ( NULCH == jumpTo(io_rText,'>') ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + io_rText.MoveOn(); + SetToken(new Tok_HtmlTag(io_rText.CutToken(),bToken_IsStartOfParagraph)); +} + +void +Cx_EoXmlConst::ReadCharChain( CharacterSource & io_rText ) +{ + char c = jumpTo(io_rText,'>','*'); + if ( NULCH == c OR '*' == c ) + { + Handle_DocuSyntaxError(io_rText); + return; + } + + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(new Tok_XmlConst(eTokenId)); +} + +void +Cx_EoXmlLink_BeginTag::ReadCharChain( CharacterSource & io_rText ) +{ + String sScope; + String sDim; + + do { + char cReached = jumpTo(io_rText,'"','>','*'); + switch (cReached) + { + case '"': + { + io_rText.MoveOn(); + io_rText.CutToken(); + char c = jumpTo(io_rText,'"','*', '>'); + if ( NULCH == c OR '*' == c OR '>' == c) + { + if ( '>' == c ) + io_rText.MoveOn(); + Handle_DocuSyntaxError(io_rText); + return; + } + + const char * pAttribute = io_rText.CutToken(); + if ( *pAttribute != '[' ) + sScope = pAttribute; + else + sDim = pAttribute; + + io_rText.MoveOn(); + break; + } + case '>': + break; + case '*': + Handle_DocuSyntaxError(io_rText); + return; + default: + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + } // end switch + } while ( io_rText.CurChar() != '>' ); + + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken( new Tok_XmlLink_BeginTag(eTokenId, sScope.c_str(), sDim.c_str()) ); +} + +void +Cx_EoXmlLink_EndTag::ReadCharChain( CharacterSource & io_rText ) +{ + char c = jumpTo(io_rText,'>','*'); + if ( NULCH == c OR '*' == c ) + { + Handle_DocuSyntaxError(io_rText); + return; + } + + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(new Tok_XmlLink_EndTag(eTokenId)); +} + +void +Cx_EoXmlFormat_BeginTag::ReadCharChain( CharacterSource & io_rText ) +{ + String sDim; + + char cReached = jumpTo(io_rText,'"','>','*'); + switch (cReached) + { + case '"': + { + io_rText.MoveOn(); + io_rText.CutToken(); + + char c = jumpTo(io_rText,'"','*','>'); + if ( NULCH == c OR '*' == c OR '>' == c ) + { + if ('>' == c ) + io_rText.MoveOn(); + Handle_DocuSyntaxError(io_rText); + return; + } + + sDim = io_rText.CutToken(); + + c = jumpTo(io_rText,'>','*'); + if ( NULCH == c OR '*' == c ) + { + Handle_DocuSyntaxError(io_rText); + return; + } + break; + } + case '>': + break; + case '*': + Handle_DocuSyntaxError(io_rText); + return; + default: + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + } // end switch + + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(new Tok_XmlFormat_BeginTag(eTokenId, sDim)); +} + +void +Cx_EoXmlFormat_EndTag::ReadCharChain( CharacterSource & io_rText ) +{ + char c = jumpTo(io_rText,'>','*'); + if ( NULCH == c OR '*' == c ) + { + Handle_DocuSyntaxError(io_rText); + return; + } + + io_rText.MoveOn(); + io_rText.CutToken(); + SetToken(new Tok_XmlFormat_EndTag(eTokenId)); +} + +void +Cx_CheckStar::ReadCharChain( CharacterSource & io_rText ) +{ + bEndTokenFound = false; + if (bIsEnd) + { + char cNext = jumpOver(io_rText,'*'); + if ( NULCH == cNext ) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + if (cNext == '/') + { + io_rText.MoveOn(); + SetToken(new Tok_DocuEnd); + bEndTokenFound = true; + } + else + { + SetToken( new Tok_Word(io_rText.CutToken()) ); + } + } + else + { + jumpToWhite(io_rText); + SetToken( new Tok_Word(io_rText.CutToken()) ); + } +} + +TkpContext & +Cx_CheckStar::FollowUpContext() +{ + if (bEndTokenFound) + return *pEnd_FollowUpContext; + else + return Cx_Base::FollowUpContext(); +} + +} // namespace dsapi +} // namespace csi + diff --git a/autodoc/source/parser_i/idoc/cx_dsapi.cxx b/autodoc/source/parser_i/idoc/cx_dsapi.cxx new file mode 100644 index 000000000000..8990d6895e86 --- /dev/null +++ b/autodoc/source/parser_i/idoc/cx_dsapi.cxx @@ -0,0 +1,536 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_dsapi.cxx,v $ + * $Revision: 1.10 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_dsapi/cx_dsapi.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <x_parse2.hxx> +#include <tools/tkpchars.hxx> +#include <s2_dsapi/tk_atag2.hxx> +#include <s2_dsapi/tk_docw2.hxx> +#include <s2_dsapi/tk_xml.hxx> +#include <s2_dsapi/cx_docu2.hxx> +#include <s2_dsapi/tokrecv.hxx> + + +namespace csi +{ +namespace dsapi +{ + + +const intt C_nStatusSize = 128; +const intt C_nCppInitialNrOfStati = 400; + + +const uintt nF_fin_Error = 1; +const uintt nF_fin_Ignore = 2; +const uintt nF_fin_Eof = 3; +const uintt nF_fin_AnyWord = 4; +const uintt nF_fin_AtTag = 5; +const uintt nF_fin_EndSign = 6; +const uintt nF_goto_EoHtml = 7; +const uintt nF_goto_EoXmlConst = 8; +const uintt nF_goto_EoXmlLink_BeginTag = 9; +const uintt nF_goto_EoXmlLink_EndTag = 10; +const uintt nF_goto_EoXmlFormat_BeginTag = 11; +const uintt nF_goto_EoXmlFormat_EndTag = 12; +const uintt nF_goto_CheckStar = 13; +const uintt nF_fin_Comma = 14; +const uintt nF_fin_White = 15; + +const UINT16 nTok_at_author = 100 + Tok_AtTag::author; +const UINT16 nTok_at_see = 100 + Tok_AtTag::see; +const UINT16 nTok_at_param = 100 + Tok_AtTag::param; +const UINT16 nTok_at_return = 100 + Tok_AtTag::e_return; +const UINT16 nTok_at_throws = 100 + Tok_AtTag::e_throw; +const UINT16 nTok_at_example = 100 + Tok_AtTag::example; +const UINT16 nTok_at_deprecated = 100 + Tok_AtTag::deprecated; +const UINT16 nTok_at_suspicious = 100 + Tok_AtTag::suspicious; +const UINT16 nTok_at_missing = 100 + Tok_AtTag::missing; +const UINT16 nTok_at_incomplete = 100 + Tok_AtTag::incomplete; +const UINT16 nTok_at_version = 100 + Tok_AtTag::version; +const UINT16 nTok_at_guarantees = 100 + Tok_AtTag::guarantees; +const UINT16 nTok_at_exception = 100 + Tok_AtTag::exception; +const UINT16 nTok_at_since = 100 + Tok_AtTag::since; + +const UINT16 nTok_const_TRUE = 200 + Tok_XmlConst::e_true; +const UINT16 nTok_const_FALSE = 200 + Tok_XmlConst::e_false; +const UINT16 nTok_const_NULL = 200 + Tok_XmlConst::e_null; +const UINT16 nTok_const_void = 200 + Tok_XmlConst::e_void; + +const UINT16 nTok_link_typeB = 300 + Tok_XmlLink_BeginTag::type; +const UINT16 nTok_link_typeE = 325 + Tok_XmlLink_EndTag::type; +const UINT16 nTok_link_memberB = 300 + Tok_XmlLink_BeginTag::member; +const UINT16 nTok_link_membeE = 325 + Tok_XmlLink_EndTag::member; +const UINT16 nTok_link_constB = 300 + Tok_XmlLink_BeginTag::e_const; +const UINT16 nTok_link_constE = 325 + Tok_XmlLink_EndTag::e_const; + +const UINT16 nTok_format_listingB = 350 + Tok_XmlFormat_BeginTag::listing; +const UINT16 nTok_format_listingE = 375 + Tok_XmlFormat_EndTag::listing; +const UINT16 nTok_format_codeB = 350 + Tok_XmlFormat_BeginTag::code; +const UINT16 nTok_format_codeE = 375 + Tok_XmlFormat_EndTag::code; +const UINT16 nTok_format_atomB = 350 + Tok_XmlFormat_BeginTag::atom; +const UINT16 nTok_format_atomE = 375 + Tok_XmlFormat_EndTag::atom; + + +const UINT16 nTok_html_parastart = 400; + +const UINT16 nTok_MLDocuEnd = 501; +const UINT16 nTok_EOL = 502; + + +Context_Docu::Context_Docu( Token_Receiver & o_rReceiver ) + : aStateMachine(C_nStatusSize, C_nCppInitialNrOfStati), + pReceiver(&o_rReceiver), + pParentContext(0), + pCx_EoHtml(0), + pCx_EoXmlConst(0), + pCx_EoXmlLink_BeginTag(0), + pCx_EoXmlLink_EndTag(0), + pCx_EoXmlFormat_BeginTag(0), + pCx_EoXmlFormat_EndTag(0), + pCx_CheckStar(0), + pNewToken(0), + pFollowUpContext(0), + bIsMultiline(false) +{ + pCx_EoHtml = new Cx_EoHtml(o_rReceiver, *this); + pCx_EoXmlConst = new Cx_EoXmlConst(o_rReceiver, *this); + pCx_EoXmlLink_BeginTag = new Cx_EoXmlLink_BeginTag(o_rReceiver, *this); + pCx_EoXmlLink_EndTag = new Cx_EoXmlLink_EndTag(o_rReceiver, *this); + pCx_EoXmlFormat_BeginTag = new Cx_EoXmlFormat_BeginTag(o_rReceiver, *this); + pCx_EoXmlFormat_EndTag = new Cx_EoXmlFormat_EndTag(o_rReceiver, *this); + pCx_CheckStar = new Cx_CheckStar(*pReceiver,*this); + + SetupStateMachine(); +} + +void +Context_Docu::SetParentContext( TkpContext & io_rParentContext, + const char * ) +{ + pFollowUpContext = pParentContext = &io_rParentContext; + pCx_CheckStar->Set_End_FolloUpContext(io_rParentContext); +} + +Context_Docu::~Context_Docu() +{ +} + +void +Context_Docu::ReadCharChain( CharacterSource & io_rText ) +{ + csv_assert(pParentContext != 0); + + pNewToken = 0; + + UINT16 nTokenId = 0; + StmBoundsStatu2 & rBound = aStateMachine.GetCharChain(nTokenId, io_rText); + + // !!! + // The order of the next two lines is essential, because + // pFollowUpContext may be changed by PerformStatusFunction() also, + // which then MUST override the previous assignment. + pFollowUpContext = rBound.FollowUpContext(); + PerformStatusFunction(rBound.StatusFunctionNr(), nTokenId, io_rText); +} + +bool +Context_Docu::PassNewToken() +{ + if (pNewToken) + { + pReceiver->Receive(*pNewToken.Release()); + return true; + } + return false; +} + +TkpContext & +Context_Docu::FollowUpContext() +{ + csv_assert(pFollowUpContext != 0); + return *pFollowUpContext; +} + +void +Context_Docu::PerformStatusFunction( uintt i_nStatusSignal, + UINT16 i_nTokenId, + CharacterSource & io_rText ) +{ + switch (i_nStatusSignal) + { + case nF_fin_White: + io_rText.CutToken(); + pNewToken = new Tok_White; + break; + case nF_fin_Error: + throw X_AutodocParser(X_AutodocParser::x_InvalidChar); + // no break because of throw + case nF_fin_Ignore: + pNewToken = 0; + io_rText.CutToken(); + break; + case nF_fin_Eof: + if (bIsMultiline) + throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF); + else + io_rText.CutToken(); + pNewToken = new Tok_EOF; + break; + case nF_fin_AnyWord: + pNewToken = new Tok_Word(io_rText.CutToken()); + break; + case nF_fin_AtTag: + io_rText.CutToken(); + pNewToken = new Tok_AtTag( i_nTokenId - 100 ); + break; + case nF_fin_Comma: + io_rText.CutToken(); + pNewToken = new Tok_Comma; + break; + case nF_fin_EndSign: + io_rText.CutToken(); + switch (i_nTokenId) + { + case nTok_MLDocuEnd: + if (bIsMultiline) + { + pNewToken = new Tok_DocuEnd; + pFollowUpContext = pParentContext; + } + else + { + pNewToken = new Tok_Word(io_rText.CutToken()); + pFollowUpContext = this; + } + break; + case nTok_EOL: + if (bIsMultiline) + { + pNewToken = new Tok_EOL; + pFollowUpContext = this; + } + else + { + pNewToken = new Tok_DocuEnd; + pFollowUpContext = pParentContext; + } + pReceiver->Increment_CurLine(); + break; + default: + csv_assert(false); + } + break; + case nF_goto_EoHtml: + pCx_EoHtml->SetIfIsStartOfParagraph(i_nTokenId == nTok_html_parastart); + break; + case nF_goto_EoXmlConst: + pCx_EoXmlConst->SetTokenId(i_nTokenId - 200); + break; + case nF_goto_EoXmlLink_BeginTag: + pCx_EoXmlLink_BeginTag->SetTokenId(i_nTokenId - 300); + break; + case nF_goto_EoXmlLink_EndTag: + pCx_EoXmlLink_EndTag->SetTokenId(i_nTokenId - 325); + break; + case nF_goto_EoXmlFormat_BeginTag: + pCx_EoXmlFormat_BeginTag->SetTokenId(i_nTokenId - 350); + break; + case nF_goto_EoXmlFormat_EndTag: + pCx_EoXmlFormat_EndTag->SetTokenId(i_nTokenId - 375); + break; + case nF_goto_CheckStar: + pCx_CheckStar->SetIsEnd( bIsMultiline ); + break; + default: + csv_assert(false); + } // end switch (i_nStatusSignal) +} + +void +Context_Docu::SetupStateMachine() +{ + // Besondere Array-Stati (kein Tokenabschluss oder Kontextwechsel): +// const INT16 bas = 0; // Base-Status + const INT16 wht = 1; // Whitespace-overlook-Status + const INT16 awd = 2; // Any-Word-Read-Status + + // Kontextwechsel-Stati: + const INT16 goto_EoHtml = 3; + const INT16 goto_EoXmlConst = 4; + const INT16 goto_EoXmlLink_BeginTag = 5; + const INT16 goto_EoXmlLink_EndTag = 6; + const INT16 goto_EoXmlFormat_BeginTag = 7; + const INT16 goto_EoXmlFormat_EndTag = 8; + const INT16 goto_CheckStar = 9; + + // Tokenfinish-Stati: + const INT16 finError = 10; +// const INT16 finIgnore = 11; + const INT16 finEof = 12; + const INT16 finAnyWord = 13; + const INT16 finAtTag = 14; + const INT16 finEndSign = 15; +// const INT16 finComma = 16; + const INT16 finWhite = 17; + + // Konstanten zur Benutzung in der Tabelle: + const INT16 ght = goto_EoHtml; +/* + const INT16 gxc = goto_EoXmlConst; + const INT16 glb = goto_EoXmlLink_TagBegin; + const INT16 gle = goto_EoXmlLink_TagEnd; + const INT16 gfb = goto_EoXmlFormat_TagBegin; + const INT16 gfe = goto_EoXmlFormat_TagEnd; +*/ + const INT16 err = finError; + const INT16 faw = finAnyWord; +// const INT16 fig = finIgnore; +// const INT16 fes = finEndSign; + const INT16 fof = finEof; +// const INT16 fat = finAtTag; + const INT16 fwh = finWhite; + + /// The '0's will be replaced by calls of AddToken(). + + const INT16 A_nTopStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht, 0,wht,wht, 0,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // ... 31 + wht,awd,awd,awd,awd,awd,awd,awd,awd,awd, 0,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, 0,awd,awd,awd, // ... 63 + 0,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd // ... 127 + }; + + const INT16 A_nWhitespaceStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {fof,err,err,err,err,err,err,err,err,wht,fwh,wht,wht,fwh,err,err, + err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // ... 31 + wht,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, // ... 63 + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, // ... 95 + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, + fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh // ... 127 + }; + + const INT16 A_nWordStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {faw,err,err,err,err,err,err,err,err,faw,faw,faw,faw,faw,err,err, + err,err,err,err,err,err,err,err,err,err,faw,err,err,err,err,err, // ... 31 + faw,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,awd,awd, // ... 63 + faw,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd // ... 127 + }; + + const INT16 A_nAtTagDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {faw,err,err,err,err,err,err,err,err,faw,faw,faw,faw,faw,err,err, + err,err,err,err,err,err,err,err,err,err,faw,err,err,err,err,err, // ... 31 + faw,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,faw,awd,awd,awd, // ... 63 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95 + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, + awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd // ... 127 + }; + + const INT16 A_nHtmlDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {ght,err,err,err,err,err,err,err,err,ght,ght,ght,ght,ght,err,err, + err,err,err,err,err,err,err,err,err,err,ght,err,err,err,err,err, // ... 31 + ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght, + ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght, // ... 63 + ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght, + ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght, // ... 95 + ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght, + ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght,ght // ... 127 + }; + + const INT16 A_nPunctDefStatus[C_nStatusSize] = + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + {err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 16 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 48 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 80 ... + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, + err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err // 112 ... + }; + + DYN StmArrayStatu2 * dpStatusTop + = new StmArrayStatu2( C_nStatusSize, A_nTopStatus, 0, true); + DYN StmArrayStatu2 * dpStatusWhite + = new StmArrayStatu2( C_nStatusSize, A_nWhitespaceStatus, 0, true); + DYN StmArrayStatu2 * dpStatusWord + = new StmArrayStatu2( C_nStatusSize, A_nWordStatus, 0, true); + + DYN StmBoundsStatu2 * dpBst_goto_EoHtml + = new StmBoundsStatu2( *this, *pCx_EoHtml, nF_goto_EoHtml, true ); + DYN StmBoundsStatu2 * dpBst_goto_EoXmlConst + = new StmBoundsStatu2( *this, *pCx_EoXmlConst, nF_goto_EoXmlConst, true ); + DYN StmBoundsStatu2 * dpBst_goto_EoXmlLink_BeginTag + = new StmBoundsStatu2( *this, *pCx_EoXmlLink_BeginTag, nF_goto_EoXmlLink_BeginTag, true ); + DYN StmBoundsStatu2 * dpBst_goto_EoXmlLink_EndTag + = new StmBoundsStatu2( *this, *pCx_EoXmlLink_EndTag, nF_goto_EoXmlLink_EndTag, true ); + DYN StmBoundsStatu2 * dpBst_goto_EoXmlFormat_BeginTag + = new StmBoundsStatu2( *this, *pCx_EoXmlFormat_BeginTag, nF_goto_EoXmlFormat_BeginTag, true ); + DYN StmBoundsStatu2 * dpBst_goto_EoXmlFormat_EndTag + = new StmBoundsStatu2( *this, *pCx_EoXmlFormat_EndTag, nF_goto_EoXmlFormat_EndTag, true ); + DYN StmBoundsStatu2 * dpBst_goto_CheckStar + = new StmBoundsStatu2( *this, *pCx_CheckStar, nF_goto_CheckStar, true ); + + + DYN StmBoundsStatu2 * dpBst_finError + = new StmBoundsStatu2( *this, TkpContext_Null2_(), nF_fin_Error, true ); + DYN StmBoundsStatu2 * dpBst_finIgnore + = new StmBoundsStatu2( *this, *this, nF_fin_Ignore, true); + DYN StmBoundsStatu2 * dpBst_finEof + = new StmBoundsStatu2( *this, TkpContext_Null2_(), nF_fin_Eof, false); + DYN StmBoundsStatu2 * dpBst_finAnyWord + = new StmBoundsStatu2( *this, *this, nF_fin_AnyWord, true); + DYN StmBoundsStatu2 * dpBst_finAtTag + = new StmBoundsStatu2( *this, *this, nF_fin_AtTag, false); + DYN StmBoundsStatu2 * dpBst_finEndSign + = new StmBoundsStatu2( *this, *pParentContext, nF_fin_EndSign, false); + DYN StmBoundsStatu2 * dpBst_fin_Comma + = new StmBoundsStatu2( *this, *this, nF_fin_Comma, false ); + DYN StmBoundsStatu2 * dpBst_finWhite + = new StmBoundsStatu2( *this, *this, nF_fin_White, false); + + + // dpMain aufbauen: + aStateMachine.AddStatus(dpStatusTop); + aStateMachine.AddStatus(dpStatusWhite); + aStateMachine.AddStatus(dpStatusWord); + + aStateMachine.AddStatus(dpBst_goto_EoHtml); + aStateMachine.AddStatus(dpBst_goto_EoXmlConst); + aStateMachine.AddStatus(dpBst_goto_EoXmlLink_BeginTag); + aStateMachine.AddStatus(dpBst_goto_EoXmlLink_EndTag); + aStateMachine.AddStatus(dpBst_goto_EoXmlFormat_BeginTag); + aStateMachine.AddStatus(dpBst_goto_EoXmlFormat_EndTag); + aStateMachine.AddStatus(dpBst_goto_CheckStar); + + aStateMachine.AddStatus(dpBst_finError); + aStateMachine.AddStatus(dpBst_finIgnore); + aStateMachine.AddStatus(dpBst_finEof); + aStateMachine.AddStatus(dpBst_finAnyWord); + aStateMachine.AddStatus(dpBst_finAtTag); + aStateMachine.AddStatus(dpBst_finEndSign); + aStateMachine.AddStatus(dpBst_fin_Comma); + aStateMachine.AddStatus(dpBst_finWhite); + + + aStateMachine.AddToken( "@author", nTok_at_author, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@param", nTok_at_param, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@throws", nTok_at_throws, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@see", nTok_at_see, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@since", nTok_at_since, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@example", nTok_at_example, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@return", nTok_at_return, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@returns", nTok_at_return, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@deprecated", + nTok_at_deprecated, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@suspicious", + nTok_at_suspicious, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@missing", nTok_at_missing, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@incomplete", + nTok_at_incomplete, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@version", nTok_at_version, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@guarantees", + nTok_at_guarantees, A_nAtTagDefStatus, finAtTag ); + aStateMachine.AddToken( "@exception", + nTok_at_exception, A_nAtTagDefStatus, finAtTag ); + + aStateMachine.AddToken( "<", 0, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "*", 0, A_nPunctDefStatus, goto_CheckStar ); +// aStateMachine.AddToken( ",", 0, A_nPunctDefStatus, finComma ); + + aStateMachine.AddToken( "<type", nTok_link_typeB, A_nHtmlDefStatus, goto_EoXmlLink_BeginTag ); + aStateMachine.AddToken( "</type", nTok_link_typeE, A_nHtmlDefStatus, goto_EoXmlLink_EndTag ); + aStateMachine.AddToken( "<member", nTok_link_memberB, A_nHtmlDefStatus, goto_EoXmlLink_BeginTag ); + aStateMachine.AddToken( "</member", nTok_link_membeE, A_nHtmlDefStatus, goto_EoXmlLink_EndTag ); + aStateMachine.AddToken( "<const", nTok_link_constB, A_nHtmlDefStatus, goto_EoXmlLink_BeginTag ); + aStateMachine.AddToken( "</const", nTok_link_constE, A_nHtmlDefStatus, goto_EoXmlLink_EndTag ); + + aStateMachine.AddToken( "<listing", nTok_format_listingB,A_nHtmlDefStatus, goto_EoXmlFormat_BeginTag ); + aStateMachine.AddToken( "</listing",nTok_format_listingE,A_nHtmlDefStatus, goto_EoXmlFormat_EndTag ); + aStateMachine.AddToken( "<code", nTok_format_codeB, A_nHtmlDefStatus, goto_EoXmlFormat_BeginTag ); + aStateMachine.AddToken( "</code", nTok_format_codeE, A_nHtmlDefStatus, goto_EoXmlFormat_EndTag ); + aStateMachine.AddToken( "<atom", nTok_format_atomB, A_nHtmlDefStatus, goto_EoXmlFormat_BeginTag ); + aStateMachine.AddToken( "</atom", nTok_format_atomE, A_nHtmlDefStatus, goto_EoXmlFormat_EndTag ); + + aStateMachine.AddToken( "<TRUE/", nTok_const_TRUE, A_nHtmlDefStatus, goto_EoXmlConst ); + aStateMachine.AddToken( "<true/", nTok_const_TRUE, A_nHtmlDefStatus, goto_EoXmlConst ); + aStateMachine.AddToken( "<FALSE/", nTok_const_FALSE, A_nHtmlDefStatus, goto_EoXmlConst ); + aStateMachine.AddToken( "<false/", nTok_const_FALSE, A_nHtmlDefStatus, goto_EoXmlConst ); + aStateMachine.AddToken( "<NULL/", nTok_const_NULL, A_nHtmlDefStatus, goto_EoXmlConst ); + aStateMachine.AddToken( "<void/", nTok_const_void, A_nHtmlDefStatus, goto_EoXmlConst ); + + aStateMachine.AddToken( "<p", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<pre", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<dl", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<ul", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<ol", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<table", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<P", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<PRE", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<DL", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<UL", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<OL", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + aStateMachine.AddToken( "<TABLE", nTok_html_parastart, A_nHtmlDefStatus, goto_EoHtml ); + + aStateMachine.AddToken( "\r\n", nTok_EOL, A_nPunctDefStatus, finEndSign ); + aStateMachine.AddToken( "\n", nTok_EOL, A_nPunctDefStatus, finEndSign ); + aStateMachine.AddToken( "\r", nTok_EOL, A_nPunctDefStatus, finEndSign ); +}; + +void +Context_Docu::SetMode_IsMultiLine( bool i_bTrue ) +{ + bIsMultiline = i_bTrue; +} + + +} // namespace dsapi +} // namespace csi + diff --git a/autodoc/source/parser_i/idoc/docu_pe2.cxx b/autodoc/source/parser_i/idoc/docu_pe2.cxx new file mode 100644 index 000000000000..687b189cf894 --- /dev/null +++ b/autodoc/source/parser_i/idoc/docu_pe2.cxx @@ -0,0 +1,609 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: docu_pe2.cxx,v $ + * $Revision: 1.15 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_dsapi/docu_pe2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <ary/doc/d_oldidldocu.hxx> +#include <ary_i/d_token.hxx> +#include <parser/parserinfo.hxx> +#include <adc_cl.hxx> +#include <adc_msg.hxx> +#include <../parser/inc/x_docu.hxx> +#include <s2_dsapi/dsapitok.hxx> +#include <s2_dsapi/tk_atag2.hxx> +#include <s2_dsapi/tk_html.hxx> +#include <s2_dsapi/tk_docw2.hxx> +#include <s2_dsapi/tk_xml.hxx> + + +#ifdef UNX +#define strnicmp strncasecmp +#endif + + +namespace csi +{ +namespace dsapi +{ + + +const char * AtTagTitle( + const Tok_AtTag & i_rToken ); + + +SapiDocu_PE::SapiDocu_PE(ParserInfo & io_rPositionInfo) + : pDocu(0), + eState(e_none), + pPositionInfo(&io_rPositionInfo), + fCurTokenAddFunction(&SapiDocu_PE::AddDocuToken2Void), + pCurAtTag(0), + sCurDimAttribute(), + sCurAtSeeType_byXML(200) +{ +} + +SapiDocu_PE::~SapiDocu_PE() +{ +} + +void +SapiDocu_PE::ProcessToken( DYN csi::dsapi::Token & let_drToken ) +{ + if (IsComplete()) + { + pDocu = 0; + eState = e_none; + } + + if ( eState == e_none ) + { + pDocu = new ary::doc::OldIdlDocu; + eState = st_short; + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2Short; + } + + csv_assert(pDocu); + + let_drToken.Trigger(*this); + delete &let_drToken; +} + +void +SapiDocu_PE::Process_AtTag( const Tok_AtTag & i_rToken ) +{ + if (NOT pCurAtTag) + { + eState = st_attags; + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2CurAtTag; + } + else + { + csv_assert(eState == st_attags); + pDocu->AddAtTag(*pCurAtTag.Release()); + } + + if (i_rToken.Id() == Tok_AtTag::param) + { + pCurAtTag = new DT_ParameterAtTag; + fCurTokenAddFunction = &SapiDocu_PE::SetCurParameterAtTagName; + } + else if (i_rToken.Id() == Tok_AtTag::see) + { + pCurAtTag = new DT_SeeAlsoAtTag; + fCurTokenAddFunction = &SapiDocu_PE::SetCurSeeAlsoAtTagLinkText; + } + else if (i_rToken.Id() == Tok_AtTag::deprecated) + { + pDocu->SetDeprecated(); + pCurAtTag = new DT_StdAtTag(""); // Dummy that will not be used. + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2Deprecated; + } + else if (i_rToken.Id() == Tok_AtTag::since) + { + pCurAtTag = new DT_SinceAtTag; + fCurTokenAddFunction = &SapiDocu_PE::SetCurSinceAtTagVersion; + } + else + { + pCurAtTag = new DT_StdAtTag( AtTagTitle(i_rToken) ); + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2CurAtTag; + } +} + +void +SapiDocu_PE::Process_HtmlTag( const Tok_HtmlTag & i_rToken ) +{ + if (eState == st_short AND i_rToken.IsParagraphStarter()) + { + eState = st_description; + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2Description; + } + + // Workaround special for some errors in API docu: + if ( strnicmp("<true",i_rToken.Text(),5 ) == 0 ) + { + if ( strcmp("<TRUE/>",i_rToken.Text()) != 0 ) + TheMessages().Out_InvalidConstSymbol( i_rToken.Text(), + pPositionInfo->CurFile(), + pPositionInfo->CurLine() ); + (this->*fCurTokenAddFunction)( *new DT_TextToken("<b>true</b>") ); + return; + } + else if ( strnicmp("<false",i_rToken.Text(),6 ) == 0 ) + { + if ( strcmp("<FALSE/>",i_rToken.Text()) != 0 ) + TheMessages().Out_InvalidConstSymbol( i_rToken.Text(), + pPositionInfo->CurFile(), + pPositionInfo->CurLine() ); + (this->*fCurTokenAddFunction)( *new DT_TextToken("<b>false</b>") ); + return; + } + else if ( strnicmp("<NULL",i_rToken.Text(),5 ) == 0 ) + { + if ( strcmp("<NULL/>",i_rToken.Text()) != 0 ) + TheMessages().Out_InvalidConstSymbol( i_rToken.Text(), + pPositionInfo->CurFile(), + pPositionInfo->CurLine() ); + (this->*fCurTokenAddFunction)( *new DT_TextToken("<b>null</b>") ); + return; + } + else if ( strnicmp("<void",i_rToken.Text(),5 ) == 0 ) + { + if ( strcmp("<void/>",i_rToken.Text()) != 0 ) + TheMessages().Out_InvalidConstSymbol( i_rToken.Text(), + pPositionInfo->CurFile(), + pPositionInfo->CurLine() ); + (this->*fCurTokenAddFunction)( *new DT_TextToken("<b>void</b>") ); + return; + } + + (this->*fCurTokenAddFunction)( *new DT_Style(i_rToken.Text(),false) ); +} + +void +SapiDocu_PE::Process_XmlConst( const Tok_XmlConst & i_rToken ) +{ + (this->*fCurTokenAddFunction)(*new DT_MupConst(i_rToken.Text())); +} + +void +SapiDocu_PE::Process_XmlLink_BeginTag( const Tok_XmlLink_BeginTag & i_rToken ) +{ + switch (i_rToken.Id()) + { + case Tok_XmlLink_Tag::e_const: + (this->*fCurTokenAddFunction)(*new DT_Style("<b>",false)); + break; + case Tok_XmlLink_Tag::member: + (this->*fCurTokenAddFunction)(*new DT_MupMember(i_rToken.Scope())); + break; + case Tok_XmlLink_Tag::type: + (this->*fCurTokenAddFunction)(*new DT_MupType(i_rToken.Scope())); + break; + default: + // Do nothing. + ; + } + + if ( i_rToken.Dim().length() > 0 ) + sCurDimAttribute = i_rToken.Dim(); + else + sCurDimAttribute.clear(); +} + +void +SapiDocu_PE::Process_XmlLink_EndTag( const Tok_XmlLink_EndTag & i_rToken ) +{ + switch (i_rToken.Id()) + { + case Tok_XmlLink_Tag::e_const: + (this->*fCurTokenAddFunction)(*new DT_Style("</b>",false)); + break; + case Tok_XmlLink_Tag::member: + (this->*fCurTokenAddFunction)(*new DT_MupMember(true)); + break; + case Tok_XmlLink_Tag::type: + (this->*fCurTokenAddFunction)(*new DT_MupType(true)); + break; + default: + // Do nothing. + ; + } + if ( sCurDimAttribute.length() > 0 ) + { + (this->*fCurTokenAddFunction)( *new DT_TextToken(sCurDimAttribute.c_str()) ); + sCurDimAttribute.clear(); + } +} + +void +SapiDocu_PE::Process_XmlFormat_BeginTag( const Tok_XmlFormat_BeginTag & i_rToken ) +{ + switch (i_rToken.Id()) + { + case Tok_XmlFormat_Tag::code: + (this->*fCurTokenAddFunction)(*new DT_Style("<code>",false)); + break; + case Tok_XmlFormat_Tag::listing: + (this->*fCurTokenAddFunction)(*new DT_Style("<pre>",true)); + break; + case Tok_XmlFormat_Tag::atom: + (this->*fCurTokenAddFunction)(*new DT_Style("<code>",true)); + break; + default: + // Do nothing. + ; + } + if ( i_rToken.Dim().length() > 0 ) + sCurDimAttribute = i_rToken.Dim(); + else + sCurDimAttribute.clear(); +} + +void +SapiDocu_PE::Process_XmlFormat_EndTag( const Tok_XmlFormat_EndTag & i_rToken ) +{ + switch (i_rToken.Id()) + { + case Tok_XmlFormat_Tag::code: + (this->*fCurTokenAddFunction)(*new DT_Style("</code>",false)); + break; + case Tok_XmlFormat_Tag::listing: + (this->*fCurTokenAddFunction)(*new DT_Style("</pre>",true)); + break; + case Tok_XmlFormat_Tag::atom: + (this->*fCurTokenAddFunction)(*new DT_Style("</code>",true)); + break; + default: + // Do nothing. + ; + } + if ( sCurDimAttribute.length() > 0 ) + { + (this->*fCurTokenAddFunction)( *new DT_TextToken(sCurDimAttribute.c_str()) ); + sCurDimAttribute.clear(); + } +} + +void +SapiDocu_PE::Process_Word( const Tok_Word & i_rToken ) +{ + (this->*fCurTokenAddFunction)(*new DT_TextToken(i_rToken.Text())); +} + +void +SapiDocu_PE::Process_Comma() +{ + csv_assert(1==7); +// (this->*fCurTokenAddFunction)(*new DT_Comma(i_rToken.Text())); +} + +void +SapiDocu_PE::Process_DocuEnd() +{ + eState = st_complete; + if (pCurAtTag) + pDocu->AddAtTag(*pCurAtTag.Release()); + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2Void; +} + +void +SapiDocu_PE::Process_EOL() +{ + (this->*fCurTokenAddFunction)(*new DT_EOL); +} + +void +SapiDocu_PE::Process_White() +{ + (this->*fCurTokenAddFunction)(*new DT_White); +} + +DYN ary::doc::OldIdlDocu * +SapiDocu_PE::ReleaseJustParsedDocu() +{ + if (IsComplete()) + { + eState = e_none; + return pDocu.Release(); + } + return 0; +} + + +bool +SapiDocu_PE::IsComplete() const +{ + return eState == st_complete; +} + +void +SapiDocu_PE::AddDocuToken2Void( DYN ary::inf::DocuToken & let_drNewToken ) +{ + delete &let_drNewToken; +} + +void +SapiDocu_PE::AddDocuToken2Short( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pDocu); + pDocu->AddToken2Short(let_drNewToken); +} + +void +SapiDocu_PE::AddDocuToken2Description( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pDocu); + pDocu->AddToken2Description(let_drNewToken); +} + +void +SapiDocu_PE::AddDocuToken2Deprecated( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pDocu); + pDocu->AddToken2DeprecatedText(let_drNewToken); +} + +void +SapiDocu_PE::AddDocuToken2CurAtTag( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pCurAtTag); + pCurAtTag->AddToken(let_drNewToken); +} + +void +SapiDocu_PE::SetCurParameterAtTagName( DYN ary::inf::DocuToken & let_drNewToken ) +{ + if (let_drNewToken.IsWhiteOnly()) + { + delete &let_drNewToken; + return; + } + + csv_assert(pCurAtTag); + DT_TextToken * dpText = dynamic_cast< DT_TextToken* >(&let_drNewToken); + if (dpText != 0) + pCurAtTag->SetName(dpText->GetText()); + else + pCurAtTag->SetName("parameter ?"); + delete &let_drNewToken; + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2CurAtTag; +} + +void +SapiDocu_PE::SetCurSeeAlsoAtTagLinkText( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pCurAtTag); + + if (let_drNewToken.IsWhiteOnly()) + { + delete &let_drNewToken; + return; + } + + DT_TextToken * pText = dynamic_cast< DT_TextToken* >(&let_drNewToken); + if (pText != 0) + pCurAtTag->SetName(pText->GetText()); + else + { + DT_MupType * + pTypeBegin = dynamic_cast< DT_MupType* >(&let_drNewToken); + DT_MupMember * + pMemberBegin = dynamic_cast< DT_MupMember* >(&let_drNewToken); + if (pTypeBegin != 0 OR pMemberBegin != 0) + { + sCurAtSeeType_byXML.reset(); + + sCurAtSeeType_byXML + << ( pTypeBegin != 0 + ? pTypeBegin->Scope() + : pMemberBegin->Scope() ); + + if (sCurAtSeeType_byXML.tellp() > 0) + { + sCurAtSeeType_byXML + << "::"; + } + delete &let_drNewToken; + fCurTokenAddFunction = &SapiDocu_PE::SetCurSeeAlsoAtTagLinkText_2; + return; + } + else + { + pCurAtTag->SetName("? (no identifier found)"); + } + } + delete &let_drNewToken; + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2CurAtTag; +} + +void +SapiDocu_PE::SetCurSeeAlsoAtTagLinkText_2( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pCurAtTag); + + if (let_drNewToken.IsWhiteOnly()) + { + delete &let_drNewToken; + return; + } + + DT_TextToken * + pText = dynamic_cast< DT_TextToken* >(&let_drNewToken); + if (pText != 0) + { + sCurAtSeeType_byXML + << pText->GetText(); + pCurAtTag->SetName(sCurAtSeeType_byXML.c_str()); + } + else + { + pCurAtTag->SetName("? (no identifier found)"); + } + sCurAtSeeType_byXML.reset(); + delete &let_drNewToken; + fCurTokenAddFunction = &SapiDocu_PE::SetCurSeeAlsoAtTagLinkText_3; +} + +void +SapiDocu_PE::SetCurSeeAlsoAtTagLinkText_3( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pCurAtTag); + + if (let_drNewToken.IsWhiteOnly()) + { + delete &let_drNewToken; + return; + } + + /// Could emit warning, but don't because this parser is obsolete. +// Tok_XmlLink_BeginTag * +// pLinkEnd = dynamic_cast< Tok_XmlLink_EndTag* >(&let_drNewToken); +// if (pLinkEnd == 0) +// { +// warn_aboutMissingClosingTag(); +// } + + delete &let_drNewToken; + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2CurAtTag; +} + + + +void +SapiDocu_PE::SetCurSinceAtTagVersion( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pCurAtTag); + + DT_TextToken * pToken = dynamic_cast< DT_TextToken* >(&let_drNewToken); + if (pToken == 0) + { + delete &let_drNewToken; + return; + } + + const String + sVersion(pToken->GetText()); + const char + cFirst = *sVersion.begin(); + const char + cCiphersend = '9' + 1; + const autodoc::CommandLine & + rCommandLine = autodoc::CommandLine::Get_(); + + + if ( rCommandLine.DoesTransform_SinceTag()) + { + // The @since version number shall be interpreted, + + if ( NOT csv::in_range('0', cFirst, cCiphersend) ) + { + // But this is a non-number-part, so we wait for + // the next one. + delete &let_drNewToken; + return; + } + else if (rCommandLine.DisplayOf_SinceTagValue(sVersion).empty()) + { + // This is the numbered part, but we don't know it. + delete &let_drNewToken; + + StreamLock + sl(200); + sl() + << "Since-value '" + << sVersion + << "' not found in translation table."; + throw X_Docu("since", sl().c_str()); + } + } + + // Either since tags are not specially interpreted, or + // we got a known one. + pCurAtTag->AddToken(let_drNewToken); + fCurTokenAddFunction = &SapiDocu_PE::AddDocuToken2SinceAtTag; +} + +void +SapiDocu_PE::AddDocuToken2SinceAtTag( DYN ary::inf::DocuToken & let_drNewToken ) +{ + csv_assert(pCurAtTag); + String & + sValue = pCurAtTag->Access_Text().Access_TextOfFirstToken(); + StreamLock + sHelp(1000); + + DT_TextToken * + pToken = dynamic_cast< DT_TextToken* >(&let_drNewToken); + if (pToken != 0) + { + sValue = sHelp() << sValue << pToken->GetText() << c_str; + } + else if (dynamic_cast< DT_White* >(&let_drNewToken) != 0) + { + sValue = sHelp() << sValue << " " << c_str; + } + delete &let_drNewToken; +} + +const char * +AtTagTitle( const Tok_AtTag & i_rToken ) +{ + switch (i_rToken.Id()) + { + case Tok_AtTag::author: return ""; + case Tok_AtTag::see: return "See also"; + case Tok_AtTag::param: return "Parameters"; + case Tok_AtTag::e_return: return "Returns"; + case Tok_AtTag::e_throw: return "Throws"; + case Tok_AtTag::example: return "Example"; + case Tok_AtTag::deprecated: return "Deprecated"; + case Tok_AtTag::suspicious: return ""; + case Tok_AtTag::missing: return ""; + case Tok_AtTag::incomplete: return ""; + case Tok_AtTag::version: return ""; + case Tok_AtTag::guarantees: return "Guarantees"; + case Tok_AtTag::exception: return "Exception"; + case Tok_AtTag::since: return "Since version"; + default: + // See below. + ; + } + return i_rToken.Text(); +} + + + +} // namespace dsapi +} // namespace csi + diff --git a/autodoc/source/parser_i/idoc/makefile.mk b/autodoc/source/parser_i/idoc/makefile.mk new file mode 100644 index 000000000000..90b483f3cbb5 --- /dev/null +++ b/autodoc/source/parser_i/idoc/makefile.mk @@ -0,0 +1,66 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=parser2_s2_dsapi + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/cx_docu2.obj \ + $(OBJ)$/cx_dsapi.obj \ + $(OBJ)$/docu_pe2.obj \ + $(OBJ)$/tk_atag2.obj \ + $(OBJ)$/tk_docw2.obj \ + $(OBJ)$/tk_html.obj \ + $(OBJ)$/tk_xml.obj + + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser_i/idoc/tk_atag2.cxx b/autodoc/source/parser_i/idoc/tk_atag2.cxx new file mode 100644 index 000000000000..d3061a35ef56 --- /dev/null +++ b/autodoc/source/parser_i/idoc/tk_atag2.cxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_atag2.cxx,v $ + * $Revision: 1.8 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_dsapi/tk_atag2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <s2_dsapi/tokintpr.hxx> + + + +using csi::dsapi::Tok_AtTag; + +lux::EnumValueMap G_aTokAtTag_EV_TokenId_Values; +Tok_AtTag::EV_TokenId ev_none2(Tok_AtTag::e_none,""); +Tok_AtTag::EV_TokenId ev_author(Tok_AtTag::author,"@author"); +Tok_AtTag::EV_TokenId ev_see(Tok_AtTag::see,"@see"); +Tok_AtTag::EV_TokenId ev_param(Tok_AtTag::param,"@param"); +Tok_AtTag::EV_TokenId ev_e_return(Tok_AtTag::e_return,"@return"); +Tok_AtTag::EV_TokenId ev_e_throw(Tok_AtTag::e_throw,"@throws"); +Tok_AtTag::EV_TokenId ev_example(Tok_AtTag::example,"@example"); +Tok_AtTag::EV_TokenId ev_deprecated(Tok_AtTag::deprecated,"@deprecated"); +Tok_AtTag::EV_TokenId ev_suspicious(Tok_AtTag::suspicious,"@suspicious"); +Tok_AtTag::EV_TokenId ev_missing(Tok_AtTag::missing,"@missing"); +Tok_AtTag::EV_TokenId ev_incomplete(Tok_AtTag::incomplete,"@incomplete"); +Tok_AtTag::EV_TokenId ev_version(Tok_AtTag::version,"@version"); +Tok_AtTag::EV_TokenId ev_guarantees(Tok_AtTag::guarantees,"@guarantees"); +Tok_AtTag::EV_TokenId ev_exception(Tok_AtTag::exception,"@exception"); +Tok_AtTag::EV_TokenId ev_since(Tok_AtTag::since,"@since"); + + +namespace lux +{ +template<> EnumValueMap & +Tok_AtTag::EV_TokenId::Values_() { return G_aTokAtTag_EV_TokenId_Values; } +} + + +namespace csi +{ +namespace dsapi +{ + +void +Tok_AtTag::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_AtTag(*this); +} + +const char * +Tok_AtTag::Text() const +{ + return eTag.Text(); +} + +} // namespace dsapi +} // namespace csi + diff --git a/autodoc/source/parser_i/idoc/tk_docw2.cxx b/autodoc/source/parser_i/idoc/tk_docw2.cxx new file mode 100644 index 000000000000..3999148262b0 --- /dev/null +++ b/autodoc/source/parser_i/idoc/tk_docw2.cxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_docw2.cxx,v $ + * $Revision: 1.6 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_dsapi/tk_docw2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <s2_dsapi/tokintpr.hxx> + + + +namespace csi +{ +namespace dsapi +{ + +void +Tok_Word::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Word(*this); +} + +const char * +Tok_Word::Text() const +{ + return sText; +} + +void +Tok_Comma::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_Comma(); +} + +const char * +Tok_Comma::Text() const +{ + return ","; +} + +void +Tok_DocuEnd::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_DocuEnd(); +} + +const char * +Tok_DocuEnd::Text() const +{ + return "*/"; +} + +void +Tok_EOL::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_EOL(); +} + +const char * +Tok_EOL::Text() const +{ + return "\r\n"; +} + +void +Tok_EOF::Trigger( TokenInterpreter & ) const +{ + csv_assert(false); +} + +const char * +Tok_EOF::Text() const +{ + return ""; +} + +void +Tok_White::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_White(); +} + +const char * +Tok_White::Text() const +{ + return " "; +} + + + + +} // namespace dsapi +} // namespace csi + diff --git a/autodoc/source/parser_i/idoc/tk_html.cxx b/autodoc/source/parser_i/idoc/tk_html.cxx new file mode 100644 index 000000000000..ceb7a430451e --- /dev/null +++ b/autodoc/source/parser_i/idoc/tk_html.cxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_html.cxx,v $ + * $Revision: 1.5 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_dsapi/tk_html.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <s2_dsapi/tokintpr.hxx> + + + +namespace csi +{ +namespace dsapi +{ + +void +Tok_HtmlTag::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_HtmlTag(*this); +} + +const char * +Tok_HtmlTag::Text() const +{ + return sTag; +} + + +} // namespace dsapi +} // namespace csi + + diff --git a/autodoc/source/parser_i/idoc/tk_xml.cxx b/autodoc/source/parser_i/idoc/tk_xml.cxx new file mode 100644 index 000000000000..b5d2f71d8956 --- /dev/null +++ b/autodoc/source/parser_i/idoc/tk_xml.cxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_xml.cxx,v $ + * $Revision: 1.7 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <s2_dsapi/tk_xml.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <s2_dsapi/tokintpr.hxx> + +using csi::dsapi::Tok_XmlConst; +using csi::dsapi::Tok_XmlLink_Tag; +using csi::dsapi::Tok_XmlFormat_Tag; + + +lux::EnumValueMap G_aTok_XmlConst_EV_TokenId_Values; +Tok_XmlConst::EV_TokenId ev_consts_none(Tok_XmlConst::e_none,""); +Tok_XmlConst::EV_TokenId ev_e_true(Tok_XmlConst::e_true,"true"); +Tok_XmlConst::EV_TokenId ev_e_false(Tok_XmlConst::e_false,"false"); +Tok_XmlConst::EV_TokenId ev_e_null(Tok_XmlConst::e_null,"NULL"); +Tok_XmlConst::EV_TokenId ev_e_void(Tok_XmlConst::e_void,"void"); + +lux::EnumValueMap G_aTok_XmlLink_Tag_EV_TokenId_Values; +Tok_XmlLink_Tag::EV_TokenId ev_linktags_none(Tok_XmlLink_Tag::e_none,""); +Tok_XmlLink_Tag::EV_TokenId ev_e_const(Tok_XmlLink_Tag::e_const,"const"); +Tok_XmlLink_Tag::EV_TokenId ev_member(Tok_XmlLink_Tag::member,"member"); +Tok_XmlLink_Tag::EV_TokenId ev_type(Tok_XmlLink_Tag::type,"type"); + +lux::EnumValueMap G_aTok_XmlFormat_Tag_EV_TokenId_Values; +Tok_XmlFormat_Tag::EV_TokenId ev_formattags_none(Tok_XmlFormat_Tag::e_none,""); +Tok_XmlFormat_Tag::EV_TokenId ev_code(Tok_XmlFormat_Tag::code,"code"); +Tok_XmlFormat_Tag::EV_TokenId ev_listing(Tok_XmlFormat_Tag::listing,"listing"); +Tok_XmlFormat_Tag::EV_TokenId ev_atom(Tok_XmlFormat_Tag::atom,"code"); + + +namespace lux +{ + +template<> EnumValueMap & +Tok_XmlConst::EV_TokenId::Values_() { return G_aTok_XmlConst_EV_TokenId_Values; } +template<> EnumValueMap & +Tok_XmlLink_Tag::EV_TokenId::Values_() { return G_aTok_XmlLink_Tag_EV_TokenId_Values; } +template<> EnumValueMap & +Tok_XmlFormat_Tag::EV_TokenId::Values_() { return G_aTok_XmlFormat_Tag_EV_TokenId_Values; } + +} // namespace lux + + + +namespace csi +{ +namespace dsapi +{ + +void +Tok_XmlConst::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_XmlConst(*this); +} + +const char * +Tok_XmlConst::Text() const +{ + return eTag.Text(); +} + +void +Tok_XmlLink_BeginTag::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_XmlLink_BeginTag(*this); +} + +const char * +Tok_XmlLink_BeginTag::Text() const +{ + static StreamStr ret(120); + ret.seekp(0); + if (sScope.length() > 0) + { + ret << "<" + << eTag.Text() + << " scope=\"" + << sScope + << "\">"; + } + else + { + ret << "<" + << eTag.Text() + << ">"; + } + return ret.c_str(); +} + +void +Tok_XmlLink_EndTag::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_XmlLink_EndTag(*this); +} + +const char * +Tok_XmlLink_EndTag::Text() const +{ + static StreamStr ret(120); + ret.seekp(0); + ret << "</" + << eTag.Text() + << ">"; + return ret.c_str(); +} + +void +Tok_XmlFormat_BeginTag::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_XmlFormat_BeginTag(*this); +} + +const char * +Tok_XmlFormat_BeginTag::Text() const +{ + static StreamStr ret(120); + ret.seekp(0); + ret << "<" + << eTag.Text() + << ">"; + return ret.c_str(); +} + +void +Tok_XmlFormat_EndTag::Trigger( TokenInterpreter & io_rInterpreter ) const +{ + io_rInterpreter.Process_XmlFormat_EndTag(*this); +} + +const char * +Tok_XmlFormat_EndTag::Text() const +{ + static StreamStr ret(120); + ret.seekp(0); + ret << "</" + << eTag.Text() + << ">"; + return ret.c_str(); +} + + +} // namespace dsapi +} // namespace csi + + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/cx_docu2.hxx b/autodoc/source/parser_i/inc/s2_dsapi/cx_docu2.hxx new file mode 100644 index 000000000000..39c8c61c020b --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/cx_docu2.hxx @@ -0,0 +1,236 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_docu2.hxx,v $ + * $Revision: 1.4 $ + * + * 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 DSAPI_CX_DOCU2_HXX +#define DSAPI_CX_DOCU2_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcont2.hxx> + // COMPONENTS + // PARAMETERS +#include <s2_dsapi/tk_xml.hxx> + +namespace csi +{ +namespace dsapi +{ + +class Token_Receiver; + + +/** +@descr +*/ + +class Cx_Base : public ::TkpContext +{ + public: + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); + protected: + // LIFECYCLE + Cx_Base( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : rReceiver(o_rReceiver), + pFollowUpContext(&i_rFollowUpContext) + // pNewToken + { } + protected: + void SetToken( + DYN Token * let_dpToken ) + { pNewToken = let_dpToken; } + void Handle_DocuSyntaxError( + CharacterSource & io_rText ); + + private: + // DATA + Token_Receiver & rReceiver; + TkpContext * pFollowUpContext; + Dyn<Token> pNewToken; +}; + + +class Cx_EoHtml : public Cx_Base +{ + public: + // LIFECYCLE + Cx_EoHtml( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetIfIsStartOfParagraph( + bool i_bNextTokenProperty ) + { bToken_IsStartOfParagraph = i_bNextTokenProperty; } + + private: + bool bToken_IsStartOfParagraph; +}; + +class Cx_EoXmlConst : public Cx_Base +{ + public: + // LIFECYCLE + Cx_EoXmlConst( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetTokenId( + lux::Enum< Tok_XmlConst::E_TokenId > + i_eTokenId ) + { eTokenId = i_eTokenId; } + private: + Tok_XmlConst::EV_TokenId + eTokenId; +}; + +class Cx_EoXmlLink_BeginTag : public Cx_Base +{ + public: + // LIFECYCLE + Cx_EoXmlLink_BeginTag( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetTokenId( + Tok_XmlLink_BeginTag::EV_TokenId + i_eTokenId ) + { eTokenId = i_eTokenId; } + private: + Tok_XmlLink_BeginTag::EV_TokenId + eTokenId; +}; + +class Cx_EoXmlLink_EndTag : public Cx_Base +{ + public: + // LIFECYCLE + Cx_EoXmlLink_EndTag( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetTokenId( + Tok_XmlLink_EndTag::EV_TokenId + i_eTokenId ) + { eTokenId = i_eTokenId; } + private: + Tok_XmlLink_EndTag::E_TokenId + eTokenId; +}; + +class Cx_EoXmlFormat_BeginTag : public Cx_Base +{ + public: + // LIFECYCLE + Cx_EoXmlFormat_BeginTag( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetTokenId( + lux::Enum< Tok_XmlFormat_BeginTag::E_TokenId > + i_eTokenId ) + { eTokenId = i_eTokenId; } + private: + lux::Enum< Tok_XmlFormat_BeginTag::E_TokenId > + eTokenId; +}; + +class Cx_EoXmlFormat_EndTag : public Cx_Base +{ + public: + // LIFECYCLE + Cx_EoXmlFormat_EndTag( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetTokenId( + lux::Enum< Tok_XmlFormat_EndTag::E_TokenId > + i_eTokenId ) + { eTokenId = i_eTokenId; } + private: + lux::Enum< Tok_XmlFormat_EndTag::E_TokenId > + eTokenId; +}; + +class Cx_CheckStar : public Cx_Base +{ + public: + // LIFECYCLE + Cx_CheckStar( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext), + bIsEnd(false), bEndTokenFound(false) + { } + void Set_End_FolloUpContext( + TkpContext & i_rEnd_FollowUpContext ) + { pEnd_FollowUpContext = &i_rEnd_FollowUpContext; } + + virtual void ReadCharChain( + CharacterSource & io_rText ); + void SetIsEnd( + bool i_bIsEnd ) + { bIsEnd = i_bIsEnd; } + virtual TkpContext & + FollowUpContext(); + private: + TkpContext * pEnd_FollowUpContext; + bool bIsEnd; + bool bEndTokenFound; +}; + + +} // namespace dsapi +} // namespace csi + + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/cx_dsapi.hxx b/autodoc/source/parser_i/inc/s2_dsapi/cx_dsapi.hxx new file mode 100644 index 000000000000..242dbd790b80 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/cx_dsapi.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_dsapi.hxx,v $ + * $Revision: 1.4 $ + * + * 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_CX_DSAPI_HXX +#define ADC_CX_DSAPI_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcont2.hxx> + // COMPONENTS +#include <cosv/tpl/dyn.hxx> +#include <tokens/tkpstam2.hxx> + // PARAMETERS + + +namespace csi +{ +namespace dsapi +{ + +class Token_Receiver; +class Token; + +class Cx_EoHtml; +class Cx_EoXmlConst; +class Cx_EoXmlLink_BeginTag; +class Cx_EoXmlLink_EndTag; +class Cx_EoXmlFormat_BeginTag; +class Cx_EoXmlFormat_EndTag; +class Cx_CheckStar; + +/** +@descr +*/ +class Context_Docu : public TkpDocuContext, + private StateMachineContext +{ + public: + // LIFECYCLE + Context_Docu( + Token_Receiver & o_rReceiver ); + virtual void SetParentContext( + TkpContext & io_rParentContext, + const char * i_sMultiLineEndToken ); + + ~Context_Docu(); + // OPERATIONS + 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, + UINT16 i_nTokenId, + CharacterSource & io_rText ); + + void SetupStateMachine(); + + // DATA + StateMachin2 aStateMachine; + Token_Receiver * pReceiver; + + // Contexts + TkpContext * pParentContext; + String sMultiLineEndToken; + + Dyn<Cx_EoHtml> pCx_EoHtml; + Dyn<Cx_EoXmlConst> pCx_EoXmlConst; + Dyn<Cx_EoXmlLink_BeginTag> + pCx_EoXmlLink_BeginTag; + Dyn<Cx_EoXmlLink_EndTag> + pCx_EoXmlLink_EndTag; + Dyn<Cx_EoXmlFormat_BeginTag> + pCx_EoXmlFormat_BeginTag; + Dyn<Cx_EoXmlFormat_EndTag> + pCx_EoXmlFormat_EndTag; + Dyn<Cx_CheckStar> pCx_CheckStar; + + // Temporary data, used during ReadCharChain() + Dyn<Token> pNewToken; + ::TkpContext * pFollowUpContext; + bool bIsMultiline; +}; + + +} // namespace dsapi +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/docu_pe2.hxx b/autodoc/source/parser_i/inc/s2_dsapi/docu_pe2.hxx new file mode 100644 index 000000000000..16af1e82491f --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/docu_pe2.hxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: docu_pe2.hxx,v $ + * $Revision: 1.9 $ + * + * 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_DSAPI_DOCU_PE2_HXX +#define ADC_DSAPI_DOCU_PE2_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_dsapi/tokintpr.hxx> + // COMPONENTS + // PARAMETERS + +class ParserInfo; + +namespace ary +{ +namespace doc +{ + class OldIdlDocu; +} + +namespace inf +{ + class DocuToken; +} // namespace info +} // namespace ary + + + +namespace csi +{ +namespace dsapi +{ + + +class Token; +class DT_AtTag; + +class SapiDocu_PE : public TokenInterpreter +{ + public: + SapiDocu_PE( + ParserInfo & io_rPositionInfo ); + ~SapiDocu_PE(); + + void ProcessToken( + DYN csi::dsapi::Token & + let_drToken ); + + virtual void Process_AtTag( + const Tok_AtTag & i_rToken ); + virtual void Process_HtmlTag( + const Tok_HtmlTag & i_rToken ); + virtual void Process_XmlConst( + const Tok_XmlConst & + i_rToken ); + virtual void Process_XmlLink_BeginTag( + const Tok_XmlLink_BeginTag & + i_rToken ); + virtual void Process_XmlLink_EndTag( + const Tok_XmlLink_EndTag & + i_rToken ); + virtual void Process_XmlFormat_BeginTag( + const Tok_XmlFormat_BeginTag & + i_rToken ); + virtual void Process_XmlFormat_EndTag( + const Tok_XmlFormat_EndTag & + i_rToken ); + virtual void Process_Word( + const Tok_Word & i_rToken ); + virtual void Process_Comma(); + virtual void Process_DocuEnd(); + virtual void Process_EOL(); + virtual void Process_White(); + + + DYN ary::doc::OldIdlDocu * + ReleaseJustParsedDocu(); + + bool IsComplete() const; + + private: + enum E_State + { + e_none = 0, + st_short, + st_description, + st_attags, + st_complete + }; + + typedef void ( SapiDocu_PE::*F_TokenAdder )( DYN ary::inf::DocuToken & let_drNewToken ); + + void AddDocuToken2Void( + DYN ary::inf::DocuToken & + let_drNewToken ); + void AddDocuToken2Short( + DYN ary::inf::DocuToken & + let_drNewToken ); + void AddDocuToken2Description( + DYN ary::inf::DocuToken & + let_drNewToken ); + void AddDocuToken2Deprecated( + DYN ary::inf::DocuToken & + let_drNewToken ); + void AddDocuToken2CurAtTag( + DYN ary::inf::DocuToken & + let_drNewToken ); + void SetCurParameterAtTagName( + DYN ary::inf::DocuToken & + let_drNewToken ); + void SetCurSeeAlsoAtTagLinkText( + DYN ary::inf::DocuToken & + let_drNewToken ); + void SetCurSeeAlsoAtTagLinkText_2( + DYN ary::inf::DocuToken & + let_drNewToken ); + void SetCurSeeAlsoAtTagLinkText_3( + DYN ary::inf::DocuToken & + let_drNewToken ); + void SetCurSinceAtTagVersion( + DYN ary::inf::DocuToken & + let_drNewToken ); + void AddDocuToken2SinceAtTag( + DYN ary::inf::DocuToken & + let_drNewToken ); + + // DATA + Dyn<ary::doc::OldIdlDocu> + pDocu; + E_State eState; + ParserInfo * pPositionInfo; + F_TokenAdder fCurTokenAddFunction; + + Dyn<DT_AtTag> pCurAtTag; + String sCurDimAttribute; + StreamStr sCurAtSeeType_byXML; +}; + +} // namespace dsapi +} // namespace csi + + +// IMPLEMENTATION + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/dsapitok.hxx b/autodoc/source/parser_i/inc/s2_dsapi/dsapitok.hxx new file mode 100644 index 000000000000..64bd73bd0d2e --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/dsapitok.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dsapitok.hxx,v $ + * $Revision: 1.3 $ + * + * 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 DSAPI_DSAPITOK_HXX +#define DSAPI_DSAPITOK_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/token2.hxx> + // COMPONENTS + // PARAMETERS + + +namespace csi +{ +namespace dsapi +{ + + +class TokenInterpreter; + + +class Token : public TextToken +{ + public: + // LIFECYCLE + virtual ~Token() {} + + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const = 0; +}; + + +} // namespace dsapi +} // namespace csi + + +#endif + + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/tk_atag2.hxx b/autodoc/source/parser_i/inc/s2_dsapi/tk_atag2.hxx new file mode 100644 index 000000000000..5e4804ff4ca4 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/tk_atag2.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_atag2.hxx,v $ + * $Revision: 1.5 $ + * + * 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 DSAPI_TK_ATAG2_HXX +#define DSAPI_TK_ATAG2_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_dsapi/dsapitok.hxx> + // COMPONENTS + // PARAMETERS +#include <luxenum.hxx> + +namespace csi +{ +namespace dsapi +{ + + +class Tok_AtTag : public Token +{ + public: + // TYPE + enum E_TokenId + { + e_none = 0, + author = 1, + see = 2, + param = 3, + e_return = 4, + e_throw = 5, + example = 6, + deprecated = 7, + suspicious = 8, + missing = 9, + incomplete = 10, + version = 11, + guarantees = 12, + exception = 13, + since = 14 + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + // Spring and Fall + Tok_AtTag( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + E_TokenId Id() const { return eTag; } + + private: + EV_TokenId eTag; +}; + +} // namespace dsapi +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/tk_docw2.hxx b/autodoc/source/parser_i/inc/s2_dsapi/tk_docw2.hxx new file mode 100644 index 000000000000..f3d1d514844f --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/tk_docw2.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_docw2.hxx,v $ + * $Revision: 1.5 $ + * + * 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 DSAPI_TK_DOCW2_HXX +#define DSAPI_TK_DOCW2_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_dsapi/dsapitok.hxx> + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace dsapi +{ + + +class Tok_Word : public Token +{ + public: + // Spring and Fall + Tok_Word( + const char * i_sText ) + : sText(i_sText) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + + private: + // DATA + String sText; +}; + +class Tok_Comma : public Token +{ + public: + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; +}; + +class Tok_DocuEnd : public Token +{ + public: + // Spring and Fall + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; +}; + +class Tok_EOL : public Token +{ + public: + // Spring and Fall + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; +}; + +class Tok_EOF : public Token +{ + public: + // Spring and Fall + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; +}; + +class Tok_White : public Token +{ + public: + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; +}; + + + +} // namespace dsapi +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/tk_html.hxx b/autodoc/source/parser_i/inc/s2_dsapi/tk_html.hxx new file mode 100644 index 000000000000..42e9b369c3c5 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/tk_html.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_html.hxx,v $ + * $Revision: 1.4 $ + * + * 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 DSAPI_TK_HTML_HXX +#define DSAPI_TK_HTML_HXX + + +// USED SERVICES + // BASE CLASSES +#include <s2_dsapi/dsapitok.hxx> + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace dsapi +{ + + +class Tok_HtmlTag : public Token +{ + public: + // Spring and Fall + Tok_HtmlTag( + const char * i_sTag, + bool i_bIsParagraphStarter ) + : sTag(i_sTag), + bIsParagraphStarter(i_bIsParagraphStarter) + {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + bool IsParagraphStarter() const + { return bIsParagraphStarter; } + + private: + String sTag; + bool bIsParagraphStarter; +}; + + +} // namespace dsapi +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/tk_xml.hxx b/autodoc/source/parser_i/inc/s2_dsapi/tk_xml.hxx new file mode 100644 index 000000000000..fd12a6e2924a --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/tk_xml.hxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_xml.hxx,v $ + * $Revision: 1.5 $ + * + * 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 DSAPI_TK_XML_HXX +#define DSAPI_TK_XML_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_dsapi/dsapitok.hxx> + // COMPONENTS + // PARAMETERS +#include <luxenum.hxx> + + +namespace csi +{ +namespace dsapi +{ + + +class Tok_XmlTag : public Token +{ + public: +}; + +class Tok_XmlConst : public Tok_XmlTag +{ + public: + // TYPE + enum E_TokenId + { + e_none = 0, + e_true = 1, + e_false = 2, + e_null = 3, + e_void = 4 + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + // Spring and Fall + Tok_XmlConst( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + +class Tok_XmlLink_Tag : public Tok_XmlTag +{ + public: + // TYPE + enum E_TokenId + { + e_none = 0, + e_const = 1, + member = 2, + type = 3 + }; + typedef lux::Enum<E_TokenId> EV_TokenId; +}; + +class Tok_XmlLink_BeginTag : public Tok_XmlLink_Tag +{ + public: + // Spring and Fall + Tok_XmlLink_BeginTag( + EV_TokenId i_eTag, + const String & i_sScope, + const String & i_sDim ) + : eTag(i_eTag), + sScope(i_sScope), + sDim(i_sDim) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + E_TokenId Id() const { return eTag; } + const String & Scope() const { return sScope; } + const String & Dim() const { return sDim; } + + private: + // DATA + EV_TokenId eTag; + String sScope; + String sDim; +}; + +class Tok_XmlLink_EndTag : public Tok_XmlLink_Tag +{ + public: + // Spring and Fall + Tok_XmlLink_EndTag( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + +class Tok_XmlFormat_Tag : public Tok_XmlTag +{ + public: + // TYPE + enum E_TokenId + { + e_none = 0, + code = 1, + listing = 2, + atom = 3 + }; + typedef lux::Enum<E_TokenId> EV_TokenId; +}; + +class Tok_XmlFormat_BeginTag : public Tok_XmlFormat_Tag +{ + public: + // Spring and Fall + Tok_XmlFormat_BeginTag( + EV_TokenId i_eTag, + const String & i_sDim ) + : eTag(i_eTag), + sDim(i_sDim) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + E_TokenId Id() const { return eTag; } + const String & Dim() const { return sDim; } + + private: + // DATA + EV_TokenId eTag; + String sDim; +}; + +class Tok_XmlFormat_EndTag : public Tok_XmlFormat_Tag +{ + public: + // Spring and Fall + Tok_XmlFormat_EndTag( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char* Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + + +} // namespace dsapi +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/tokintpr.hxx b/autodoc/source/parser_i/inc/s2_dsapi/tokintpr.hxx new file mode 100644 index 000000000000..c192813c67c1 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/tokintpr.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokintpr.hxx,v $ + * $Revision: 1.4 $ + * + * 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_DSAPI_TOKINTPR_HXX +#define ADC_DSAPI_TOKINTPR_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace dsapi +{ + + +class Tok_AtTag; +class Tok_XmlConst; +class Tok_XmlLink_BeginTag; +class Tok_XmlLink_EndTag; +class Tok_XmlFormat_BeginTag; +class Tok_XmlFormat_EndTag; +class Tok_Word; +class Tok_HtmlTag; + +class TokenInterpreter +{ + public: + virtual ~TokenInterpreter() {} + + virtual void Process_AtTag( + const Tok_AtTag & i_rToken ) = 0; + virtual void Process_HtmlTag( + const Tok_HtmlTag & i_rToken ) = 0; + virtual void Process_XmlConst( + const Tok_XmlConst & + i_rToken ) = 0; + virtual void Process_XmlLink_BeginTag( + const Tok_XmlLink_BeginTag & + i_rToken ) = 0; + virtual void Process_XmlLink_EndTag( + const Tok_XmlLink_EndTag & + i_rToken ) = 0; + virtual void Process_XmlFormat_BeginTag( + const Tok_XmlFormat_BeginTag & + i_rToken ) = 0; + virtual void Process_XmlFormat_EndTag( + const Tok_XmlFormat_EndTag & + i_rToken ) = 0; + virtual void Process_Word( + const Tok_Word & i_rToken ) = 0; + virtual void Process_Comma() = 0; + virtual void Process_DocuEnd() = 0; + virtual void Process_EOL() = 0; + virtual void Process_White() = 0; +}; + + + +// IMPLEMENTATION + + +} // namespace dsapi +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_dsapi/tokrecv.hxx b/autodoc/source/parser_i/inc/s2_dsapi/tokrecv.hxx new file mode 100644 index 000000000000..25456759f316 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_dsapi/tokrecv.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokrecv.hxx,v $ + * $Revision: 1.4 $ + * + * 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 DSAPI_TOKRECV_HXX +#define DSAPI_TOKRECV_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace dsapi +{ + + +class Token; +/** +@descr +*/ +class Token_Receiver +{ + public: + virtual ~Token_Receiver() {} + virtual void Receive( + DYN Token & let_drToken ) = 0; + virtual void Increment_CurLine() = 0; +}; + + +} // namespace dsapi +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/cx_idlco.hxx b/autodoc/source/parser_i/inc/s2_luidl/cx_idlco.hxx new file mode 100644 index 000000000000..4ccb9b68bb9a --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/cx_idlco.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_idlco.hxx,v $ + * $Revision: 1.4 $ + * + * 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 LUIDL_CX_IDLCO_HXX +#define LUIDL_CX_IDLCO_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcont2.hxx> + // COMPONENTS +#include <tokens/tkpstam2.hxx> + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + +class Token_Receiver; +class Token; + +/** +*/ +class Context_UidlCode : public TkpContext, + private StateMachineContext +{ + public: + // LIFECYCLE + Context_UidlCode( + Token_Receiver & o_rReceiver, + DYN TkpDocuContext & + let_drContext_Docu ); + ~Context_UidlCode(); + // OPERATORS + + // OPERATIONS + virtual void ReadCharChain( + CharacterSource & io_rText ); + virtual bool PassNewToken(); + + // INQUIRY + virtual TkpContext & + FollowUpContext(); + private: + // SERVICE FUNCTIONS + void PerformStatusFunction( + uintt i_nStatusSignal, + UINT16 i_nTokenId, + CharacterSource & io_rText ); + void SetupStateMachine(); + + // DATA + StateMachin2 aStateMachine; + Token_Receiver * pReceiver; + + // Contexts + Dyn<TkpDocuContext> pDocuContext; + + Dyn<TkpContext> dpContext_MLComment; + Dyn<TkpContext> dpContext_SLComment; + Dyn<TkpContext> dpContext_Preprocessor; + Dyn<TkpContext> dpContext_Assignment; + + // Temporary data, used during ReadCharChain() + Dyn<Token> pNewToken; + ::TkpContext * pFollowUpContext; +}; + + +} // namespace uidl +} // namespace csi + +#endif diff --git a/autodoc/source/parser_i/inc/s2_luidl/cx_sub.hxx b/autodoc/source/parser_i/inc/s2_luidl/cx_sub.hxx new file mode 100644 index 000000000000..60416af9ce58 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/cx_sub.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: cx_sub.hxx,v $ + * $Revision: 1.7 $ + * + * 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_LUIDL_CX_SUB_HXX +#define ADC_LUIDL_CX_SUB_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkpcont2.hxx> + // COMPONENTS + // PARAMETERS + +#include "uidl_tok.hxx" + +namespace csi +{ +namespace uidl +{ + +class Token_Receiver; +class Token; + + +class Cx_Base : public ::TkpContext +{ + public: + virtual bool PassNewToken(); + virtual TkpContext & + FollowUpContext(); + protected: + // LIFECYCLE + Cx_Base( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : rReceiver(o_rReceiver), + pFollowUpContext(&i_rFollowUpContext), + pNewToken() + {} + protected: + void SetToken( + DYN Token * let_dpToken ) + { pNewToken = let_dpToken; } + Token_Receiver & Receiver() { return rReceiver; } + + private: + // DATA + Token_Receiver & rReceiver; + TkpContext * pFollowUpContext; + Dyn<Token> pNewToken; +}; + + + +/** +@descr +*/ + +class Context_MLComment : public Cx_Base +{ + public: + Context_MLComment( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + +class Context_SLComment : public Cx_Base +{ + public: + Context_SLComment( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + +class Context_Praeprocessor : public Cx_Base +{ + public: + Context_Praeprocessor( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + +class Context_Assignment : public Cx_Base +{ + public: + Context_Assignment( + Token_Receiver & o_rReceiver, + TkpContext & i_rFollowUpContext ) + : Cx_Base(o_rReceiver, i_rFollowUpContext) {} + virtual void ReadCharChain( + CharacterSource & io_rText ); +}; + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/distrib.hxx b/autodoc/source/parser_i/inc/s2_luidl/distrib.hxx new file mode 100644 index 000000000000..19f052eac791 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/distrib.hxx @@ -0,0 +1,275 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: distrib.hxx,v $ + * $Revision: 1.8 $ + * + * 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 LUIDL_DISTRIB_HXX +#define LUIDL_DISTRIB_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/tokrecv.hxx> +#include <s2_dsapi/tokrecv.hxx> +#include <s2_luidl/tokproct.hxx> + // COMPONENTS + // PARAMETERS + + +class ParserInfo; + +namespace ary +{ + class Repository; + +namespace doc +{ + class OldIdlDocu; +} // namespace inf +} // namespace ary) + + + +namespace csi +{ +namespace dsapi +{ + class Token_Receiver; + class SapiDocu_PE; +} + + + +namespace uidl +{ + + +typedef std::vector< DYN Token * > TokenQueue; +typedef TokenQueue::iterator TokenIterator; + +class TokenParser_Uidl; +class UnoIDL_PE; +class Token; + + +class TokenDistributor : private TokenProcessing_Types + +{ + public: + TokenDistributor( + ary::Repository & io_rRepository, + ParserInfo & io_rParserInfo ); + void SetTokenProvider( + TokenParser_Uidl & io_rTokenSource ); + void SetTopParseEnvironment( + UnoIDL_PE & io_pTopParseEnvironment ); + ~TokenDistributor(); + + + void Reset() { aDocumentation.Reset(); } + /** calls pTokenSource->GetNextToken() and checks the incoming tokens, until a + usable token is found. This token will be forwarded to + pTopParseEnv; + */ + void TradeToken(); + + csi::uidl::Token_Receiver & + CodeTokens_Receiver(); + csi::dsapi::Token_Receiver & + DocuTokens_Receiver(); + + /** Used from PE_File, if there is a docu to get without + an environment to push (this is the case for modules). + */ + DYN ary::doc::OldIdlDocu * + ReleaseLastParsedDocu() + { return aDocumentation.ReleaseLastParsedDocu(); } + + /** Used from PE_File, if the term "published" was parsed. + The next opened parse environment will be set to be published + (call ->UnoIDL_PE::SetPublished()). + */ + void Set_PublishedOn() + { aProcessingData.Set_PublishedOn(); } + + + private: + class Documentation; + class ProcessingData; + friend class ProcessingData; + + class ProcessingData : public csi::uidl::Token_Receiver, + private TokenProcessing_Types + { + public: + ProcessingData( + ary::Repository & io_rRepository, + Documentation & i_rDocuProcessor, + ParserInfo & io_rParserInfo ); + ~ProcessingData(); + void SetTopParseEnvironment( + UnoIDL_PE & io_pTopParseEnvironment ); + + + /** is called from pTokenSource before finishing a ::TokenParse2::GetNextToken() + call and passes the just parsed token to this class. + */ + virtual void Receive( + DYN csi::uidl::Token & + let_drToken ); + virtual void Increment_CurLine(); + + void ProcessCurToken(); + + UnoIDL_PE & CurEnvironment() const; + bool NextTokenExists() const; + void Set_PublishedOn() + { bPublishedRecentlyOn = true; } + + private: + typedef uintt TokenQ_Position; + typedef std::pair< UnoIDL_PE *, TokenQ_Position > EnvironmentInfo; + typedef std::vector< EnvironmentInfo > EnvironmentStack; + + void AcknowledgeResult(); + const csi::uidl::Token & + CurToken() const; + UnoIDL_PE & CurEnv() const; + UnoIDL_PE & PushEnv() const; + uintt CurTokenPosition() const; + uintt CurEnv_TriedTokenPosition() const; + void DecrementTryCount(); + + EnvironmentStack aEnvironments; + TokenQueue aTokenQueue; + TokenIterator itCurToken; + TokenProcessing_Result + aCurResult; + uintt nTryCount; + bool bFinished; + ary::Repository & + rRepository; + ParserInfo & rParserInfo; + Documentation * pDocuProcessor; + bool bPublishedRecentlyOn; + }; + + class Documentation : public csi::dsapi::Token_Receiver + { + public: + Documentation( + ParserInfo & io_rParserInfo); + ~Documentation(); + + void Reset() { bIsPassedFirstDocu = false; } + + virtual void Receive( + DYN csi::dsapi::Token & + let_drToken ); + virtual void Increment_CurLine(); + DYN ary::doc::OldIdlDocu * + ReleaseLastParsedDocu() + { return pMostRecentDocu.Release(); } + private: + Dyn<csi::dsapi::SapiDocu_PE> + pDocuParseEnv; + ParserInfo & rParserInfo; + Dyn<ary::doc::OldIdlDocu> + pMostRecentDocu; + bool bIsPassedFirstDocu; + }; + + // DATA + TokenParser_Uidl * pTokenSource; + Documentation aDocumentation; + ProcessingData aProcessingData; +}; + + + +// IMPLEMENTATION + +inline void +TokenDistributor::SetTokenProvider( TokenParser_Uidl & io_rTokenSource ) + { pTokenSource = &io_rTokenSource; } + +inline void +TokenDistributor::SetTopParseEnvironment( UnoIDL_PE & io_pTopParseEnvironment ) + { aProcessingData.SetTopParseEnvironment(io_pTopParseEnvironment); } + +inline csi::uidl::Token_Receiver & +TokenDistributor::CodeTokens_Receiver() + { return aProcessingData; } + +inline csi::dsapi::Token_Receiver & +TokenDistributor::DocuTokens_Receiver() + { return aDocumentation; } + +inline const csi::uidl::Token & +TokenDistributor::ProcessingData::CurToken() const +{ + csv_assert( itCurToken != aTokenQueue.end() ); + csv_assert( *itCurToken != 0 ); + return *(*itCurToken); +} + +inline UnoIDL_PE & +TokenDistributor::ProcessingData::CurEnv() const +{ + csv_assert( aEnvironments.size() > 0 ); + csv_assert( aEnvironments.back().first != 0 ); + return *aEnvironments.back().first; +} + +inline UnoIDL_PE & +TokenDistributor::ProcessingData::PushEnv() const +{ + csv_assert( aCurResult.pEnv2Push != 0 ); + return *aCurResult.pEnv2Push; +} + +inline uintt +TokenDistributor::ProcessingData::CurTokenPosition() const +{ + return itCurToken - aTokenQueue.begin(); +} + +inline uintt +TokenDistributor::ProcessingData::CurEnv_TriedTokenPosition() const +{ + csv_assert( aEnvironments.size() > 0 ); + return aEnvironments.back().second; +} + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/parsenv2.hxx b/autodoc/source/parser_i/inc/s2_luidl/parsenv2.hxx new file mode 100644 index 000000000000..ab6bf849055c --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/parsenv2.hxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: parsenv2.hxx,v $ + * $Revision: 1.11 $ + * + * 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 LUIDL_PARSENV2_HXX +#define LUIDL_PARSENV2_HXX + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/tokproct.hxx> + // COMPONENTS +#include <s2_luidl/semnode.hxx> + // PARAMETERS +#include <ary/idl/i_types4idl.hxx> +#include <ary/idl/i_module.hxx> + + + +class ParserInfo; + +namespace ary +{ + class QualifiedName; + class Repository; + +namespace doc +{ + class OldIdlDocu; +} + +namespace idl +{ + class CodeEntity; +} +} + + + +namespace csi +{ +namespace uidl +{ + + +class Token; +class SemanticNode; + + +class UnoIDL_PE : virtual protected TokenProcessing_Types +{ + public: + virtual ~UnoIDL_PE(); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & + io_rRepository, + TokenProcessing_Result & + o_rResult ); +// virtual void EstablishContacts( +// UnoIDL_PE * io_pParentPE, +// ary::idl::Gate & +// io_rGate, +// TokenProcessing_Result & +// o_rResult ); + virtual void Enter( + E_EnvStackAction i_eWayOfEntering ); + virtual void Leave( + E_EnvStackAction i_eWayOfLeaving ); + virtual void ProcessToken( + const Token & i_rToken ) = 0; + + void SetDocu( + DYN ary::doc::OldIdlDocu * + let_dpDocu ); + void SetPublished(); + void SetOptional(); + void PassDocuAt( + ary::idl::CodeEntity & + io_rCe ); + + UnoIDL_PE * Parent() const { return aMyNode.Parent(); } + + void SetResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + UnoIDL_PE * i_pParseEnv2Push = 0 ) + { aMyNode.SetTokenResult( i_eDone, i_eWhat2DoWithEnvStack, i_pParseEnv2Push ); } + virtual const ary::idl::Module & + CurNamespace() const; + virtual const ParserInfo & + ParseInfo() const; + ary::idl::Gate & Gate() const { return aMyNode.AryGate(); } + TokenProcessing_Result & + TokenResult() const { return aMyNode.TokenResult(); } + DYN ary::doc::OldIdlDocu * + ReleaseDocu() { return pDocu.Release(); } + protected: + UnoIDL_PE(); + ary::Repository & MyRepository() { csv_assert(pRepository != 0); + return *pRepository; } + private: + virtual void InitData(); + virtual void TransferData() = 0; + virtual void ReceiveData(); + + SemanticNode aMyNode; + Dyn<ary::doc::OldIdlDocu> + pDocu; + ary::Repository * pRepository; +}; + + + + +} // namespace uidl +} // namespace csi +#endif diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_attri.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_attri.hxx new file mode 100644 index 000000000000..ede8f656afd4 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_attri.hxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_attri.hxx,v $ + * $Revision: 1.7 $ + * + * 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_UIDL_PE_ATTRI_HXX +#define ADC_UIDL_PE_ATTRI_HXX + + + +// USED SERVICES + // BASE CLASSES + +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS +#include <ary/idl/i_property.hxx> + // PARAMETERS +#include <ary/idl/i_gate.hxx> + + +namespace ary +{ + namespace idl + { + class Attribute; + } +} + +namespace csi +{ +namespace uidl +{ + + +class PE_Variable; +class PE_Type; + +class PE_Attribute : public UnoIDL_PE, + public ParseEnvState +{ + public: + typedef ary::idl::Ce_id Ce_id; + typedef ary::idl::Type_id Type_id; + + PE_Attribute( + const Ce_id & i_rCurOwner ); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & + io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual ~PE_Attribute(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Raises(); + virtual void Process_Default(); + + private: + enum E_State + { + e_none, + e_start, + in_variable, + expect_end, + in_raise_std, /// before 'get', 'set', ';' or '}' + in_get, + in_set + }; + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + E_State eState; + const Ce_id * pCurOwner; + + Dyn<PE_Variable> pPE_Variable; + Dyn<PE_Type> pPE_Exception; + + // object-data + ary::idl::Attribute * + pCurAttribute; + Type_id nCurParsedType; + String sCurParsedName; + bool bReadOnly; + bool bBound; +}; + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_const.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_const.hxx new file mode 100644 index 000000000000..9219191bd27c --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_const.hxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_const.hxx,v $ + * $Revision: 1.6 $ + * + * 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 LUIDL_PE_CONST_HXX +#define LUIDL_PE_CONST_HXX + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + + +namespace udm { +class Agent_Struct; +} // namespace udm + + +namespace csi +{ +namespace uidl +{ + +class ConstantsGroup; + +class PE_Type; +class PE_Value; + +class PE_Constant : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Constant(); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & + io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_Constant(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + + private: + enum E_State + { + e_none, + expect_name, + expect_curl_bracket_open, + expect_const, + expect_value, + expect_finish, + e_STATES_MAX + }; + enum E_TokenType + { + tt_stereotype, + tt_identifier, + tt_punctuation, + tt_MAX + }; + typedef void (PE_Constant::*F_TOK)(const char *); + + + void CallHandler( + const char * i_sTokenText, + E_TokenType i_eTokenType ); + + void On_expect_name_Identifier(const char * i_sText); + void On_expect_curl_bracket_open_Punctuation(const char * i_sText); + void On_expect_const_Stereotype(const char * i_sText); + void On_expect_const_Punctuation(const char * i_sText); + void On_expect_value_Identifier(const char * i_sText); + void On_expect_finish_Punctuation(const char * i_sText); + void On_Default(const char * ); + + void EmptySingleConstData(); + void CreateSingleConstant(); + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + static F_TOK aDispatcher[e_STATES_MAX][tt_MAX]; + + E_State eState; + + String sData_Name; + ary::idl::Ce_id nDataId; + + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nType; + + Dyn<PE_Value> pPE_Value; + String sName; + String sAssignment; +}; + + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_enum2.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_enum2.hxx new file mode 100644 index 000000000000..e27b157fd1d6 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_enum2.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_enum2.hxx,v $ + * $Revision: 1.5 $ + * + * 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_UIDL_PE_ENUM2_HXX +#define ADC_UIDL_PE_ENUM2_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + + + +namespace csi +{ +namespace uidl +{ + +// class Enum; + +class PE_Value; + +class PE_Enum : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Enum(); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_Enum(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + + private: + enum E_State + { + e_none, + expect_name, + expect_curl_bracket_open, + expect_value, + expect_finish, + e_STATES_MAX + }; + enum E_TokenType + { + tt_identifier, + tt_punctuation, + tt_MAX + }; + typedef void (PE_Enum::*F_TOK)(const char *); + + + void CallHandler( + const char * i_sTokenText, + E_TokenType i_eTokenType ); + + void On_expect_name_Identifier(const char * i_sText); + void On_expect_curl_bracket_open_Punctuation(const char * i_sText); + void On_expect_value_Punctuation(const char * i_sText); + void On_expect_value_Identifier(const char * i_sText); + void On_expect_finish_Punctuation(const char * i_sText); + void On_Default(const char * ); + + void EmptySingleValueData(); + void CreateSingleValue(); + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + static F_TOK aDispatcher[e_STATES_MAX][tt_MAX]; + + E_State eState; + + String sData_Name; + ary::idl::Ce_id nDataId; + + Dyn<PE_Value> pPE_Value; + String sName; + String sAssignment; +}; + + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_evalu.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_evalu.hxx new file mode 100644 index 000000000000..93a3d3f37991 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_evalu.hxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_evalu.hxx,v $ + * $Revision: 1.5 $ + * + * 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 LUIDL_PE_EVALU_HXX +#define LUIDL_PE_EVALU_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + + +namespace udm { +class Agent_Struct; +} // namespace udm + + +namespace csi +{ +namespace uidl +{ + +class PE_Value : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Value( + String & o_rName, + String & o_rAssignment, + bool i_bIsConst ); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & + io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_Value(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Assignment( + const TokAssignment & + i_rToken ); + private: + enum E_State + { + e_none = 0, + expect_name, + got_name, + e_STATES_MAX + }; + enum E_TokenType /// @ATTENTION Do not change existing values (except of tt_MAX) !!! Else array-indices will break. + { + tt_identifier = 0, + tt_punctuation = 1, + tt_assignment = 2, + tt_MAX + }; + typedef void (PE_Value::*F_TOK)(const char *); + + + void CallHandler( + const char * i_sTokenText, + E_TokenType i_eTokenType ); + + void On_expect_name_Identifier(const char * i_sText); + void On_got_name_Punctuation(const char * i_sText); + void On_got_name_Assignment(const char * i_sText); + void On_Default(const char * ); + + virtual void InitData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + bool IsConst() const { return bIsConst; } + + static F_TOK aDispatcher[e_STATES_MAX][tt_MAX]; + + E_State eState; + String * pName; + String * pAssignment; + bool bIsConst; +}; + + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_excp.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_excp.hxx new file mode 100644 index 000000000000..b9f89e3c831a --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_excp.hxx @@ -0,0 +1,262 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_excp.hxx,v $ + * $Revision: 1.6 $ + * + * 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 LUIDL_PE_EXCP_HXX +#define LUIDL_PE_EXCP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS +#include <s2_luidl/semnode.hxx> +#include <ary/qualiname.hxx> + // PARAMETERS + + + +namespace csi +{ +namespace prl +{ + class TNamespace; +} +} + + + +namespace csi +{ +namespace uidl +{ + + +class Exception; +class StructElement; +class PE_StructElement; +class PE_Type; + + +class PE_Exception : public UnoIDL_PE +{ + public: + PE_Exception(); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_Exception(); + virtual void ProcessToken( + const Token & i_rToken ); + + private: + struct S_Work + { + S_Work(); + + void InitData(); + void Prepare_PE_QualifiedName(); + void Prepare_PE_Element(); + void Data_Set_Name( + const char * i_sName ); + // DATA + String sData_Name; + bool bIsPreDeclaration; + ary::idl::Ce_id nCurStruct; + + Dyn<PE_StructElement> + pPE_Element; + ary::idl::Ce_id nCurParsed_ElementRef; + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nCurParsed_Base; + }; + + struct S_Stati; + class PE_StructState; + friend struct S_Stati; + friend class PE_StructState; + + + class PE_StructState : public ParseEnvState + { + public: + + protected: + PE_StructState( + PE_Exception & i_rStruct ) + : rStruct(i_rStruct) {} + void MoveState( + ParseEnvState & i_rState ) const; + void SetResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + UnoIDL_PE * i_pParseEnv2Push = 0 ) const + { rStruct.SetResult(i_eDone, i_eWhat2DoWithEnvStack, i_pParseEnv2Push); } + + S_Stati & Stati() const { return *rStruct.pStati; } + S_Work & Work() const { return rStruct.aWork; } + PE_Exception & PE() const { return rStruct; } + + private: + virtual UnoIDL_PE & MyPE(); + // DATA + PE_Exception & rStruct; + }; + + class State_None : public PE_StructState + { + public: + State_None( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + }; + class State_WaitForName : public PE_StructState + { // -> Name + public: + State_WaitForName( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + }; + class State_GotName : public PE_StructState + { // -> : { ; + public: + State_GotName( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + class State_WaitForBase : public PE_StructState + { // -> Base + public: + State_WaitForBase( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void On_SubPE_Left(); + }; + class State_GotBase : public PE_StructState + { // -> { + public: + State_GotBase( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + class State_WaitForElement : public PE_StructState + { // -> Typ } + public: + State_WaitForElement( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_NameSeparator(); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + virtual void Process_TypeModifier( + const TokTypeModifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); +// virtual void On_SubPE_Left(); + }; + class State_WaitForFinish : public PE_StructState + { // -> ; + public: + State_WaitForFinish( + PE_Exception & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + + struct S_Stati + { + S_Stati( + PE_Exception & io_rStruct ); + void SetState( + ParseEnvState & i_rNextState ) + { pCurStatus = &i_rNextState; } + + State_None aNone; + State_WaitForName aWaitForName; + State_GotName aGotName; + State_WaitForBase aWaitForBase; + State_GotBase aGotBase; + State_WaitForElement + aWaitForElement; + State_WaitForFinish aWaitForFinish; + + ParseEnvState * pCurStatus; + }; + + virtual void InitData(); + virtual void TransferData(); + virtual void ReceiveData(); + + public: + + void store_Exception(); + + private: + + S_Stati & Stati() { return *pStati; } + S_Work & Work() { return aWork; } + + // DATA + S_Work aWork; + Dyn<S_Stati> pStati; +}; + + +inline void +PE_Exception::PE_StructState::MoveState( + ParseEnvState & i_rState ) const + { rStruct.Stati().SetState(i_rState); } + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_file2.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_file2.hxx new file mode 100644 index 000000000000..be493eb4ea31 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_file2.hxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_file2.hxx,v $ + * $Revision: 1.7 $ + * + * 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 LUIDL_PE_FILE2_HXX +#define LUIDL_PE_FILE2_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + + +namespace ary +{ +namespace idl +{ +class Module; +} // namespace idl +} // namespace ary + + +namespace csi +{ +namespace uidl +{ + +class TokenDistributor; +class PE_Service; +class PE_Singleton; +class PE_Interface; +class PE_Struct; +class PE_Exception; +class PE_Constant; +class PE_Enum; +class PE_Typedef; + + +class PE_File : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_File( + TokenDistributor & i_rTokenAdmin, + const ParserInfo & i_parseInfo ); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_File(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_Default(); + + private: + enum E_State + { + e_none, + e_std, + wait_for_module, + wait_for_module_bracket, + wait_for_module_semicolon, + in_sub_pe, + on_default + }; + + virtual void InitData(); + virtual void TransferData(); + virtual void ReceiveData(); + virtual UnoIDL_PE & MyPE(); + virtual const ary::idl::Module & + CurNamespace() const; + virtual const ParserInfo & + ParseInfo() const; + // DATA + TokenDistributor * pTokenAdmin; + Dyn<PE_Service> pPE_Service; + Dyn<PE_Singleton> pPE_Singleton; + Dyn<PE_Interface> pPE_Interface; + Dyn<PE_Struct> pPE_Struct; + Dyn<PE_Exception> pPE_Exception; + Dyn<PE_Constant> pPE_Constant; + Dyn<PE_Enum> pPE_Enum; + Dyn<PE_Typedef> pPE_Typedef; + + const ary::idl::Module * + pCurNamespace; + const ParserInfo * pParseInfo; + + E_State eState; + uintt nBracketCount_inDefMode; +}; + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_func2.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_func2.hxx new file mode 100644 index 000000000000..7adbe8efc7a0 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_func2.hxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_func2.hxx,v $ + * $Revision: 1.6 $ + * + * 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_UIDL_PE_FUNC2_HXX +#define ADC_UIDL_PE_FUNC2_HXX + + + +// USED SERVICES + // BASE CLASSES +// #include <ary/idl/i_gate.hxx> +// #include <ary/idl/ip_ce.hxx> +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS +#include <ary/idl/i_param.hxx> + // PARAMETERS + +namespace ary +{ + namespace idl + { + class Function; + } +} + + +namespace csi +{ +namespace uidl +{ + +class PE_Type; +class PE_Variable; + +class PE_Function : public UnoIDL_PE, + public ParseEnvState +{ + public: + typedef ary::idl::Ce_id RParent; + typedef ary::idl::Ce_id RFunction; + + enum E_Constructor { constructor }; + + /// Constructor for interfaces. + PE_Function( + const RParent & i_rCurInterface ); + + /// Constructor for single interface based services. + PE_Function( + const RParent & i_rCurService, + E_Constructor i_eCtorMarker ); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual ~PE_Function(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + virtual void Process_ParameterHandling( + const TokParameterHandling & + i_rToken ); + virtual void Process_Raises(); + virtual void Process_Default(); + + private: + enum E_State + { + e_none, + e_start, + in_return_type, + expect_name, + expect_params_list, + expect_parameter, + expect_parameter_variable, + in_parameter_variable, + expect_parameter_separator, + params_finished, + expect_exceptions_list, + expect_exception, + in_exception, + expect_exception_separator, + exceptions_finished + }; + + void GoIntoReturnType(); + void GoIntoParameterVariable(); + void GoIntoException(); + void OnDefault(); + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + E_State eState; + + String sData_Name; + ary::idl::Type_id nData_ReturnType; + bool bData_Oneway; + ary::idl::Function * + pCurFunction; + + const RParent * pCurParent; + + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nCurParsedType; // ReturnType or Exception + + String sName; + + Dyn<PE_Variable> pPE_Variable; + ary::idl::E_ParameterDirection + eCurParsedParam_Direction; + ary::idl::Type_id nCurParsedParam_Type; + String sCurParsedParam_Name; + bool bIsForConstructors; +}; + + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_iface.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_iface.hxx new file mode 100644 index 000000000000..296ea875b27b --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_iface.hxx @@ -0,0 +1,187 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_iface.hxx,v $ + * $Revision: 1.7 $ + * + * 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_UIDL_PE_IFACE_HXX +#define ADC_UIDL_PE_IFACE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ +namespace idl +{ + class Interface; +} +} + +namespace csi +{ +namespace uidl +{ + + + +class PE_Function; +class PE_Attribute; +class PE_Type; + +class PE_Interface : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Interface(); + virtual ~PE_Interface(); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_NameSeparator(); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + virtual void Process_TypeModifier( + const TokTypeModifier & + i_rToken ); + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_Default(); + + private: + enum E_State /// @ATTENTION Do not change existing values (except of e_STATES_MAX) !!! Else array-indices will break. + { + e_none = 0, + need_uik, + uik, + need_ident, + ident, + need_interface, + need_name, + wait_for_base, + in_base, // in header, after ":" + need_curlbr_open, + e_std, + in_function, + in_attribute, + need_finish, + in_base_interface, // in body, after "interface" + e_STATES_MAX + }; + enum E_TokenType /// @ATTENTION Do not change existing values (except of tt_MAX) !!! Else array-indices will break. + { + tt_metatype = 0, + tt_identifier = 1, + tt_punctuation = 2, + tt_startoftype = 3, + tt_stereotype = 4, + tt_MAX + }; + typedef void (PE_Interface::*F_TOK)(const char *); + + + void On_need_uik_MetaType(const char * i_sText); + void On_uik_Identifier(const char * i_sText); + void On_uik_Punctuation(const char * i_sText); + void On_need_ident_MetaType(const char * i_sText); + void On_ident_Identifier(const char * i_sText); + void On_ident_Punctuation(const char * i_sText); + void On_need_interface_MetaType(const char * i_sText); + void On_need_name_Identifer(const char * i_sText); + void On_wait_for_base_Punctuation(const char * i_sText); + void On_need_curlbr_open_Punctuation(const char * i_sText); + void On_std_Metatype(const char * i_sText); + void On_std_Punctuation(const char * i_sText); + void On_std_Stereotype(const char * i_sText); + void On_std_GotoFunction(const char * i_sText); + void On_std_GotoAttribute(const char * i_sText); + void On_std_GotoBaseInterface(const char * i_sText); + void On_need_finish_Punctuation(const char * i_sText); + void On_Default(const char * i_sText); + + void CallHandler( + const char * i_sTokenText, + E_TokenType i_eTokenType ); + + virtual void InitData(); + virtual void TransferData(); + virtual void ReceiveData(); + virtual UnoIDL_PE & MyPE(); + + void store_Interface(); + + // DATA + static F_TOK aDispatcher[e_STATES_MAX][tt_MAX]; + + E_State eState; + String sData_Name; + bool bIsPreDeclaration; + ary::idl::Interface * + pCurInterface; + ary::idl::Ce_id nCurInterface; + + Dyn<PE_Function> pPE_Function; + Dyn<PE_Attribute> pPE_Attribute; + + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nCurParsed_Base; + bool bOptionalMember; +}; + + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_modul.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_modul.hxx new file mode 100644 index 000000000000..4da9b6e3958b --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_modul.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_modul.hxx,v $ + * $Revision: 1.3 $ + * + * 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 LUIDL_PE_MODUL_HXX +#define LUIDL_PE_MODUL_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <semantic/semnode.hxx> + // COMPONENTS + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + + +class PE_Module : public ::ParseEnvironment +{ + public: + + virtual void Enter( + E_EnvStackAction i_eWayOfEntering ); + virtual void Leave( + E_EnvStackAction i_eWayOfLeaving ); + + private: +}; + + +} // namespace uidl +} // namespace csi + + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_property.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_property.hxx new file mode 100644 index 000000000000..5d5c1ab37e02 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_property.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_property.hxx,v $ + * $Revision: 1.5 $ + * + * 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_UIDL_PE_PROPERTY_HXX +#define ADC_UIDL_PE_PROPERTY_HXX + + + +// USED SERVICES + // BASE CLASSES + +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS +#include <ary/idl/i_property.hxx> + // PARAMETERS +#include <ary/idl/i_gate.hxx> + + +namespace csi +{ +namespace uidl +{ + + +class PE_Variable; + +class PE_Property : public UnoIDL_PE, + public ParseEnvState +{ + public: + typedef ary::idl::Ce_id Ce_id; + typedef ary::idl::Type_id Type_id; + typedef ary::idl::Property::Stereotypes Stereotypes; + + + PE_Property( + const Ce_id & i_rCurOwner ); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & + io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual ~PE_Property(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Default(); + + void PresetOptional() { bIsOptional = true; } + void PresetStereotypes( + Stereotypes::E_Flags + i_eFlag ) + { aStereotypes.Set_Flag(i_eFlag); } + private: + enum E_State + { + e_none, + e_start, + expect_variable, + in_variable + }; + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + E_State eState; + const Ce_id * pCurOwner; + + Dyn<PE_Variable> pPE_Variable; + + // object-data + Type_id nCurParsedType; + String sCurParsedName; + bool bIsOptional; + Stereotypes aStereotypes; +}; + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_selem.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_selem.hxx new file mode 100644 index 000000000000..19194a44da59 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_selem.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_selem.hxx,v $ + * $Revision: 1.6 $ + * + * 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 LUIDL_PE_SELEM_HXX +#define LUIDL_PE_SELEM_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_gate.hxx> + + +namespace udm { +class Agent_Struct; +} // namespace udm + + +namespace csi +{ +namespace uidl +{ + +class PE_Type; +class StructElement; +class Struct; + +class PE_StructElement : public UnoIDL_PE, + public ParseEnvState +{ + public: + typedef ary::idl::Ce_id RStructElement; + typedef ary::idl::Ce_id RStruct; + + PE_StructElement( /// Use for Struct-elements + RStructElement & o_rResult, + const RStruct & i_rCurStruct, + const String & i_rCurStructTemplateParam ); + PE_StructElement( /// Use for Exception-elements + RStructElement & o_rResult, + const RStruct & i_rCurExc ); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_StructElement(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Default(); + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + + private: + enum E_State + { + e_none, + expect_type, + expect_name, + expect_finish + }; + + virtual void InitData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + ary::idl::Type_id lhf_FindTemplateParamType() const; + + // DATA + E_State eState; + RStructElement * pResult; + const RStruct * pCurStruct; + bool bIsExceptionElement; + + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nType; + String sName; + const String * pCurStructTemplateParam; +}; + + + +} // namespace uidl +} // namespace csi + + +#endif diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_servi.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_servi.hxx new file mode 100644 index 000000000000..92e40b4e1bc6 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_servi.hxx @@ -0,0 +1,152 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_servi.hxx,v $ + * $Revision: 1.6 $ + * + * 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_UIDL_PE_SERVI_HXX +#define ADC_UIDL_PE_SERVI_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ + namespace idl + { + class Service; + class SglIfcService; + } +} + +namespace csi +{ +namespace uidl +{ + +class PE_Property; +class PE_Type; +class PE_Function; + + +class PE_Service : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Service(); + virtual ~PE_Service(); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_Needs(); + virtual void Process_Observes(); + virtual void Process_Default(); + + private: + void On_Default(); + + enum E_State + { + e_none = 0, + need_name, + need_curlbr_open, + e_std, + in_property, + in_ifc_type, + in_service_type, + expect_ifc_separator, + expect_service_separator, + at_ignore, + need_finish, + need_base_interface, /// After ":". + need_curlbr_open_sib, /// After base interface in single interface based service. + e_std_sib, /// Standard in single interface based service. + e_STATES_MAX + }; + + virtual void InitData(); + virtual void TransferData(); + virtual void ReceiveData(); + virtual UnoIDL_PE & MyPE(); + + void StartProperty(); + + + // DATA + E_State eState; + String sData_Name; + bool bIsPreDeclaration; + ary::idl::Service * pCurService; + ary::idl::SglIfcService * + pCurSiService; + ary::idl::Ce_id nCurService; // Needed for PE_Attribute. + + Dyn<PE_Property> pPE_Property; + ary::idl::Ce_id nCurParsed_Property; + + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nCurParsed_Type; + + Dyn<PE_Function> pPE_Constructor; + + bool bOptionalMember; +}; + + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_singl.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_singl.hxx new file mode 100644 index 000000000000..ec3214e77fd0 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_singl.hxx @@ -0,0 +1,153 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_singl.hxx,v $ + * $Revision: 1.5 $ + * + * 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 LUIDL_PE_SINGL_HXX +#define LUIDL_PE_SINGL_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ + namespace idl + { + class Singleton; + class SglIfcSingleton; + } +} + + +namespace csi +{ +namespace uidl +{ + +class PE_Type; + + +class PE_Singleton : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Singleton(); + virtual ~PE_Singleton(); + + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Default(); + + private: + enum E_State + { + e_none = 0, + need_name, + need_curlbr_open, + e_std, + in_service, + need_finish, + in_base_interface, + e_STATES_MAX + }; + + +#if 0 + enum E_TokenType /// @ATTENTION Do not change existing values (except of tt_MAX) !!! Else array-indices will break. + { + tt_metatype = 0, + tt_identifier = 1, + tt_punctuation = 2, + tt_startoftype = 3, + tt_MAX + }; + typedef void (PE_Singleton::*F_TOK)(const char *); + + + void On_need_singleton_MetaType(const char * i_sText); + void On_need_name_Identifer(const char * i_sText); + void On_need_curlbr_open_Punctuation(const char * i_sText); + void On_std_GotoService(const char * i_sText); + void On_std_Punctuation(const char * i_sText); + void On_need_finish_Punctuation(const char * i_sText); + + void CallHandler( + const char * i_sTokenText, + E_TokenType i_eTokenType ); +#endif // 0 + + void On_Default(); + + virtual void InitData(); + virtual void TransferData(); + virtual void ReceiveData(); + virtual UnoIDL_PE & MyPE(); + + // DATA +// static F_TOK aDispatcher[e_STATES_MAX][tt_MAX]; + + E_State eState; + String sData_Name; + bool bIsPreDeclaration; + ary::idl::Singleton * + pCurSingleton; + ary::idl::SglIfcSingleton * + pCurSiSingleton; + + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nCurParsed_Type; +}; + + +} // namespace uidl +} // namespace csi + + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_struc.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_struc.hxx new file mode 100644 index 000000000000..e362f45562ea --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_struc.hxx @@ -0,0 +1,288 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_struc.hxx,v $ + * $Revision: 1.7 $ + * + * 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 LUIDL_PE_STRUC_HXX +#define LUIDL_PE_STRUC_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS +#include <s2_luidl/semnode.hxx> +#include <ary/qualiname.hxx> + // PARAMETERS + + + +namespace csi +{ +namespace prl +{ + class TNamespace; +} +} + + + +namespace csi +{ +namespace uidl +{ + + +class Struct; +class StructElement; +class PE_StructElement; +class PE_Type; + + +class PE_Struct : public UnoIDL_PE +{ + public: + PE_Struct(); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_Struct(); + virtual void ProcessToken( + const Token & i_rToken ); + + private: + struct S_Work + { + S_Work(); + + void InitData(); + void Prepare_PE_QualifiedName(); + void Prepare_PE_Element(); + void Data_Set_Name( + const char * i_sName ); + void Data_Set_TemplateParam( + const char * i_sTemplateParam ); + + String sData_Name; + String sData_TemplateParam; + bool bIsPreDeclaration; + ary::idl::Ce_id nCurStruct; + + Dyn<PE_StructElement> + pPE_Element; + ary::idl::Ce_id nCurParsed_ElementRef; + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nCurParsed_Base; + }; + + struct S_Stati; + class PE_StructState; + friend struct S_Stati; + friend class PE_StructState; + + + class PE_StructState : public ParseEnvState + { + public: + + protected: + PE_StructState( + PE_Struct & i_rStruct ) + : rStruct(i_rStruct) {} + void MoveState( + ParseEnvState & i_rState ) const; + void SetResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + UnoIDL_PE * i_pParseEnv2Push = 0 ) const + { rStruct.SetResult(i_eDone, i_eWhat2DoWithEnvStack, i_pParseEnv2Push); } + + S_Stati & Stati() const { return *rStruct.pStati; } + S_Work & Work() const { return rStruct.aWork; } + PE_Struct & PE() const { return rStruct; } + + private: + virtual UnoIDL_PE & MyPE(); + // DATA + PE_Struct & rStruct; + }; + + class State_None : public PE_StructState + { + public: + State_None( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + }; + class State_WaitForName : public PE_StructState + { // -> Name + public: + State_WaitForName( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + }; + class State_GotName : public PE_StructState + { // -> : { ; < + public: + State_GotName( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + class State_WaitForTemplateParam : public PE_StructState + { // -> Template parameter identifier + public: + State_WaitForTemplateParam( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + }; + class State_WaitForTemplateEnd : public PE_StructState + { // -> > + public: + State_WaitForTemplateEnd( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + class State_WaitForBase : public PE_StructState + { // -> Base + public: + State_WaitForBase( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void On_SubPE_Left(); + }; + class State_GotBase : public PE_StructState + { // -> { + public: + State_GotBase( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + class State_WaitForElement : public PE_StructState + { // -> Typ } + public: + State_WaitForElement( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_NameSeparator(); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + virtual void Process_TypeModifier( + const TokTypeModifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + class State_WaitForFinish : public PE_StructState + { // -> ; + public: + State_WaitForFinish( + PE_Struct & i_rStruct ) + : PE_StructState(i_rStruct) {} + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + }; + + struct S_Stati + { + S_Stati( + PE_Struct & io_rStruct ); + void SetState( + ParseEnvState & i_rNextState ) + { pCurStatus = &i_rNextState; } + + State_None aNone; + State_WaitForName aWaitForName; + State_GotName aGotName; + State_WaitForTemplateParam + aWaitForTemplateParam; + State_WaitForTemplateEnd + aWaitForTemplateEnd; + State_WaitForBase aWaitForBase; + State_GotBase aGotBase; + State_WaitForElement + aWaitForElement; + State_WaitForFinish aWaitForFinish; + + ParseEnvState * pCurStatus; + }; + + virtual void InitData(); + virtual void TransferData(); + virtual void ReceiveData(); + + public: + + void store_Struct(); + + private: + + S_Stati & Stati() { return *pStati; } + S_Work & Work() { return aWork; } + + // DATA + S_Work aWork; + Dyn<S_Stati> pStati; +}; + + +inline void +PE_Struct::PE_StructState::MoveState( + ParseEnvState & i_rState ) const + { rStruct.Stati().SetState(i_rState); } + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_tydf2.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_tydf2.hxx new file mode 100644 index 000000000000..ee5fb69c26cf --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_tydf2.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_tydf2.hxx,v $ + * $Revision: 1.5 $ + * + * 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 LUIDL_PE_TYDF2_HXX +#define LUIDL_PE_TYDF2_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + + + + +namespace csi +{ +namespace uidl +{ + +class PE_Type; + + +class PE_Typedef : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Typedef(); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~PE_Typedef(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_Default(); + + private: + enum E_State + { + e_none = 0, + expect_description, + expect_name, + got_name, + e_STATES_MAX + }; + enum E_TokenType /// @ATTENTION Do not change existing values (except of tt_MAX) !!! Else array-indices will break. + { + tt_any = 0, + tt_identifier, + tt_punctuation, + tt_MAX + }; + typedef void (PE_Typedef::*F_TOK)(const char *); + + + void CallHandler( + const char * i_sTokenText, + E_TokenType i_eTokenType ); + + void On_expect_description_Any(const char * i_sText); + void On_expect_name_Identifier(const char * i_sText); + void On_got_name_Punctuation(const char * i_sText); + void On_Default(const char * ); + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + static F_TOK aDispatcher[e_STATES_MAX][tt_MAX]; + + E_State eState; + Dyn<PE_Type> pPE_Type; + ary::idl::Type_id nType; + String sName; +}; + + + +} // namespace uidl +} // namespace csi + + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_type2.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_type2.hxx new file mode 100644 index 000000000000..4880395ea979 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_type2.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_type2.hxx,v $ + * $Revision: 1.5 $ + * + * 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_PE_TYPE2_HXX +#define ADC_PE_TYPE2_HXX + + + +// USED SERVICES + // BASE CLASSES +#include<s2_luidl/parsenv2.hxx> +#include<s2_luidl/pestate.hxx> + // COMPONENTS +#include<ary/qualiname.hxx> + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + +class PE_Type : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Type( + ary::idl::Type_id & o_rResult ); + virtual ~PE_Type(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_NameSeparator(); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + virtual void Process_TypeModifier( + const TokTypeModifier & + i_rToken ); + virtual void Process_Default(); + + private: + enum E_State + { + e_none = 0, + expect_type, + expect_quname_part, + expect_quname_separator, + in_template_type + }; + + void Finish(); + PE_Type & MyTemplateType(); + + virtual void InitData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + ary::idl::Type_id * pResult; + + uintt nIsSequenceCounter; + uintt nSequenceDownCounter; + bool bIsUnsigned; + ary::QualifiedName sFullType; + + E_State eState; + String sLastPart; + + Dyn<PE_Type> pPE_TemplateType; /// @attention Recursion, only initiate, if needed! + ary::idl::Type_id nTemplateType; + std::vector<ary::idl::Type_id> + aTemplateParameters; +}; + + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + +#endif diff --git a/autodoc/source/parser_i/inc/s2_luidl/pe_vari2.hxx b/autodoc/source/parser_i/inc/s2_luidl/pe_vari2.hxx new file mode 100644 index 000000000000..936b027920dc --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pe_vari2.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pe_vari2.hxx,v $ + * $Revision: 1.6 $ + * + * 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_UIDL_PE_VARI2_HXX +#define ADC_UIDL_PE_VARI2_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/parsenv2.hxx> +#include <s2_luidl/pestate.hxx> + // COMPONENTS + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + +class PE_Type; + + +class PE_Variable : public UnoIDL_PE, + public ParseEnvState +{ + public: + PE_Variable( + ary::idl::Type_id & i_rResult_Type, + String & i_rResult_Name ); + virtual void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::Repository & + io_rRepository, + TokenProcessing_Result & + o_rResult ); + virtual ~PE_Variable(); + + virtual void ProcessToken( + const Token & i_rToken ); + + virtual void Process_Default(); + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + private: + enum E_State + { + e_none, + expect_type, + expect_name, + expect_finish + }; + + virtual void InitData(); + virtual void ReceiveData(); + virtual void TransferData(); + virtual UnoIDL_PE & MyPE(); + + // DATA + E_State eState; + ary::idl::Type_id * pResult_Type; + String * pResult_Name; + + Dyn<PE_Type> pPE_Type; +}; + + + +} // namespace uidl +} // namespace csi + + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/pestate.hxx b/autodoc/source/parser_i/inc/s2_luidl/pestate.hxx new file mode 100644 index 000000000000..ab7f4af16ed8 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/pestate.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pestate.hxx,v $ + * $Revision: 1.3 $ + * + * 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_PESTATE_HXX +#define ADC_PESTATE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include<s2_luidl/tokintpr.hxx> +#include<s2_luidl/tokproct.hxx> + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace uidl +{ + + +class TokIdentifier; +class TokBuiltInType; +class TokPunctuation; +class Tok_Documentation; + +class ParseEnvState : public TokenInterpreter, + virtual protected TokenProcessing_Types +{ + public: + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ); + virtual void Process_NameSeparator(); + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ); + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ); + virtual void Process_TypeModifier( + const TokTypeModifier & + i_rToken ); + virtual void Process_MetaType( + const TokMetaType & i_rToken ); + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ); + virtual void Process_ParameterHandling( + const TokParameterHandling & + i_rToken ); + virtual void Process_Raises(); + virtual void Process_Needs(); + virtual void Process_Observes(); + virtual void Process_Assignment( + const TokAssignment & + i_rToken ); + virtual void Process_EOL(); + + virtual void On_SubPE_Left(); + + virtual void Process_Default(); + + protected: + ParseEnvState() : bDefaultIsError(true) {} + void SetDefault2Ignore() { bDefaultIsError = false; } + + private: + virtual UnoIDL_PE & MyPE() = 0; + bool bDefaultIsError; +}; + + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/semnode.hxx b/autodoc/source/parser_i/inc/s2_luidl/semnode.hxx new file mode 100644 index 000000000000..b9dee36f1da5 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/semnode.hxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: semnode.hxx,v $ + * $Revision: 1.6 $ + * + * 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_SEMNODE_HXX +#define ADC_SEMNODE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/tokproct.hxx> + // COMPONENTS + // PARAMETERS +#include <ary/qualiname.hxx> +// #include <udm/ref.hxx> + + +namespace ary +{ + class QualifiedName; + class Repository; + +namespace idl +{ + class Gate; + class Module; +} // namespace idl +} // namespace ary + + +namespace csi +{ +namespace uidl +{ + + +class Struct; +class Token; + + +/** is an implementation class for UnoIDL_PE s +*/ +class SemanticNode : private TokenProcessing_Types +{ + public: + SemanticNode(); + void EstablishContacts( + UnoIDL_PE * io_pParentPE, + ary::idl::Gate & io_rRepository, + TokenProcessing_Result & + o_rResult ); + ~SemanticNode(); + + void SetTokenResult( + E_TokenDone i_eDone, + E_EnvStackAction i_eWhat2DoWithEnvStack, + UnoIDL_PE * i_pParseEnv2Push = 0 ); + UnoIDL_PE * Parent() const { return pParentPE; } + ary::idl::Gate & AryGate() const { return *pAryGate; } + TokenProcessing_Result & + TokenResult() const { return *pTokenResult; } + + private: + // DATA + UnoIDL_PE * pParentPE; + ary::idl::Gate * pAryGate; + TokenProcessing_Result * + pTokenResult; +}; + + +/* +class Trying_PE +{ + public: + virtual ~Trying_PE() {} + + protected: + Trying_PE(); + + virtual void ProcessToken( + const Token & i_rToken ); + + void StartTry( + UnoIDL_PE & i_rFirstTry ); + void Add2Try( + UnoIDL_PE & i_rTry ); + bool AmITrying() const; + UnoIDL_PE * NextTry() const; + void FinishTry(); + + private: + std::vector<UnoIDL_PE*> + aTryableSubEnvironments; + uintt nTryCounter; +}; + +*/ + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/smp_uidl.hxx b/autodoc/source/parser_i/inc/s2_luidl/smp_uidl.hxx new file mode 100644 index 000000000000..4e242b5b4806 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/smp_uidl.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: smp_uidl.hxx,v $ + * $Revision: 1.3 $ + * + * 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_SMP_HXX +#define ADC_SMP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/tok_recv.hxx> +#include <s2_dsapi/tok_recv.hxx> + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace uidl +{ + + + +/** is an implementation class for ParseEnvironment +*/ +class SemanticParser : public csi::uidl::Token_Receiver, + public csi::dsapi::Token_Receiver +{ + public: + typedef std::deque< DYN TextToken * > TokenQueue; + + ~SemanticParser(); + + + void Receive( + DYN csi::uidl::Token & + let_drToken ); + void Receive( + DYN csi::dsapi::Token & + let_drToken ); + + private: + // DATA + TokenQueue aTokenQueue; + + +}; + + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + +#endif + + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tk_const.hxx b/autodoc/source/parser_i/inc/s2_luidl/tk_const.hxx new file mode 100644 index 000000000000..364aa1de8ea2 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tk_const.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_const.hxx,v $ + * $Revision: 1.4 $ + * + * 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_UIDL_TK_CONST_HXX +#define ADC_UIDL_TK_CONST_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/uidl_tok.hxx> + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace uidl +{ + + +class TokAssignment : public Token +{ + public: + TokAssignment( + const char * i_sText ) + : sText(i_sText) {} + + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; + private: + // DATA + String sText; +}; + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tk_ident.hxx b/autodoc/source/parser_i/inc/s2_luidl/tk_ident.hxx new file mode 100644 index 000000000000..5a38faf1b106 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tk_ident.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_ident.hxx,v $ + * $Revision: 1.4 $ + * + * 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_UIDL_TK_IDENT_HXX +#define ADC_UIDL_TK_IDENT_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/uidl_tok.hxx> + // COMPONENTS + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + +class TokIdentifier : public Token +{ + public: + TokIdentifier( + const char * i_sText ) + : sText(i_sText) {} + + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; + private: + // DATA + String sText; +}; + +class TokNameSeparator : public Token +{ + public: + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; +}; + + +} // namespace uidl +} // namespace csi + +#endif + + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tk_keyw.hxx b/autodoc/source/parser_i/inc/s2_luidl/tk_keyw.hxx new file mode 100644 index 000000000000..0cedd0ab5027 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tk_keyw.hxx @@ -0,0 +1,254 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_keyw.hxx,v $ + * $Revision: 1.7 $ + * + * 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_UIDL_TK_KEYW_HXX +#define ADC_UIDL_TK_KEYW_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/uidl_tok.hxx> + // COMPONENTS +#include <luxenum.hxx> + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + +class TokKeyword : public Token +{ +}; + + +class TokBuiltInType : public TokKeyword +{ + public: + enum E_TokenId + { + e_none = 0, + bty_any = 1, + bty_boolean = 2, + bty_byte = 3, + bty_char = 4, + bty_double = 5, + bty_hyper = 6, + bty_long = 7, + bty_short = 8, + bty_string = 9, + bty_void = 10, + bty_ellipse = 11 + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + TokBuiltInType( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + + +class TokTypeModifier : public TokKeyword +{ + public: + enum E_TokenId + { + e_none = 0, + tmod_unsigned = 1, + tmod_sequence + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + TokTypeModifier( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + +class TokMetaType : public TokKeyword +{ + public: + enum E_TokenId + { + e_none = 0, + mt_attribute = 1, + mt_constants, + mt_enum, + mt_exception, + mt_ident, + mt_interface, + mt_module, + mt_property, + mt_service, + mt_singleton, + mt_struct, + mt_typedef, + mt_uik + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + TokMetaType( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; + E_TokenId Id() const { return eTag; } + + + private: + // DATA + EV_TokenId eTag; +}; + +class TokStereotype : public TokKeyword +{ + public: + // TYPES + enum E_TokenId + { + e_none = 0, + ste_bound = 1, + ste_const, + ste_constrained, + ste_maybeambiguous, + ste_maybedefault, + ste_maybevoid, + ste_oneway, + ste_optional, + ste_readonly, + ste_removable, + ste_virtual, + ste_transient, + ste_published + }; + + typedef lux::Enum<E_TokenId> EV_TokenId; + + TokStereotype( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char * + Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + +class TokParameterHandling : public TokKeyword +{ + public: + // TYPES + enum E_TokenId + { + e_none = 0, + ph_in, + ph_out, + ph_inout + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + TokParameterHandling( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char * + Text() const; + E_TokenId Id() const { return eTag; } + + private: + // DATA + EV_TokenId eTag; +}; + +class TokRaises : public TokKeyword +{ + public: + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; +}; + +class TokNeeds : public TokKeyword +{ + public: + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; +}; + +class TokObserves : public TokKeyword +{ + public: + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + virtual const char * + Text() const; +}; + + +} // namespace uidl +} // namespace csi + +#endif + + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tk_punct.hxx b/autodoc/source/parser_i/inc/s2_luidl/tk_punct.hxx new file mode 100644 index 000000000000..8e72a10fbc4a --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tk_punct.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tk_punct.hxx,v $ + * $Revision: 1.5 $ + * + * 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_UIDL_TK_PUNCT_HXX +#define ADC_UIDL_TK_PUNCT_HXX + +// USED SERVICES + // BASE CLASSES +#include <s2_luidl/uidl_tok.hxx> + // COMPONENTS +#include <luxenum.hxx> + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + +class TokPunctuation : public Token +{ + public: + // TYPES + enum E_TokenId + { + e_none = 0, + BracketOpen = 1, // ( + BracketClose = 2, // ) + ArrayBracketOpen = 3, // [ + ArrayBracketClose = 4, // ] + CurledBracketOpen = 5, // { + CurledBracketClose = 6, // } + Semicolon = 7, // ; + Colon = 8, // : + DoubleColon = 9, // :: + Comma = 10, // , + Minus = 11, // - + Fullstop = 12, // . + Lesser = 13, // < + Greater = 14 // > + }; + typedef lux::Enum<E_TokenId> EV_TokenId; + + + TokPunctuation( + EV_TokenId i_eTag ) + : eTag(i_eTag) {} + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char * + Text() const; + EV_TokenId Id() const { return eTag; } + + + private: + // DATA + EV_TokenId eTag; +}; + +class Tok_EOL : public Token +{ + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char * + Text() const; +}; + +class Tok_EOF : public Token +{ + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const; + // INQUIRY + virtual const char * + Text() const; +}; + + +} // namespace uidl +} // namespace csi + +#endif + + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tkp_uidl.hxx b/autodoc/source/parser_i/inc/s2_luidl/tkp_uidl.hxx new file mode 100644 index 000000000000..2dadc4ee3ad7 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tkp_uidl.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkp_uidl.hxx,v $ + * $Revision: 1.3 $ + * + * 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_UIDL_HXX +#define ADC_TKP_UIDL_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/tkp2.hxx> + // COMPONENTS + // PARAMETRS + +class TkpDocuContext; + + +namespace csi +{ +namespace uidl +{ + + + +class Token_Receiver; +class Context_UidlCode; + + +/** This is a TokenParser which is able to parse tokens from + C++ source code. +*/ +class TokenParser_Uidl : public TokenParse2 +{ + public: + // LIFECYCLE + TokenParser_Uidl( + Token_Receiver & o_rUidlReceiver, + DYN TkpDocuContext & + let_drDocuContext ); + virtual ~TokenParser_Uidl(); + + // OPERATIONS + private: + virtual ::TkpContext & + CurrentContext(); + + virtual void SetStartContext(); + virtual void SetCurrentContext( + TkpContext & io_rContext ); + // DATA + Dyn<Context_UidlCode> + pBaseContext; + ::TkpContext * pCurContext; +}; + + +} // namespace uidl +} // namespace csi + +#endif + + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tokintpr.hxx b/autodoc/source/parser_i/inc/s2_luidl/tokintpr.hxx new file mode 100644 index 000000000000..2aa310c3dc64 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tokintpr.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokintpr.hxx,v $ + * $Revision: 1.4 $ + * + * 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_LUIDL_TOKINTPR_HXX +#define ADC_LUIDL_TOKINTPR_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace uidl +{ + + +class TokIdentifier; +class TokPunctuation; +class TokBuiltInType; +class TokTypeModifier; +class TokMetaType; +class TokStereotype; +class TokParameterHandling; +class TokAssignment; +class Tok_Documentation; + + +class TokenInterpreter +{ + public: + virtual ~TokenInterpreter() {} + + virtual void Process_Identifier( + const TokIdentifier & + i_rToken ) = 0; + virtual void Process_NameSeparator() = 0; // :: + virtual void Process_Punctuation( + const TokPunctuation & + i_rToken ) = 0; + virtual void Process_BuiltInType( + const TokBuiltInType & + i_rToken ) = 0; + virtual void Process_TypeModifier( + const TokTypeModifier & + i_rToken ) = 0; + virtual void Process_MetaType( + const TokMetaType & i_rToken ) = 0; + virtual void Process_Stereotype( + const TokStereotype & + i_rToken ) = 0; + virtual void Process_ParameterHandling( + const TokParameterHandling & + i_rToken ) = 0; + virtual void Process_Raises() = 0; + virtual void Process_Needs() = 0; + virtual void Process_Observes() = 0; + virtual void Process_Assignment( + const TokAssignment & + i_rToken ) = 0; + virtual void Process_EOL() = 0; +}; + + + +// IMPLEMENTATION + + +} // namespace uidl +} // namespace csi + +#endif diff --git a/autodoc/source/parser_i/inc/s2_luidl/tokproct.hxx b/autodoc/source/parser_i/inc/s2_luidl/tokproct.hxx new file mode 100644 index 000000000000..57210760fc87 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tokproct.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokproct.hxx,v $ + * $Revision: 1.3 $ + * + * 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_TOKPROCT_HXX +#define ADC_TOKPROCT_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + + +namespace csi +{ +namespace uidl +{ + + +class UnoIDL_PE; + + +/** 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_sure, // push sub environment, which must be the correct one + push_try, // push sub environment, which is tried, if it may be the right one + 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; + UnoIDL_PE * 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 + }; +}; + + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/tokrecv.hxx b/autodoc/source/parser_i/inc/s2_luidl/tokrecv.hxx new file mode 100644 index 000000000000..e0e2d01be46a --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/tokrecv.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tokrecv.hxx,v $ + * $Revision: 1.4 $ + * + * 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 LUIDL_TOKRECV_HXX +#define LUIDL_TOKRECV_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS + +namespace csi +{ +namespace uidl +{ + + +class Token; + +/** +@descr +*/ +class Token_Receiver +{ + public: + virtual ~Token_Receiver() {} + virtual void Receive( + DYN Token & let_drToken ) = 0; + virtual void Increment_CurLine() = 0; +}; + +} // namespace uidl +} // namespace csi + +#endif + diff --git a/autodoc/source/parser_i/inc/s2_luidl/uidl_tok.hxx b/autodoc/source/parser_i/inc/s2_luidl/uidl_tok.hxx new file mode 100644 index 000000000000..9fc7950c7749 --- /dev/null +++ b/autodoc/source/parser_i/inc/s2_luidl/uidl_tok.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: uidl_tok.hxx,v $ + * $Revision: 1.4 $ + * + * 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_UIDL_TOK_HXX +#define ADC_UIDL_TOK_HXX + +// USED SERVICES + // BASE CLASSES +#include <tokens/token2.hxx> + // COMPONENTS + // PARAMETERS + + +class ParserInfo; + +namespace csi +{ +namespace uidl +{ + + +class TokenInterpreter; + +class Token : public TextToken +{ + public: + // LIFECYCLE + virtual ~Token() {} + + // OPERATIONS + virtual void Trigger( + TokenInterpreter & io_rInterpreter ) const = 0; +}; + +} // namespace uidl +} // namespace csi + +#endif + + diff --git a/autodoc/source/parser_i/inc/semantic/parsenv2.hxx b/autodoc/source/parser_i/inc/semantic/parsenv2.hxx new file mode 100644 index 000000000000..21ba2b565463 --- /dev/null +++ b/autodoc/source/parser_i/inc/semantic/parsenv2.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: parsenv2.hxx,v $ + * $Revision: 1.3 $ + * + * 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_PARSEENV2_HXX +#define ADC_PARSEENV2_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +#include <queue> + + + +class ParseEnvironment +{ + public: + virtual ~ParseEnvironment(); + + virtual void Enter() = 0; +}; + + +#endif + 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..a28d2cb37f28 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/stmstar2.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstar2.hxx,v $ + * $Revision: 1.3 $ + * + * 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..cfa0c7e1a623 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/stmstat2.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstat2.hxx,v $ + * $Revision: 1.3 $ + * + * 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..2f15f7098d82 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/stmstfi2.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstfi2.hxx,v $ + * $Revision: 1.3 $ + * + * 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..7315b569e2aa --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/tkp2.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkp2.hxx,v $ + * $Revision: 1.3 $ + * + * 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..e494b8c1a956 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/tkpcont2.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpcont2.hxx,v $ + * $Revision: 1.4 $ + * + * 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..293097edab7f --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/tkpstam2.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpstam2.hxx,v $ + * $Revision: 1.3 $ + * + * 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..1592ac476896 --- /dev/null +++ b/autodoc/source/parser_i/inc/tokens/token2.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: token2.hxx,v $ + * $Revision: 1.3 $ + * + * 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 + + diff --git a/autodoc/source/parser_i/inc/x_parse2.hxx b/autodoc/source/parser_i/inc/x_parse2.hxx new file mode 100644 index 000000000000..4c3d594a2690 --- /dev/null +++ b/autodoc/source/parser_i/inc/x_parse2.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: x_parse2.hxx,v $ + * $Revision: 1.4 $ + * + * 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_PARSE2_HXX +#define ADC_X_PARSE2_HXX + +// USED SERVICES + // BASE CLASSES +#include <cosv/x.hxx> + // COMPONENTS + // PARAMETERS + + +class X_AutodocParser : public csv::Exception +{ + public: + // TYPES + enum E_Type + { + x_Any = 0, + x_InvalidChar, + x_UnexpectedToken, + x_UnexpectedEOF + }; + // LIFECYCLE + X_AutodocParser( + E_Type i_eType, + const char * i_sName = "" ) + : eType(i_eType), sName(i_sName) {} + // INQUIRY + virtual void GetInfo( + std::ostream & o_rOutputMedium ) const; + + private: + E_Type eType; + String sName; + +}; + + + + +#endif diff --git a/autodoc/source/parser_i/tokens/makefile.mk b/autodoc/source/parser_i/tokens/makefile.mk new file mode 100644 index 000000000000..64413dd085ae --- /dev/null +++ b/autodoc/source/parser_i/tokens/makefile.mk @@ -0,0 +1,67 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=garden +TARGET=parser2_tokens +TARGETTYPE=CUI + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/stmstar2.obj \ + $(OBJ)$/stmstat2.obj \ + $(OBJ)$/stmstfi2.obj \ + $(OBJ)$/tkpstam2.obj \ + $(OBJ)$/tkp2.obj \ + $(OBJ)$/tkpcont2.obj \ + $(OBJ)$/x_parse2.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/parser_i/tokens/stmstar2.cxx b/autodoc/source/parser_i/tokens/stmstar2.cxx new file mode 100644 index 000000000000..8d0fb2cb0460 --- /dev/null +++ b/autodoc/source/parser_i/tokens/stmstar2.cxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstar2.cxx,v $ + * $Revision: 1.6 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <tokens/stmstar2.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <x_parse2.hxx> + + + +StmArrayStatu2::StmArrayStatu2( intt i_nStatusSize, + const INT16 * in_aArrayModel, + uintt i_nTokenId, + bool in_bIsDefault ) + : dpBranches(new StmStatu2::Branch[i_nStatusSize]), + nNrOfBranches(i_nStatusSize), + nTokenId(UINT16(i_nTokenId)), + bIsADefault(in_bIsDefault) +{ + // KORR_FUTURE: Interface of StmArrayStatu2() has to be changed. + csv_assert(i_nTokenId < 64536); + + if (in_aArrayModel != 0) + { + intt count = 0; + for (const INT16 * get = in_aArrayModel; count < nNrOfBranches; count++, get++) + dpBranches[count] = *get; + } + else // + { + memset(dpBranches, 0, nNrOfBranches); + } // endif +} + +StmArrayStatu2::~StmArrayStatu2() +{ + delete [] dpBranches; +} + +bool +StmArrayStatu2::SetBranch( intt in_nBranchIx, + StmStatu2::Branch in_nBranch ) +{ + if ( csv::in_range(intt(0), in_nBranchIx, intt(nNrOfBranches) ) ) + { + dpBranches[in_nBranchIx] = in_nBranch; + return true; + } + return false; +} + + +StmStatu2::Branch +StmArrayStatu2::NextBy(intt in_nIndex) const +{ + if (in_nIndex < 0) + throw X_AutodocParser(X_AutodocParser::x_InvalidChar); + + return in_nIndex < nNrOfBranches + ? dpBranches[in_nIndex] + : dpBranches[nNrOfBranches - 1]; +} + + +bool +StmArrayStatu2::IsADefault() const +{ + return bIsADefault; +} + +StmArrayStatu2 * +StmArrayStatu2::AsArray() +{ + return this; +} + diff --git a/autodoc/source/parser_i/tokens/stmstat2.cxx b/autodoc/source/parser_i/tokens/stmstat2.cxx new file mode 100644 index 000000000000..7a1acd599219 --- /dev/null +++ b/autodoc/source/parser_i/tokens/stmstat2.cxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstat2.cxx,v $ + * $Revision: 1.5 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <tokens/stmstat2.hxx> + + +// NOT FULLY DECLARED SERVICES + +StmArrayStatu2 * +StmStatu2::AsArray() +{ + return 0; +} + +StmBoundsStatu2 * +StmStatu2::AsBounds() +{ + return 0; +} + + diff --git a/autodoc/source/parser_i/tokens/stmstfi2.cxx b/autodoc/source/parser_i/tokens/stmstfi2.cxx new file mode 100644 index 000000000000..46cdf6666d64 --- /dev/null +++ b/autodoc/source/parser_i/tokens/stmstfi2.cxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: stmstfi2.cxx,v $ + * $Revision: 1.5 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <tokens/stmstfi2.hxx> + + +// NOT FULLY DECLARED SERVICES +#include <tokens/tkpcont2.hxx> + + +StmBoundsStatu2::StmBoundsStatu2( StateMachineContext & + o_rOwner, + TkpContext & i_rFollowUpContext, + uintt i_nStatusFunctionNr, + bool i_bIsDefault ) + : pOwner(&o_rOwner), + pFollowUpContext(&i_rFollowUpContext), + nStatusFunctionNr(i_nStatusFunctionNr), + bIsDefault(i_bIsDefault) +{ +} + +bool +StmBoundsStatu2::IsADefault() const +{ + return bIsDefault; +} + +StmBoundsStatu2 * +StmBoundsStatu2::AsBounds() +{ + return this; +} + + + diff --git a/autodoc/source/parser_i/tokens/tkp2.cxx b/autodoc/source/parser_i/tokens/tkp2.cxx new file mode 100644 index 000000000000..2754e5da0909 --- /dev/null +++ b/autodoc/source/parser_i/tokens/tkp2.cxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkp2.cxx,v $ + * $Revision: 1.5 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <tokens/tkp2.hxx> + +// NOT FULLY DECLARED SERVICES +#include <tools/tkpchars.hxx> +#include <tokens/tkpcont2.hxx> + +TokenParse2::TokenParse2() + : pChars(0) +{ +} + +void +TokenParse2::Start( CharacterSource & i_rSource ) +{ + pChars = &i_rSource; + SetStartContext(); +} + +bool +TokenParse2::GetNextToken() +{ + csv_assert(pChars != 0); + + bool bDone = false; + while ( NOT bDone AND NOT pChars->IsFinished() ) + { + CurrentContext().ReadCharChain(*pChars); + bDone = CurrentContext().PassNewToken(); + SetCurrentContext(CurrentContext().FollowUpContext()); + } + return bDone; +} + + diff --git a/autodoc/source/parser_i/tokens/tkpcont2.cxx b/autodoc/source/parser_i/tokens/tkpcont2.cxx new file mode 100644 index 000000000000..9fcb928bc7a4 --- /dev/null +++ b/autodoc/source/parser_i/tokens/tkpcont2.cxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpcont2.cxx,v $ + * $Revision: 1.5 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <tokens/tkpcont2.hxx> + +// NOT FULLY DECLARED SERVICES + + + +TkpNullContex2 G_aNullContex2; + +TkpNullContex2 & +TkpContext_Null2_() +{ + return G_aNullContex2; +} + +TkpNullContex2::~TkpNullContex2() +{ +} + +void +TkpNullContex2::ReadCharChain( CharacterSource & ) +{ +} + +bool +TkpNullContex2::PassNewToken() +{ + return false; +} + +TkpContext & +TkpNullContex2::FollowUpContext() +{ + return *this; +} + + + diff --git a/autodoc/source/parser_i/tokens/tkpstam2.cxx b/autodoc/source/parser_i/tokens/tkpstam2.cxx new file mode 100644 index 000000000000..6a6d4a03b9c6 --- /dev/null +++ b/autodoc/source/parser_i/tokens/tkpstam2.cxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tkpstam2.cxx,v $ + * $Revision: 1.7 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <tokens/tkpstam2.hxx> + +// NOT FULLY DECLARED SERVICES +#include <tokens/stmstar2.hxx> +#include <tools/tkpchars.hxx> + + +const intt C_nStatuslistResizeValue = 32; +const intt C_nTopStatus = 0; + +StateMachin2::StateMachin2( intt in_nStatusSize, + intt in_nInitial_StatusListSize ) + : pStati(new StmStatu2*[in_nInitial_StatusListSize]), + nCurrentStatus(C_nTopStatus), + nPeekedStatus(C_nTopStatus), + nStatusSize(in_nStatusSize), + nNrofStati(0), + nStatiSpace(in_nInitial_StatusListSize) +{ + csv_assert(in_nStatusSize > 0); + csv_assert(in_nInitial_StatusListSize > 0); + + memset(pStati, 0, sizeof(StmStatu2*) * nStatiSpace); +} + +intt +StateMachin2::AddStatus(StmStatu2 * let_dpStatus) +{ + if (nNrofStati == nStatiSpace) + { + ResizeStati(); + } + pStati[nNrofStati] = let_dpStatus; + return nNrofStati++; +} + +void +StateMachin2::AddToken( const char * in_sToken, + UINT16 in_nTokenId, + const INT16 * in_aBranches, + INT16 in_nBoundsStatus ) +{ + if (csv::no_str(in_sToken)) + return; + + // Durch existierende Stati durchhangeln: + nCurrentStatus = 0; + nPeekedStatus = 0; + + for ( const char * pChar = in_sToken; + *pChar != NULCH; + ++pChar ) + { + Peek(*pChar); + StmStatu2 & rPst = Status(nPeekedStatus); + if ( rPst.IsADefault() OR rPst.AsBounds() != 0 ) + { + nPeekedStatus = AddStatus( new StmArrayStatu2(nStatusSize, in_aBranches, 0, false ) ); + CurrentStatus().SetBranch( *pChar, nPeekedStatus ); + } + nCurrentStatus = nPeekedStatus; + } // end for + StmArrayStatu2 & rLastStatus = CurrentStatus(); + rLastStatus.SetTokenId(in_nTokenId); + for (intt i = 0; i < nStatusSize; i++) + { + if (Status(rLastStatus.NextBy(i)).AsBounds() != 0) + rLastStatus.SetBranch(i,in_nBoundsStatus); + } // end for +} + +StateMachin2::~StateMachin2() +{ + for (intt i = 0; i < nNrofStati; i++) + { + delete pStati[i]; + } + delete [] pStati; +} + +StmBoundsStatu2 & +StateMachin2::GetCharChain( UINT16 & o_nTokenId, + CharacterSource & io_rText ) +{ + nCurrentStatus = C_nTopStatus; + Peek(io_rText.CurChar()); + while (BoundsStatus() == 0) + { + nCurrentStatus = nPeekedStatus; + Peek(io_rText.MoveOn()); + } + o_nTokenId = CurrentStatus().TokenId(); + + return *BoundsStatus(); +} + +void +StateMachin2::ResizeStati() +{ + intt nNewSize = nStatiSpace + C_nStatuslistResizeValue; + intt i = 0; + StatusList pNewStati = new StmStatu2*[nNewSize]; + + for ( ; i < nNrofStati; i++) + { + pNewStati[i] = pStati[i]; + } + memset( pNewStati+i, + 0, + (nNewSize-i) * sizeof(StmStatu2*) ); + + delete [] pStati; + pStati = pNewStati; + nStatiSpace = nNewSize; +} + +StmStatu2 & +StateMachin2::Status(intt in_nStatusNr) const +{ + csv_assert( csv::in_range(intt(0), in_nStatusNr, intt(nNrofStati)) ); + return *pStati[in_nStatusNr]; +} + +StmArrayStatu2 & +StateMachin2::CurrentStatus() const +{ + StmArrayStatu2 * pCurSt = Status(nCurrentStatus).AsArray(); + if (pCurSt == 0) + { + csv_assert(false); + } + return *pCurSt; +} + +StmBoundsStatu2 * +StateMachin2::BoundsStatus() const +{ + return Status(nPeekedStatus).AsBounds(); +} + +void +StateMachin2::Peek(intt in_nBranch) +{ + StmArrayStatu2 & rSt = CurrentStatus(); + nPeekedStatus = rSt.NextBy(in_nBranch); +} diff --git a/autodoc/source/parser_i/tokens/x_parse2.cxx b/autodoc/source/parser_i/tokens/x_parse2.cxx new file mode 100644 index 000000000000..eadc8042f3a4 --- /dev/null +++ b/autodoc/source/parser_i/tokens/x_parse2.cxx @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: x_parse2.cxx,v $ + * $Revision: 1.7 $ + * + * 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. + * + ************************************************************************/ + +#include <precomp.h> +#include <x_parse2.hxx> + +// NOT FULLY DECLARED SERVICES + + enum E_Type + { + x_Any = 0, + x_InvalidChar, + x_UnexpectedEOF + }; +void +X_AutodocParser::GetInfo( std::ostream & o_rOutputMedium ) const +{ + switch (eType) + { + case x_Any: + o_rOutputMedium << "Unspecified parsing exception ." << Endl(); + break; + case x_InvalidChar: + o_rOutputMedium << "Unknown character during parsing." << Endl(); + break; + case x_UnexpectedToken: + o_rOutputMedium << "Unexpected token " << sName << " found." << Endl(); + break; + case x_UnexpectedEOF: + o_rOutputMedium << "Unexpected end of file found." << Endl(); + break; + default: + o_rOutputMedium << "Unknown exception during parsing." << Endl(); + } +} + + |