1*1c78a5d6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1c78a5d6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1c78a5d6SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1c78a5d6SAndrew Rist * distributed with this work for additional information 6*1c78a5d6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1c78a5d6SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1c78a5d6SAndrew Rist * "License"); you may not use this file except in compliance 9*1c78a5d6SAndrew Rist * with the License. You may obtain a copy of the License at 10*1c78a5d6SAndrew Rist * 11*1c78a5d6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*1c78a5d6SAndrew Rist * 13*1c78a5d6SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1c78a5d6SAndrew Rist * software distributed under the License is distributed on an 15*1c78a5d6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1c78a5d6SAndrew Rist * KIND, either express or implied. See the License for the 17*1c78a5d6SAndrew Rist * specific language governing permissions and limitations 18*1c78a5d6SAndrew Rist * under the License. 19*1c78a5d6SAndrew Rist * 20*1c78a5d6SAndrew Rist *************************************************************/ 21*1c78a5d6SAndrew Rist 22*1c78a5d6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef ADC_TKPCONT2_HXX 25cdf0e10cSrcweir #define ADC_TKPCONT2_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir // USED SERVICES 28cdf0e10cSrcweir // BASE CLASSES 29cdf0e10cSrcweir // COMPONENTS 30cdf0e10cSrcweir // PARAMETERS 31cdf0e10cSrcweir class CharacterSource; 32cdf0e10cSrcweir class TkpNullContext; 33cdf0e10cSrcweir class TkpNullContex2; 34cdf0e10cSrcweir 35cdf0e10cSrcweir /** @task 36cdf0e10cSrcweir Specifies a context within which tokens are interpreted in a special 37cdf0e10cSrcweir way. For example in parsing C++ there could be a context for code, 38cdf0e10cSrcweir one for comments and a third one for preprocessor statements, because 39cdf0e10cSrcweir each of these would give the same token different meanings. 40cdf0e10cSrcweir **/ 41cdf0e10cSrcweir class TkpContext 42cdf0e10cSrcweir { 43cdf0e10cSrcweir public: 44cdf0e10cSrcweir // LIFECYCLE ~TkpContext()45cdf0e10cSrcweir virtual ~TkpContext() {} 46cdf0e10cSrcweir 47cdf0e10cSrcweir // OPERATIONS 48cdf0e10cSrcweir /** @descr 49cdf0e10cSrcweir The functions starts to parse with the CurToken() of io_rText. 50cdf0e10cSrcweir It leaves io_rText at the first char of the following Token or 51cdf0e10cSrcweir the following Context. 52cdf0e10cSrcweir 53cdf0e10cSrcweir This function returns, when a context has parsed some characterss 54cdf0e10cSrcweir and completed a token OR left the context. 55cdf0e10cSrcweir If the token is to be ignored, PassNewToken() returns false 56cdf0e10cSrcweir and cuts the token from io_rText. 57cdf0e10cSrcweir If the token is to be parsed further in a different context, 58cdf0e10cSrcweir PassNewToken() returns false, but the token is 59cdf0e10cSrcweir NOT cut from io_rText. 60cdf0e10cSrcweir 61cdf0e10cSrcweir If the function has found a valid and complete token, PassNewToken() 62cdf0e10cSrcweir passes the parsed token to the internally known receiver and 63cdf0e10cSrcweir returns true. The token is cut from io_rText. 64cdf0e10cSrcweir **/ 65cdf0e10cSrcweir virtual void ReadCharChain( 66cdf0e10cSrcweir CharacterSource & io_rText ) = 0; 67cdf0e10cSrcweir /** Has to pass the parsed token to a known receiver. 68cdf0e10cSrcweir @return true, if a token was passed. 69cdf0e10cSrcweir false, if no token was parsed complete by this context. 70cdf0e10cSrcweir */ 71cdf0e10cSrcweir virtual bool PassNewToken() = 0; 72cdf0e10cSrcweir virtual TkpContext & 73cdf0e10cSrcweir FollowUpContext() = 0; 74cdf0e10cSrcweir 75cdf0e10cSrcweir static TkpNullContext & 76cdf0e10cSrcweir Null_(); 77cdf0e10cSrcweir }; 78cdf0e10cSrcweir 79cdf0e10cSrcweir TkpNullContex2 & TkpContext_Null2_(); 80cdf0e10cSrcweir 81cdf0e10cSrcweir class StateMachineContext 82cdf0e10cSrcweir { 83cdf0e10cSrcweir public: ~StateMachineContext()84cdf0e10cSrcweir virtual ~StateMachineContext() {} 85cdf0e10cSrcweir 86cdf0e10cSrcweir /// Is used by StmBoundsStatu2 only. 87cdf0e10cSrcweir virtual void PerformStatusFunction( 88cdf0e10cSrcweir uintt i_nStatusSignal, 89cdf0e10cSrcweir UINT16 i_nTokenId, 90cdf0e10cSrcweir CharacterSource & io_rText ) = 0; 91cdf0e10cSrcweir }; 92cdf0e10cSrcweir 93cdf0e10cSrcweir class TkpNullContex2 : public TkpContext 94cdf0e10cSrcweir { 95cdf0e10cSrcweir public: 96cdf0e10cSrcweir ~TkpNullContex2(); 97cdf0e10cSrcweir 98cdf0e10cSrcweir virtual void ReadCharChain( 99cdf0e10cSrcweir CharacterSource & io_rText ); 100cdf0e10cSrcweir virtual bool PassNewToken(); 101cdf0e10cSrcweir virtual TkpContext & 102cdf0e10cSrcweir FollowUpContext(); 103cdf0e10cSrcweir }; 104cdf0e10cSrcweir 105cdf0e10cSrcweir class TkpDocuContext : public TkpContext 106cdf0e10cSrcweir { 107cdf0e10cSrcweir public: 108cdf0e10cSrcweir virtual void SetParentContext( 109cdf0e10cSrcweir TkpContext & io_rParentContext, 110cdf0e10cSrcweir const char * i_sMultiLineEndToken ) = 0; 111cdf0e10cSrcweir virtual void SetMode_IsMultiLine( 112cdf0e10cSrcweir bool i_bTrue ) = 0; 113cdf0e10cSrcweir }; 114cdf0e10cSrcweir 115cdf0e10cSrcweir 116cdf0e10cSrcweir 117cdf0e10cSrcweir #endif 118cdf0e10cSrcweir 119cdf0e10cSrcweir 120