True Axis Physics SDK 1.2.0.1 Beta Documentation
www.trueaxis.com

Lex.h

00001 //---------------------------------------------------------------------------------
00002 // File Name: Lex.h
00003 // Description: Lexical analysis for parsing text.
00004 //
00005 // Copyright (C) 2004 True Axis Pty Ltd, Australia. 
00006 // All Rights Reserved.
00007 //
00008 // History:
00009 //      Created File.
00010 //---------------------------------------------------------------------------------
00011 
00012 #ifndef TA_LEX_H
00013 #define TA_LEX_H
00014 
00015 #ifndef TA_TYPES_H
00016 #include "Types.h"
00017 #endif // TA_TYPES_H
00018 
00019 #ifndef TA_COMMON_H
00020 #include "Common.h"
00021 #endif // TA_COMMON_H
00022 
00023 namespace TA
00024 {
00025 
00026 class TACOMMON_CLASS Lex
00027 {
00028 public:
00029     enum TokenType
00030     {
00031         TOKEN_TYPE_END_OF_FILE = 0,
00032         TOKEN_TYPE_NUMBER,
00033         TOKEN_TYPE_ALPHA,
00034         TOKEN_TYPE_SYMBOL,
00035     };
00036 
00037     Lex();
00038     ~Lex();
00039 
00040     void Initialise(const Char* szString);
00041     void Finalise();
00042     
00043     TokenType GetTokenType();
00044     float GetTokenAsFloat();
00045     const Char* GetTokenAsString();
00046     int GetTokenLength();
00047     void Advance();
00048     int GetTotalLength();
00049 
00050 private:
00051     Char* m_szString;
00052     TokenType m_eTokenType;
00053     const Char* m_szToken;
00054     static Char* m_szEmptyString;
00055     Char* m_szCurrentPos;
00056     int m_nTokenLength;
00057     int m_nTotalLength;
00058 };
00059 
00060 };
00061 
00062 #endif // TA_LEX_H


© Copyright 2004-2006 TRUE AXIS PTY LTD Australia. All rights reserved.