OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgreScriptLexer.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2011 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __ScriptLexer_H_
30 #define __ScriptLexer_H_
31 
32 #include "OgrePrerequisites.h"
33 #include "OgreSharedPtr.h"
34 #include "OgreDataStream.h"
35 #include "OgreStringConverter.h"
36 
37 
38 namespace Ogre {
39 
50  enum{
51  TID_LBRACKET = 0, // {
53  TID_COLON, // :
54  TID_VARIABLE, // $...
55  TID_WORD, // *
56  TID_QUOTE, // "*"
57  TID_NEWLINE, // \n
60  };
61 
65  struct ScriptToken
66  {
73  };
77 
79  {
80  public:
81  ScriptLexer();
82  virtual ~ScriptLexer() {}
83 
85  ScriptTokenListPtr tokenize(const String &str, const String &source);
86  private: // Private utility operations
87  void setToken(const String &lexeme, uint32 line, const String &source, ScriptTokenList *tokens);
88  bool isWhitespace(Ogre::String::value_type c) const;
89  bool isNewline(Ogre::String::value_type c) const;
90  };
91 
94 }
95 
96 #endif
virtual ~ScriptLexer()
String lexeme
This is the lexeme for this token.
vector< ScriptTokenPtr >::type ScriptTokenList
unsigned int uint32
Definition: OgrePlatform.h:246
#define _OgreExport
Definition: OgrePlatform.h:203
std::vector< T, A > type
uint32 type
This is the id associated with the lexeme, which comes from a lexeme-token id mapping.
This struct represents a token, which is an ID'd lexeme from the parsing input stream.
uint32 line
This holds the line number of the input stream where the token was found.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
SharedPtr< ScriptToken > ScriptTokenPtr
Reference-counted shared pointer, used for objects where implicit destruction is required.
Definition: OgreSharedPtr.h:60
_StringBase String
SharedPtr< ScriptTokenList > ScriptTokenListPtr