diff options
Diffstat (limited to 'autodoc/source/parser_i/idl')
29 files changed, 6827 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..3ba1a41891af --- /dev/null +++ b/autodoc/source/parser_i/idl/cx_idlco.cxx @@ -0,0 +1,545 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..146be0cf9c62 --- /dev/null +++ b/autodoc/source/parser_i/idl/cx_sub.cxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..55e6fc6d0e79 --- /dev/null +++ b/autodoc/source/parser_i/idl/distrib.cxx @@ -0,0 +1,264 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..7449548742b6 --- /dev/null +++ b/autodoc/source/parser_i/idl/makefile.mk @@ -0,0 +1,84 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +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..026eb3fa4b31 --- /dev/null +++ b/autodoc/source/parser_i/idl/parsenv2.cxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..3ea90dac747c --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_attri.cxx @@ -0,0 +1,294 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..d75272c9b06a --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_const.cxx @@ -0,0 +1,280 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..afd3c86627d8 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_enum2.cxx @@ -0,0 +1,251 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..14bcfd024e32 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_evalu.cxx @@ -0,0 +1,182 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..8b09f4a03ba4 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_excp.cxx @@ -0,0 +1,298 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..872e5550201a --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_file2.cxx @@ -0,0 +1,318 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..ed25be5f763d --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_func2.cxx @@ -0,0 +1,445 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..789af536cb3a --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_iface.cxx @@ -0,0 +1,467 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..0e585b27e9a7 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_property.cxx @@ -0,0 +1,238 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..40d052b8b267 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_selem.cxx @@ -0,0 +1,205 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..eb8bf0f7ede4 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_servi.cxx @@ -0,0 +1,393 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..f41d938f915f --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_singl.cxx @@ -0,0 +1,272 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..23e44643ff47 --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_struc.cxx @@ -0,0 +1,327 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..e7b7b117ba9f --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_tydf2.cxx @@ -0,0 +1,184 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..9ceb955576ec --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_type2.cxx @@ -0,0 +1,314 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..c294da7f507b --- /dev/null +++ b/autodoc/source/parser_i/idl/pe_vari2.cxx @@ -0,0 +1,173 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..9a80b8c4a0d4 --- /dev/null +++ b/autodoc/source/parser_i/idl/pestate.cxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..1549d5eb0f24 --- /dev/null +++ b/autodoc/source/parser_i/idl/semnode.cxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..d342ffc1f847 --- /dev/null +++ b/autodoc/source/parser_i/idl/tk_const.cxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..2a284b701e55 --- /dev/null +++ b/autodoc/source/parser_i/idl/tk_ident.cxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..1e8076a515f2 --- /dev/null +++ b/autodoc/source/parser_i/idl/tk_keyw.cxx @@ -0,0 +1,225 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..40627196f89e --- /dev/null +++ b/autodoc/source/parser_i/idl/tk_punct.cxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..9969e9b34364 --- /dev/null +++ b/autodoc/source/parser_i/idl/tkp_uidl.cxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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..34ad8064e3a9 --- /dev/null +++ b/autodoc/source/parser_i/idl/unoidl.cxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#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 |