Implement the BL_Tokenizing_Machine_Get extension of BL_Tokenizing_Machine (see the 321 class notes).
This component exports the two operations Get_Next_Token and Get_Next_Non_Separator_Token.
Informally, Get_Next_Token
returns in the arguments token_text and token_kind the next
complete token read from the input stream str.
Get_Next_Non_Separator_Token
returns in the arguments token_text and token_kind the next
complete non-white-space and non-comment token read from the input stream
str. To read a single character from the input stream str, you
can use the statement str.Read (ch), where ch is a
Character object. Here is the concrete component
BL_Tokenizing_Machine_Get_1 with the operations whose bodies you need
to fill in.
// /*----------------------------------------------------------------------*\
// | Concrete Template : BL_Tokenizing_Machine_Get_1
// \*----------------------------------------------------------------------*/
#ifndef CT_BL_TOKENIZING_MACHINE_GET_1
#define CT_BL_TOKENIZING_MACHINE_GET_1 1
///------------------------------------------------------------------------
/// Global Context --------------------------------------------------------
///------------------------------------------------------------------------
#include "AI/BL_Tokenizing_Machine/Get.h"
///------------------------------------------------------------------------
/// Interface -------------------------------------------------------------
///------------------------------------------------------------------------
concrete_template <
concrete_instance class BL_Tokenizing_Machine_Base
/*!
implements
abstract_instance BL_Tokenizing_Machine_Kernel
!*/
>
class BL_Tokenizing_Machine_Get_1 :
implements
concrete_instance BL_Tokenizing_Machine_Get,
extends
concrete_instance BL_Tokenizing_Machine_Base
{
public:
procedure_body Get_Next_Token (
alters Character_IStream& str,
produces Text& token_text,
produces Integer& token_kind
)
{
// Students fill this in
}
procedure_body Get_Next_Non_Separator_Token (
alters Character_IStream& str,
produces Text& token_text,
produces Integer& token_kind
)
{
// Students fill this in
}
};
#endif // CT_BL_TOKENIZING_MACHINE_GET_1