Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre_src_v1-9-0/OgreMain/include/OgreScriptLexer.h @ 148

Last change on this file since 148 was 148, checked in by patricwi, 6 years ago

Added new dependencies for ogre1.9 and cegui0.8

File size: 3.1 KB
Line 
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-2013 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
40        /** \addtogroup Core
41        *  @{
42        */
43        /** \addtogroup General
44        *  @{
45        */
46        /** These codes represent token IDs which are numerical translations of
47                specific lexemes. Specific compilers using the lexer can register their
48                own token IDs which are given precedence over these built-in ones.
49        */
50        enum{
51                TID_LBRACKET = 0, // {
52                TID_RBRACKET, // }
53                TID_COLON, // :
54                TID_VARIABLE, // $...
55                TID_WORD, // *
56                TID_QUOTE, // "*"
57                TID_NEWLINE, // \n
58                TID_UNKNOWN,
59                TID_END
60        };
61
62        /** This struct represents a token, which is an ID'd lexeme from the
63                parsing input stream.
64        */
65        struct ScriptToken
66        {
67                /// This is the lexeme for this token
68                String lexeme, file;
69                /// This is the id associated with the lexeme, which comes from a lexeme-token id mapping
70                uint32 type;
71                /// This holds the line number of the input stream where the token was found.
72                uint32 line;
73        };
74        typedef SharedPtr<ScriptToken> ScriptTokenPtr;
75        typedef vector<ScriptTokenPtr>::type ScriptTokenList;
76        typedef SharedPtr<ScriptTokenList> ScriptTokenListPtr;
77
78        class _OgreExport ScriptLexer : public ScriptCompilerAlloc
79        {
80        public:
81                ScriptLexer();
82                virtual ~ScriptLexer() {}
83
84                /** Tokenizes the given input and returns the list of tokens found */
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
92        /** @} */
93        /** @} */
94}
95
96#include "OgreHeaderSuffix.h"
97
98#endif
Note: See TracBrowser for help on using the repository browser.