OGRE  1.9.0
OgreScriptLexer.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE 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#include "OgreHeaderPrefix.h"
37
38namespace Ogre {
39
50 enum{
51 TID_LBRACKET = 0, // {
54 TID_VARIABLE, // $...
56 TID_QUOTE, // "*"
60 };
61
66 {
73 };
77
79 {
80 public:
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#include "OgreHeaderSuffix.h"
97
98#endif
#define _OgreExport
Definition: OgrePlatform.h:260
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
virtual ~ScriptLexer()
bool isNewline(Ogre::String::value_type c) const
bool isWhitespace(Ogre::String::value_type c) const
void setToken(const String &lexeme, uint32 line, const String &source, ScriptTokenList *tokens)
ScriptTokenListPtr tokenize(const String &str, const String &source)
Tokenizes the given input and returns the list of tokens found.
Reference-counted shared pointer, used for objects where implicit destruction is required.
SharedPtr< ScriptToken > ScriptTokenPtr
SharedPtr< ScriptTokenList > ScriptTokenListPtr
vector< ScriptTokenPtr >::type ScriptTokenList
@ TID_VARIABLE
@ TID_NEWLINE
@ TID_RBRACKET
@ TID_UNKNOWN
@ TID_LBRACKET
unsigned int uint32
Definition: OgrePlatform.h:344
_StringBase String
This struct represents a token, which is an ID'd lexeme from the parsing input stream.
uint32 type
This is the id associated with the lexeme, which comes from a lexeme-token id mapping.
uint32 line
This holds the line number of the input stream where the token was found.
String lexeme
This is the lexeme for this token.
std::vector< T, A > type