Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

RmUtilLexer.h

00001 //=================================================================================================//
00002 // filename: RmUtilLexer.h                                                                     //
00003 //                                                                                                 //
00004 //           ATI Research, Inc.                                                                    //
00005 //           3D Application Research Group                                                         //
00006 //                                                                                                 //
00007 // Description: declaration file for Lexical Analyzer Utility.                                            //
00008 //                                                                                                 //
00009 //=================================================================================================//
00010 //   (C) 2004 ATI Research, Inc.  All rights reserved.                                             //
00011 //=================================================================================================//
00012 
00013 #ifndef _RM_UTILITIES_LEXER_H_
00014 #define _RM_UTILITIES_LEXER_H_
00015 
00016 //...........................................................................
00017 //...........................................................................
00018 //...........................................................................
00019 //
00020 // LexerCallback
00021 //
00022 // - Whenever token or identifier is found, this interface's call back
00023 //   is called so that user can process the text.
00024 //
00025 //...........................................................................
00026 //...........................................................................
00027 //...........................................................................
00028 interface RMUTIL_API IRmUtilLexerCallback
00029 {
00030     virtual void OnKeywordFound( /*[in]*/ const RM_TCHAR *szWord,
00031                                  /*[in]*/ int tokenValue,
00032                                  /*[in]*/ int offset,
00033                                  /*[in]*/ int lineNumber,
00034                                  /*[in]*/ int column ) = 0;
00035     virtual void OnOperatorFound( /*[in]*/ const RM_TCHAR *szWord,
00036                                   /*[in]*/ int tokenValue,
00037                                   /*[in]*/ int offset,
00038                                   /*[in]*/ int lineNumber,
00039                                   /*[in]*/ int column ) = 0;
00040     virtual void OnIdentifierFound( /*[in]*/ const RM_TCHAR *szWord,
00041                                     /*[in]*/ int offset,
00042                                     /*[in]*/ int lineNumber,
00043                                     /*[in]*/ int column ) = 0;
00044     virtual void OnStringFound( /*[in]*/ const RM_TCHAR *szWord,
00045                                 /*[in]*/ int offset,
00046                                 /*[in]*/ int lineNumber,
00047                                 /*[in]*/ int column ) = 0;
00048     virtual void OnIntegerFound( /*[in]*/ int num,
00049                                  /*[in]*/ int offset,
00050                                  /*[in]*/ int lineNumber,
00051                                  /*[in]*/ int column ) = 0;
00052     virtual void OnFloatFound( /*[in]*/ double num,
00053                                /*[in]*/ int offset,
00054                                /*[in]*/ int lineNumber,
00055                                /*[in]*/ int column ) = 0;
00056 }; // End of IRmUtilLexerCallback
00057 
00058 
00059 //...........................................................................
00060 //...........................................................................
00061 //...........................................................................
00062 //
00063 // Lexical Analyzer Interface
00064 //
00065 //...........................................................................
00066 //...........................................................................
00067 //...........................................................................
00068 class RMUTIL_API IRmUtilLexer 
00069 {
00070 public :
00071    //--------------------------------------------------------------------------
00072    // static Create/Destroy Function
00073    //--------------------------------------------------------------------------
00074    static IRmUtilLexer* CreateLexer();
00075    static void DestroyLexer( /*[in,out]*/ IRmUtilLexer* &pLexer );
00076 
00077    //--------------------------------------------------------------------------
00078    // Callback
00079    //--------------------------------------------------------------------------
00080    virtual void                        SetCallback( /*[in]*/ IRmUtilLexerCallback* pCallback ) = 0;
00081    virtual IRmUtilLexerCallback*       GetCallback() = 0;
00082    virtual const IRmUtilLexerCallback* GetCallback() const = 0;
00083 
00084    //--------------------------------------------------------------------------
00085    // Begin/End of Language Defining
00086    //
00087    // - All AddKeyword/Operators, Comments etc should be inside this Begin/End
00088    //--------------------------------------------------------------------------
00089    virtual void BeginLaunguageDefinition() = 0;
00090    virtual void EndLaunguageDefinition() = 0;
00091 
00092    //--------------------------------------------------------------------------
00093    // Adding Keywords/Operators
00094    //--------------------------------------------------------------------------
00095    virtual void AddKeyword( /*[in]*/ const RM_TCHAR* szWord, 
00096                             /*[in]*/ int tokenValue,
00097                             /*[in]*/ bool bCaseSensitive = true ) = 0;
00098    virtual void AddOperator( /*[in]*/ const RM_TCHAR* szWord, /*[in]*/ int tokenValue ) = 0;
00099 
00100    //--------------------------------------------------------------------------
00101    // Adding Comments
00102    //--------------------------------------------------------------------------
00103    virtual void AddComment( /*[in]*/ const RM_TCHAR* szBeginComment, 
00104                             /*[in]*/ const RM_TCHAR* szEndComment ) = 0;
00105 
00106    //--------------------------------------------------------------------------
00107    // Set Word Delimeters ( sets of characters that split terminate word )
00108    //--------------------------------------------------------------------------
00109    virtual void SetWordDelimeters( /*[in]*/ const RM_TCHAR* szDelims ) = 0;
00110 
00111    //--------------------------------------------------------------------------
00112    // Parse
00113    //--------------------------------------------------------------------------
00114    virtual void Parse( /*[in]*/ const RM_TCHAR *szText ) = 0;
00115 }; // End of IRmUtilLLexer
00116 
00117 
00118 #endif

Generated on Fri Feb 25 16:08:42 2005 for RenderMonkey SDK by doxygen 1.3.6