1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #include <precomp.h> 29*cdf0e10cSrcweir #include <s2_luidl/cx_idlco.hxx> 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES 33*cdf0e10cSrcweir #include <s2_luidl/cx_sub.hxx> 34*cdf0e10cSrcweir #include <s2_dsapi/cx_dsapi.hxx> 35*cdf0e10cSrcweir #include <tools/tkpchars.hxx> 36*cdf0e10cSrcweir #include <tokens/tkpstam2.hxx> 37*cdf0e10cSrcweir #include <s2_luidl/tk_ident.hxx> 38*cdf0e10cSrcweir #include <s2_luidl/tk_keyw.hxx> 39*cdf0e10cSrcweir #include <s2_luidl/tk_punct.hxx> 40*cdf0e10cSrcweir #include <s2_luidl/tokrecv.hxx> 41*cdf0e10cSrcweir #include <x_parse2.hxx> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir namespace csi 45*cdf0e10cSrcweir { 46*cdf0e10cSrcweir namespace uidl 47*cdf0e10cSrcweir { 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir const intt C_nCppInitialNrOfStati = 400; 51*cdf0e10cSrcweir const intt C_nStatusSize = 128; 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir const uintt nF_fin_Error = 1; 56*cdf0e10cSrcweir const uintt nF_fin_Ignore = 2; 57*cdf0e10cSrcweir const uintt nF_fin_Identifier = 3; 58*cdf0e10cSrcweir const uintt nF_fin_Keyword = 4; 59*cdf0e10cSrcweir const uintt nF_fin_Punctuation = 5; 60*cdf0e10cSrcweir const uintt nF_fin_EOL = 6; 61*cdf0e10cSrcweir const uintt nF_fin_EOF = 7; 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir const uintt nF_goto_MLDocu = 10; 64*cdf0e10cSrcweir const uintt nF_goto_SLDocu = 11; 65*cdf0e10cSrcweir const uintt nF_goto_MLComment = 12; 66*cdf0e10cSrcweir const uintt nF_goto_SLComment = 13; 67*cdf0e10cSrcweir const uintt nF_goto_Praeprocessor = 14; 68*cdf0e10cSrcweir const uintt nF_goto_Assignment = 15; 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir const UINT16 nTok_bty_any = 100 + TokBuiltInType::bty_any; 73*cdf0e10cSrcweir const UINT16 nTok_bty_boolean = 100 + TokBuiltInType::bty_boolean; 74*cdf0e10cSrcweir const UINT16 nTok_bty_byte = 100 + TokBuiltInType::bty_byte; 75*cdf0e10cSrcweir const UINT16 nTok_bty_char = 100 + TokBuiltInType::bty_char; 76*cdf0e10cSrcweir const UINT16 nTok_bty_double = 100 + TokBuiltInType::bty_double; 77*cdf0e10cSrcweir const UINT16 nTok_bty_hyper = 100 + TokBuiltInType::bty_hyper; 78*cdf0e10cSrcweir const UINT16 nTok_bty_long = 100 + TokBuiltInType::bty_long; 79*cdf0e10cSrcweir const UINT16 nTok_bty_short = 100 + TokBuiltInType::bty_short; 80*cdf0e10cSrcweir const UINT16 nTok_bty_string = 100 + TokBuiltInType::bty_string; 81*cdf0e10cSrcweir const UINT16 nTok_bty_void = 100 + TokBuiltInType::bty_void; 82*cdf0e10cSrcweir const UINT16 nTok_bty_ellipse = 100 + TokBuiltInType::bty_ellipse; 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir const UINT16 nTok_tmod_unsigned = 200 + TokTypeModifier::tmod_unsigned; 85*cdf0e10cSrcweir const UINT16 nTok_tmod_sequence = 200 + TokTypeModifier::tmod_sequence; 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir const UINT16 nTok_ph_in = 250 + TokParameterHandling::ph_in; 88*cdf0e10cSrcweir const UINT16 nTok_ph_out = 250 + TokParameterHandling::ph_out; 89*cdf0e10cSrcweir const UINT16 nTok_ph_inout = 250 + TokParameterHandling::ph_inout; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir const UINT16 nTok_mt_attribute = 300 + TokMetaType::mt_attribute; 92*cdf0e10cSrcweir const UINT16 nTok_mt_constants = 300 + TokMetaType::mt_constants; 93*cdf0e10cSrcweir const UINT16 nTok_mt_enum = 300 + TokMetaType::mt_enum; 94*cdf0e10cSrcweir const UINT16 nTok_mt_exception = 300 + TokMetaType::mt_exception; 95*cdf0e10cSrcweir const UINT16 nTok_mt_ident = 300 + TokMetaType::mt_ident; 96*cdf0e10cSrcweir const UINT16 nTok_mt_interface = 300 + TokMetaType::mt_interface; 97*cdf0e10cSrcweir const UINT16 nTok_mt_module = 300 + TokMetaType::mt_module; 98*cdf0e10cSrcweir const UINT16 nTok_mt_property = 300 + TokMetaType::mt_property; 99*cdf0e10cSrcweir const UINT16 nTok_mt_service = 300 + TokMetaType::mt_service; 100*cdf0e10cSrcweir const UINT16 nTok_mt_singleton = 300 + TokMetaType::mt_singleton; 101*cdf0e10cSrcweir const UINT16 nTok_mt_struct = 300 + TokMetaType::mt_struct; 102*cdf0e10cSrcweir const UINT16 nTok_mt_typedef = 300 + TokMetaType::mt_typedef; 103*cdf0e10cSrcweir const UINT16 nTok_mt_uik = 300 + TokMetaType::mt_uik; 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir const UINT16 nTok_ste_bound = 400 + TokStereotype::ste_bound; 106*cdf0e10cSrcweir const UINT16 nTok_ste_constrained = 400 + TokStereotype::ste_constrained; 107*cdf0e10cSrcweir const UINT16 nTok_ste_const = 400 + TokStereotype::ste_const; 108*cdf0e10cSrcweir const UINT16 nTok_ste_maybeambiguous = 400 + TokStereotype::ste_maybeambiguous; 109*cdf0e10cSrcweir const UINT16 nTok_ste_maybedefault = 400 + TokStereotype::ste_maybedefault; 110*cdf0e10cSrcweir const UINT16 nTok_ste_maybevoid = 400 + TokStereotype::ste_maybevoid; 111*cdf0e10cSrcweir const UINT16 nTok_ste_oneway = 400 + TokStereotype::ste_oneway; 112*cdf0e10cSrcweir const UINT16 nTok_ste_optional = 400 + TokStereotype::ste_optional; 113*cdf0e10cSrcweir const UINT16 nTok_ste_readonly = 400 + TokStereotype::ste_readonly; 114*cdf0e10cSrcweir const UINT16 nTok_ste_removable = 400 + TokStereotype::ste_removable; 115*cdf0e10cSrcweir const UINT16 nTok_ste_virtual = 400 + TokStereotype::ste_virtual; 116*cdf0e10cSrcweir const UINT16 nTok_ste_transient = 400 + TokStereotype::ste_transient; 117*cdf0e10cSrcweir const UINT16 nTok_ste_published = 400 + TokStereotype::ste_published; 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir const UINT16 nTok_raises = 501; 120*cdf0e10cSrcweir const UINT16 nTok_needs = 502; 121*cdf0e10cSrcweir const UINT16 nTok_observes = 503; 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir const UINT16 nTok_assignment = 550; 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir const UINT16 nTok_ignore = 600; 126*cdf0e10cSrcweir const UINT16 nTok_none_MLCommentBegin = 601; 127*cdf0e10cSrcweir const UINT16 nTok_none_SLCommentBegin = 602; 128*cdf0e10cSrcweir const UINT16 nTok_none_MLDocuBegin = 603; 129*cdf0e10cSrcweir const UINT16 nTok_none_SLDocuBegin = 604; 130*cdf0e10cSrcweir const UINT16 nTok_none_PraeprocessorBegin = 605; 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir const UINT16 nTok_punct_BracketOpen = 700 + TokPunctuation::BracketOpen; 134*cdf0e10cSrcweir const UINT16 nTok_punct_BracketClose = 700 + TokPunctuation::BracketClose; 135*cdf0e10cSrcweir const UINT16 nTok_punct_ArrayBracketOpen = 700 + TokPunctuation::ArrayBracketOpen; 136*cdf0e10cSrcweir const UINT16 nTok_punct_ArrayBracketClose = 700 + TokPunctuation::ArrayBracketClose; 137*cdf0e10cSrcweir const UINT16 nTok_punct_CurledBracketOpen = 700 + TokPunctuation::CurledBracketOpen; 138*cdf0e10cSrcweir const UINT16 nTok_punct_CurledBracketClose = 700 + TokPunctuation::CurledBracketClose; 139*cdf0e10cSrcweir const UINT16 nTok_punct_Semicolon = 700 + TokPunctuation::Semicolon; 140*cdf0e10cSrcweir const UINT16 nTok_punct_Colon = 700 + TokPunctuation::Colon; 141*cdf0e10cSrcweir const UINT16 nTok_punct_DoubleColon = 700 + TokPunctuation::DoubleColon; 142*cdf0e10cSrcweir const UINT16 nTok_punct_Comma = 700 + TokPunctuation::Comma; 143*cdf0e10cSrcweir const UINT16 nTok_punct_Minus = 700 + TokPunctuation::Minus; 144*cdf0e10cSrcweir const UINT16 nTok_punct_Fullstop = 700 + TokPunctuation::Fullstop; 145*cdf0e10cSrcweir const UINT16 nTok_punct_Lesser = 700 + TokPunctuation::Lesser; 146*cdf0e10cSrcweir const UINT16 nTok_punct_Greater = 700 + TokPunctuation::Greater; 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir const UINT16 nTok_EOL = 801; 149*cdf0e10cSrcweir const UINT16 nTok_EOF = 802; 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir Context_UidlCode::Context_UidlCode( Token_Receiver & o_rReceiver, 154*cdf0e10cSrcweir DYN TkpDocuContext & let_drContext_Docu ) 155*cdf0e10cSrcweir : aStateMachine(C_nStatusSize,C_nCppInitialNrOfStati), 156*cdf0e10cSrcweir pReceiver(&o_rReceiver), 157*cdf0e10cSrcweir pDocuContext(&let_drContext_Docu), 158*cdf0e10cSrcweir dpContext_MLComment(0), 159*cdf0e10cSrcweir dpContext_SLComment(0), 160*cdf0e10cSrcweir dpContext_Preprocessor(0), 161*cdf0e10cSrcweir dpContext_Assignment(0), 162*cdf0e10cSrcweir pNewToken(0), 163*cdf0e10cSrcweir pFollowUpContext(0) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir dpContext_MLComment = new Context_MLComment(o_rReceiver,*this), 166*cdf0e10cSrcweir dpContext_SLComment = new Context_SLComment(o_rReceiver,*this), 167*cdf0e10cSrcweir dpContext_Preprocessor = new Context_Praeprocessor(o_rReceiver,*this), 168*cdf0e10cSrcweir dpContext_Assignment = new Context_Assignment(o_rReceiver,*this), 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir pDocuContext->SetParentContext(*this,"*/"); 171*cdf0e10cSrcweir SetupStateMachine(); 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir Context_UidlCode::~Context_UidlCode() 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir void 179*cdf0e10cSrcweir Context_UidlCode::ReadCharChain( CharacterSource & io_rText ) 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir pNewToken = 0; 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir UINT16 nTokenId = 0; 184*cdf0e10cSrcweir StmBoundsStatu2 & rBound = aStateMachine.GetCharChain(nTokenId, io_rText); 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir // !!! 187*cdf0e10cSrcweir // The order of the next two lines is essential, because 188*cdf0e10cSrcweir // pFollowUpContext may be changed by PerformStatusFunction() also, 189*cdf0e10cSrcweir // which then MUST override the previous assignment. 190*cdf0e10cSrcweir pFollowUpContext = rBound.FollowUpContext(); 191*cdf0e10cSrcweir PerformStatusFunction(rBound.StatusFunctionNr(), nTokenId, io_rText); 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir bool 195*cdf0e10cSrcweir Context_UidlCode::PassNewToken() 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir if (pNewToken) 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir pReceiver->Receive(*pNewToken.Release()); 200*cdf0e10cSrcweir return true; 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir return false; 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir TkpContext & 206*cdf0e10cSrcweir Context_UidlCode::FollowUpContext() 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir csv_assert(pFollowUpContext != 0); 209*cdf0e10cSrcweir return *pFollowUpContext; 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir void 213*cdf0e10cSrcweir Context_UidlCode::PerformStatusFunction( uintt i_nStatusSignal, 214*cdf0e10cSrcweir UINT16 i_nTokenId, 215*cdf0e10cSrcweir CharacterSource & io_rText ) 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir switch (i_nStatusSignal) 218*cdf0e10cSrcweir { 219*cdf0e10cSrcweir case nF_fin_Error: 220*cdf0e10cSrcweir // KORR_FUTURE 221*cdf0e10cSrcweir throw X_AutodocParser(X_AutodocParser::x_InvalidChar); 222*cdf0e10cSrcweir // no break, because of throw 223*cdf0e10cSrcweir case nF_fin_Ignore: 224*cdf0e10cSrcweir pNewToken = 0; 225*cdf0e10cSrcweir io_rText.CutToken(); 226*cdf0e10cSrcweir break; 227*cdf0e10cSrcweir case nF_fin_Identifier: 228*cdf0e10cSrcweir pNewToken = new TokIdentifier(io_rText.CutToken()); 229*cdf0e10cSrcweir break; 230*cdf0e10cSrcweir case nF_fin_Keyword: 231*cdf0e10cSrcweir io_rText.CutToken(); 232*cdf0e10cSrcweir switch ( i_nTokenId / 50 ) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir case 2: 235*cdf0e10cSrcweir pNewToken = new TokBuiltInType(i_nTokenId - 100); 236*cdf0e10cSrcweir break; 237*cdf0e10cSrcweir case 4: 238*cdf0e10cSrcweir pNewToken = new TokTypeModifier(i_nTokenId - 200); 239*cdf0e10cSrcweir break; 240*cdf0e10cSrcweir case 5: 241*cdf0e10cSrcweir pNewToken = new TokParameterHandling(i_nTokenId - 250); 242*cdf0e10cSrcweir break; 243*cdf0e10cSrcweir case 6: 244*cdf0e10cSrcweir pNewToken = new TokMetaType(i_nTokenId - 300); 245*cdf0e10cSrcweir break; 246*cdf0e10cSrcweir case 8: 247*cdf0e10cSrcweir pNewToken = new TokStereotype(i_nTokenId - 400); 248*cdf0e10cSrcweir break; 249*cdf0e10cSrcweir case 10: 250*cdf0e10cSrcweir switch (i_nTokenId-500) 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir case 1: 253*cdf0e10cSrcweir pNewToken = new TokRaises; 254*cdf0e10cSrcweir break; 255*cdf0e10cSrcweir case 2: 256*cdf0e10cSrcweir pNewToken = new TokNeeds; 257*cdf0e10cSrcweir break; 258*cdf0e10cSrcweir case 3: 259*cdf0e10cSrcweir pNewToken = new TokObserves; 260*cdf0e10cSrcweir break; 261*cdf0e10cSrcweir default: 262*cdf0e10cSrcweir csv_assert(false); 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir break; 265*cdf0e10cSrcweir default: 266*cdf0e10cSrcweir csv_assert(false); 267*cdf0e10cSrcweir } // end switch ( i_nTokenId / 50 ) 268*cdf0e10cSrcweir break; 269*cdf0e10cSrcweir case nF_fin_Punctuation: 270*cdf0e10cSrcweir io_rText.CutToken(); 271*cdf0e10cSrcweir if (i_nTokenId == nTok_punct_DoubleColon) 272*cdf0e10cSrcweir pNewToken = new TokNameSeparator; 273*cdf0e10cSrcweir else 274*cdf0e10cSrcweir pNewToken = new TokPunctuation(i_nTokenId - 700); 275*cdf0e10cSrcweir break; 276*cdf0e10cSrcweir case nF_fin_EOL: 277*cdf0e10cSrcweir io_rText.CutToken(); 278*cdf0e10cSrcweir pNewToken = new Tok_EOL; 279*cdf0e10cSrcweir pReceiver->Increment_CurLine(); 280*cdf0e10cSrcweir break; 281*cdf0e10cSrcweir case nF_fin_EOF: 282*cdf0e10cSrcweir pNewToken = new Tok_EOF; 283*cdf0e10cSrcweir break; 284*cdf0e10cSrcweir case nF_goto_MLDocu: 285*cdf0e10cSrcweir while ( io_rText.CurChar() == '*') 286*cdf0e10cSrcweir io_rText.MoveOn(); 287*cdf0e10cSrcweir io_rText.CutToken(); 288*cdf0e10cSrcweir pDocuContext->SetMode_IsMultiLine(true); 289*cdf0e10cSrcweir break; 290*cdf0e10cSrcweir case nF_goto_SLDocu: 291*cdf0e10cSrcweir io_rText.CutToken(); 292*cdf0e10cSrcweir pDocuContext->SetMode_IsMultiLine(false); 293*cdf0e10cSrcweir break; 294*cdf0e10cSrcweir case nF_goto_MLComment: 295*cdf0e10cSrcweir break; 296*cdf0e10cSrcweir case nF_goto_SLComment: 297*cdf0e10cSrcweir break; 298*cdf0e10cSrcweir case nF_goto_Praeprocessor: 299*cdf0e10cSrcweir break; 300*cdf0e10cSrcweir case nF_goto_Assignment: 301*cdf0e10cSrcweir break; 302*cdf0e10cSrcweir default: 303*cdf0e10cSrcweir csv_assert(false); 304*cdf0e10cSrcweir } // end switch (i_nStatusSignal) 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir void 308*cdf0e10cSrcweir Context_UidlCode::SetupStateMachine() 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir // Besondere Array-Stati (kein Tokenabschluss oder Kontextwechsel): 311*cdf0e10cSrcweir // const INT16 top = 0; // Top-Status 312*cdf0e10cSrcweir const INT16 wht = 1; // Whitespace-�berlese-Status 313*cdf0e10cSrcweir const INT16 bez = 2; // Bezeichner-lese-Status 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir // Tokenfinish-Stati: 316*cdf0e10cSrcweir const INT16 finErr = 3; 317*cdf0e10cSrcweir const INT16 finIgn = 4; 318*cdf0e10cSrcweir const INT16 finBez = 5; 319*cdf0e10cSrcweir const INT16 finKeyw = 6; 320*cdf0e10cSrcweir const INT16 finPunct = 7; 321*cdf0e10cSrcweir const INT16 finEOL = 8; 322*cdf0e10cSrcweir const INT16 finEOF = 9; 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir // Kontextwechsel-Stati: 325*cdf0e10cSrcweir const INT16 gotoMld = 10; 326*cdf0e10cSrcweir const INT16 gotoSld = 11; 327*cdf0e10cSrcweir const INT16 gotoMlc = 12; 328*cdf0e10cSrcweir const INT16 gotoSlc = 13; 329*cdf0e10cSrcweir const INT16 gotoPrp = 14; 330*cdf0e10cSrcweir const INT16 gotoAsg = 15; 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir // Konstanten zur Benutzung in der Tabelle: 333*cdf0e10cSrcweir const INT16 err = finErr; 334*cdf0e10cSrcweir const INT16 fbz = finBez; 335*cdf0e10cSrcweir const INT16 fig = finIgn; 336*cdf0e10cSrcweir const INT16 fof = finEOF; 337*cdf0e10cSrcweir // const INT16 fkw = finKeyw; 338*cdf0e10cSrcweir // const INT16 fpc = finPunct; 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir /// Die '0'en werden spaeter durch AddToken() ersetzt. 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir const INT16 A_nTopStatus[C_nStatusSize] = 343*cdf0e10cSrcweir // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 344*cdf0e10cSrcweir {fof,err,err,err,err,err,err,err,err,wht, 0,wht,wht, 0,err,err, 345*cdf0e10cSrcweir err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // 16 ... 346*cdf0e10cSrcweir wht,err,wht, 0,err,err,err,err, 0, 0,err,err, 0, 0, 0,err, 347*cdf0e10cSrcweir bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,err,err,err,err,err,err, // 48 ... 348*cdf0e10cSrcweir err,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 349*cdf0e10cSrcweir bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 0,err, 0,err,bez, // 80 ... 350*cdf0e10cSrcweir err,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 351*cdf0e10cSrcweir bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 0,err, 0,err,err, // 112 ... 352*cdf0e10cSrcweir }; 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir const INT16 A_nWhitespaceStatus[C_nStatusSize] = 355*cdf0e10cSrcweir // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 356*cdf0e10cSrcweir {fof,err,err,err,err,err,err,err,err,wht,fig,wht,wht,fig,err,err, 357*cdf0e10cSrcweir err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // 16 ... 358*cdf0e10cSrcweir wht,fig,wht,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, 359*cdf0e10cSrcweir fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, // 48 ... 360*cdf0e10cSrcweir fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, 361*cdf0e10cSrcweir fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, // 80 ... 362*cdf0e10cSrcweir fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig, 363*cdf0e10cSrcweir fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,fig,err // 112 ... 364*cdf0e10cSrcweir }; 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir const INT16 A_nBezeichnerStatus[C_nStatusSize] = 367*cdf0e10cSrcweir // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 368*cdf0e10cSrcweir {fbz,err,err,err,err,err,err,err,err,fbz,fbz,fbz,fbz,fbz,err,err, 369*cdf0e10cSrcweir err,err,err,err,err,err,err,err,err,err,fbz,err,err,err,err,err, // 16 ... 370*cdf0e10cSrcweir fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz, 371*cdf0e10cSrcweir bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,fbz,fbz, // 48 ... 372*cdf0e10cSrcweir fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 373*cdf0e10cSrcweir bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,bez, // 80 ... 374*cdf0e10cSrcweir fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 375*cdf0e10cSrcweir bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,err // 112 ... 376*cdf0e10cSrcweir }; 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir const INT16 A_nPunctDefStatus[C_nStatusSize] = 379*cdf0e10cSrcweir // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 380*cdf0e10cSrcweir {err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, 381*cdf0e10cSrcweir err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 16 ... 382*cdf0e10cSrcweir err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, 383*cdf0e10cSrcweir err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 48 ... 384*cdf0e10cSrcweir err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, 385*cdf0e10cSrcweir err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, // 80 ... 386*cdf0e10cSrcweir err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err, 387*cdf0e10cSrcweir err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err // 112 ... 388*cdf0e10cSrcweir }; 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir const INT16 A_nKeywordDefStatus[C_nStatusSize] = 391*cdf0e10cSrcweir // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 392*cdf0e10cSrcweir {fbz,err,err,err,err,err,err,err,err,fbz,fbz,fbz,fbz,fbz,err,err, 393*cdf0e10cSrcweir err,err,err,err,err,err,err,err,err,err,fbz,err,err,err,err,err, // 16 ... 394*cdf0e10cSrcweir fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz,fbz, 395*cdf0e10cSrcweir bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,fbz,fbz, // 48 ... 396*cdf0e10cSrcweir fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 397*cdf0e10cSrcweir bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,bez, // 80 ... 398*cdf0e10cSrcweir fbz,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez, 399*cdf0e10cSrcweir bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,bez,fbz,fbz,fbz,fbz,err // 112 ... 400*cdf0e10cSrcweir }; 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir DYN StmArrayStatu2 * dpStatusTop 403*cdf0e10cSrcweir = new StmArrayStatu2( C_nStatusSize, A_nTopStatus, 0, true); 404*cdf0e10cSrcweir DYN StmArrayStatu2 * dpStatusWhite 405*cdf0e10cSrcweir = new StmArrayStatu2( C_nStatusSize, A_nWhitespaceStatus, 0, true); 406*cdf0e10cSrcweir DYN StmArrayStatu2 * dpStatusBez 407*cdf0e10cSrcweir = new StmArrayStatu2( C_nStatusSize, A_nBezeichnerStatus, 0, true); 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir DYN StmBoundsStatu2 * dpBst_finErr 410*cdf0e10cSrcweir = new StmBoundsStatu2( *this, TkpContext_Null2_(), nF_fin_Error, true ); 411*cdf0e10cSrcweir DYN StmBoundsStatu2 * dpBst_finIgn 412*cdf0e10cSrcweir = new StmBoundsStatu2( *this, *this, nF_fin_Ignore, true ); 413*cdf0e10cSrcweir DYN StmBoundsStatu2 * dpBst_finBez 414*cdf0e10cSrcweir = new StmBoundsStatu2( *this, *this, nF_fin_Identifier, true ); 415*cdf0e10cSrcweir DYN StmBoundsStatu2 * dpBst_finKeyw 416*cdf0e10cSrcweir = new StmBoundsStatu2( *this, *this, nF_fin_Keyword, false ); 417*cdf0e10cSrcweir DYN StmBoundsStatu2 * dpBst_finPunct 418*cdf0e10cSrcweir = new StmBoundsStatu2( *this, *this, nF_fin_Punctuation, false ); 419*cdf0e10cSrcweir DYN StmBoundsStatu2 * dpBst_finEOL 420*cdf0e10cSrcweir = new StmBoundsStatu2( *this, *this, nF_fin_EOL, false ); 421*cdf0e10cSrcweir DYN StmBoundsStatu2 * dpBst_finEOF 422*cdf0e10cSrcweir = new StmBoundsStatu2( *this, TkpContext_Null2_(), nF_fin_EOF, false ); 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir DYN StmBoundsStatu2 * dpBst_gotoMld 425*cdf0e10cSrcweir = new StmBoundsStatu2( *this, *pDocuContext, nF_goto_MLDocu, false ); 426*cdf0e10cSrcweir DYN StmBoundsStatu2 * dpBst_gotoSld 427*cdf0e10cSrcweir = new StmBoundsStatu2( *this, *pDocuContext, nF_goto_SLDocu, false ); 428*cdf0e10cSrcweir DYN StmBoundsStatu2 * dpBst_gotoMlc 429*cdf0e10cSrcweir = new StmBoundsStatu2( *this, *dpContext_MLComment, nF_goto_MLComment, false ); 430*cdf0e10cSrcweir DYN StmBoundsStatu2 * dpBst_gotoSlc 431*cdf0e10cSrcweir = new StmBoundsStatu2( *this, *dpContext_SLComment, nF_goto_SLComment, false ); 432*cdf0e10cSrcweir DYN StmBoundsStatu2 * dpBst_gotoPrp 433*cdf0e10cSrcweir = new StmBoundsStatu2( *this, *dpContext_Preprocessor, nF_goto_Praeprocessor, false ); 434*cdf0e10cSrcweir DYN StmBoundsStatu2 * dpBst_gotoAsg 435*cdf0e10cSrcweir = new StmBoundsStatu2( *this, *dpContext_Assignment, nF_goto_Assignment, false ); 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir // dpMain aufbauen: 438*cdf0e10cSrcweir aStateMachine.AddStatus(dpStatusTop); 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir aStateMachine.AddStatus(dpStatusWhite); 441*cdf0e10cSrcweir aStateMachine.AddStatus(dpStatusBez); 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir aStateMachine.AddStatus(dpBst_finErr); 444*cdf0e10cSrcweir aStateMachine.AddStatus(dpBst_finIgn); 445*cdf0e10cSrcweir aStateMachine.AddStatus(dpBst_finBez); 446*cdf0e10cSrcweir aStateMachine.AddStatus(dpBst_finKeyw); 447*cdf0e10cSrcweir aStateMachine.AddStatus(dpBst_finPunct); 448*cdf0e10cSrcweir aStateMachine.AddStatus(dpBst_finEOL); 449*cdf0e10cSrcweir aStateMachine.AddStatus(dpBst_finEOF); 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir aStateMachine.AddStatus(dpBst_gotoMld); 452*cdf0e10cSrcweir aStateMachine.AddStatus(dpBst_gotoSld); 453*cdf0e10cSrcweir aStateMachine.AddStatus(dpBst_gotoMlc); 454*cdf0e10cSrcweir aStateMachine.AddStatus(dpBst_gotoSlc); 455*cdf0e10cSrcweir aStateMachine.AddStatus(dpBst_gotoPrp); 456*cdf0e10cSrcweir aStateMachine.AddStatus(dpBst_gotoAsg); 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir aStateMachine.AddToken("any", nTok_bty_any, A_nKeywordDefStatus, finKeyw); 459*cdf0e10cSrcweir aStateMachine.AddToken("attribute", nTok_mt_attribute, A_nKeywordDefStatus, finKeyw); 460*cdf0e10cSrcweir aStateMachine.AddToken("boolean", nTok_bty_boolean, A_nKeywordDefStatus, finKeyw); 461*cdf0e10cSrcweir aStateMachine.AddToken("bound", nTok_ste_bound, A_nKeywordDefStatus, finKeyw); 462*cdf0e10cSrcweir aStateMachine.AddToken("byte", nTok_bty_byte, A_nKeywordDefStatus, finKeyw); 463*cdf0e10cSrcweir aStateMachine.AddToken("char", nTok_bty_char, A_nKeywordDefStatus, finKeyw); 464*cdf0e10cSrcweir aStateMachine.AddToken("const", nTok_ste_const, A_nKeywordDefStatus, finKeyw); 465*cdf0e10cSrcweir aStateMachine.AddToken("constants", nTok_mt_constants, A_nKeywordDefStatus, finKeyw); 466*cdf0e10cSrcweir aStateMachine.AddToken("constrained", 467*cdf0e10cSrcweir nTok_ste_constrained, A_nKeywordDefStatus, finKeyw); 468*cdf0e10cSrcweir aStateMachine.AddToken("double", nTok_bty_double, A_nKeywordDefStatus, finKeyw); 469*cdf0e10cSrcweir aStateMachine.AddToken("enum", nTok_mt_enum, A_nKeywordDefStatus, finKeyw); 470*cdf0e10cSrcweir aStateMachine.AddToken("exception", nTok_mt_exception, A_nKeywordDefStatus, finKeyw); 471*cdf0e10cSrcweir aStateMachine.AddToken("hyper", nTok_bty_hyper, A_nKeywordDefStatus, finKeyw); 472*cdf0e10cSrcweir aStateMachine.AddToken("ident", nTok_mt_ident, A_nKeywordDefStatus, finKeyw); 473*cdf0e10cSrcweir aStateMachine.AddToken("in", nTok_ph_in, A_nKeywordDefStatus, finKeyw); 474*cdf0e10cSrcweir aStateMachine.AddToken("inout", nTok_ph_inout, A_nKeywordDefStatus, finKeyw); 475*cdf0e10cSrcweir aStateMachine.AddToken("interface", nTok_mt_interface, A_nKeywordDefStatus, finKeyw); 476*cdf0e10cSrcweir aStateMachine.AddToken("long", nTok_bty_long, A_nKeywordDefStatus, finKeyw); 477*cdf0e10cSrcweir aStateMachine.AddToken("maybeambiguous", 478*cdf0e10cSrcweir nTok_ste_maybeambiguous,A_nKeywordDefStatus, finKeyw); 479*cdf0e10cSrcweir aStateMachine.AddToken("maybedefault", 480*cdf0e10cSrcweir nTok_ste_maybedefault, A_nKeywordDefStatus, finKeyw); 481*cdf0e10cSrcweir aStateMachine.AddToken("maybevoid", nTok_ste_maybevoid, A_nKeywordDefStatus, finKeyw); 482*cdf0e10cSrcweir aStateMachine.AddToken("module", nTok_mt_module, A_nKeywordDefStatus, finKeyw); 483*cdf0e10cSrcweir aStateMachine.AddToken("needs", nTok_needs, A_nKeywordDefStatus, finKeyw); 484*cdf0e10cSrcweir aStateMachine.AddToken("observes", nTok_observes, A_nKeywordDefStatus, finKeyw); 485*cdf0e10cSrcweir aStateMachine.AddToken("oneway", nTok_ste_oneway, A_nKeywordDefStatus, finKeyw); 486*cdf0e10cSrcweir aStateMachine.AddToken("optional", nTok_ste_optional, A_nKeywordDefStatus, finKeyw); 487*cdf0e10cSrcweir aStateMachine.AddToken("out", nTok_ph_out, A_nKeywordDefStatus, finKeyw); 488*cdf0e10cSrcweir aStateMachine.AddToken("property", nTok_mt_property, A_nKeywordDefStatus, finKeyw); 489*cdf0e10cSrcweir aStateMachine.AddToken("published", nTok_ste_published, A_nKeywordDefStatus, finKeyw); 490*cdf0e10cSrcweir aStateMachine.AddToken("raises", nTok_raises, A_nKeywordDefStatus, finKeyw); 491*cdf0e10cSrcweir aStateMachine.AddToken("readonly", nTok_ste_readonly, A_nKeywordDefStatus, finKeyw); 492*cdf0e10cSrcweir aStateMachine.AddToken("removable", nTok_ste_removable, A_nKeywordDefStatus, finKeyw); 493*cdf0e10cSrcweir aStateMachine.AddToken("sequence", nTok_tmod_sequence, A_nKeywordDefStatus, finKeyw); 494*cdf0e10cSrcweir aStateMachine.AddToken("service", nTok_mt_service, A_nKeywordDefStatus, finKeyw); 495*cdf0e10cSrcweir aStateMachine.AddToken("short", nTok_bty_short, A_nKeywordDefStatus, finKeyw); 496*cdf0e10cSrcweir aStateMachine.AddToken("singleton", nTok_mt_singleton, A_nKeywordDefStatus, finKeyw); 497*cdf0e10cSrcweir aStateMachine.AddToken("string", nTok_bty_string, A_nKeywordDefStatus, finKeyw); 498*cdf0e10cSrcweir aStateMachine.AddToken("struct", nTok_mt_struct, A_nKeywordDefStatus, finKeyw); 499*cdf0e10cSrcweir aStateMachine.AddToken("transient", nTok_ste_transient, A_nKeywordDefStatus, finKeyw); 500*cdf0e10cSrcweir aStateMachine.AddToken("typedef", nTok_mt_typedef, A_nKeywordDefStatus, finKeyw); 501*cdf0e10cSrcweir aStateMachine.AddToken("uik", nTok_mt_uik, A_nKeywordDefStatus, finKeyw); 502*cdf0e10cSrcweir aStateMachine.AddToken("unsigned", nTok_tmod_unsigned, A_nKeywordDefStatus, finKeyw); 503*cdf0e10cSrcweir aStateMachine.AddToken("virtual", nTok_ste_virtual, A_nKeywordDefStatus, finKeyw); 504*cdf0e10cSrcweir aStateMachine.AddToken("void", nTok_bty_void, A_nKeywordDefStatus, finKeyw); 505*cdf0e10cSrcweir aStateMachine.AddToken("...", nTok_bty_ellipse, A_nPunctDefStatus, finKeyw); 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir aStateMachine.AddToken("=", nTok_assignment, A_nPunctDefStatus, gotoAsg); 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir aStateMachine.AddToken("(", nTok_punct_BracketOpen, A_nPunctDefStatus, finPunct); 510*cdf0e10cSrcweir aStateMachine.AddToken(")", nTok_punct_BracketClose,A_nPunctDefStatus, finPunct); 511*cdf0e10cSrcweir aStateMachine.AddToken("[", nTok_punct_ArrayBracketOpen, 512*cdf0e10cSrcweir A_nPunctDefStatus, finIgn); 513*cdf0e10cSrcweir aStateMachine.AddToken("]", nTok_punct_ArrayBracketClose, 514*cdf0e10cSrcweir A_nPunctDefStatus, finIgn); 515*cdf0e10cSrcweir aStateMachine.AddToken("{", nTok_punct_CurledBracketOpen, 516*cdf0e10cSrcweir A_nPunctDefStatus, finPunct); 517*cdf0e10cSrcweir aStateMachine.AddToken("}", nTok_punct_CurledBracketClose, 518*cdf0e10cSrcweir A_nPunctDefStatus, finPunct); 519*cdf0e10cSrcweir aStateMachine.AddToken("<", nTok_punct_Lesser, A_nPunctDefStatus, finPunct); 520*cdf0e10cSrcweir aStateMachine.AddToken(">", nTok_punct_Greater, A_nPunctDefStatus, finPunct); 521*cdf0e10cSrcweir aStateMachine.AddToken(";", nTok_punct_Semicolon, A_nPunctDefStatus, finPunct); 522*cdf0e10cSrcweir aStateMachine.AddToken(":", nTok_punct_Colon, A_nPunctDefStatus, finPunct); 523*cdf0e10cSrcweir aStateMachine.AddToken("::", nTok_punct_DoubleColon, A_nPunctDefStatus, finPunct); 524*cdf0e10cSrcweir aStateMachine.AddToken(",", nTok_punct_Comma, A_nPunctDefStatus, finPunct); 525*cdf0e10cSrcweir aStateMachine.AddToken("-", nTok_punct_Minus, A_nPunctDefStatus, finPunct); 526*cdf0e10cSrcweir aStateMachine.AddToken(".", nTok_punct_Fullstop, A_nPunctDefStatus, finPunct); 527*cdf0e10cSrcweir aStateMachine.AddToken("/**", nTok_none_MLDocuBegin, A_nPunctDefStatus, gotoMld); 528*cdf0e10cSrcweir aStateMachine.AddToken("///", nTok_none_SLDocuBegin, A_nPunctDefStatus, gotoSld); 529*cdf0e10cSrcweir aStateMachine.AddToken("/*", nTok_none_MLCommentBegin, 530*cdf0e10cSrcweir A_nPunctDefStatus, gotoMlc); 531*cdf0e10cSrcweir aStateMachine.AddToken("//", nTok_none_SLCommentBegin, 532*cdf0e10cSrcweir A_nPunctDefStatus, gotoSlc); 533*cdf0e10cSrcweir aStateMachine.AddToken("/**/", nTok_ignore, A_nPunctDefStatus, finIgn); 534*cdf0e10cSrcweir aStateMachine.AddToken("#", nTok_none_PraeprocessorBegin, 535*cdf0e10cSrcweir A_nPunctDefStatus, gotoPrp); 536*cdf0e10cSrcweir aStateMachine.AddToken("\r\n", nTok_EOL, A_nPunctDefStatus, finEOL); 537*cdf0e10cSrcweir aStateMachine.AddToken("\r", nTok_EOL, A_nPunctDefStatus, finEOL); 538*cdf0e10cSrcweir aStateMachine.AddToken("\n", nTok_EOL, A_nPunctDefStatus, finEOL); 539*cdf0e10cSrcweir aStateMachine.AddToken("\n\r", nTok_EOL, A_nPunctDefStatus, finEOL); 540*cdf0e10cSrcweir }; 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir 543*cdf0e10cSrcweir } // namespace uidl 544*cdf0e10cSrcweir } // namespace csi 545*cdf0e10cSrcweir 546