PageRenderTime 16ms CodeModel.GetById 9ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/xbmc/visualizations/Vortex/angelscript/angelscript/source/as_tokenizer.h

http://github.com/xbmc/xbmc
C++ Header | 75 lines | 25 code | 16 blank | 34 comment | 0 complexity | 2f75bde83cb8330be75c35156a4aaaa1 MD5 | raw file
 1/*
 2   AngelCode Scripting Library
 3   Copyright (c) 2003-2008 Andreas Jonsson
 4
 5   This software is provided 'as-is', without any express or implied 
 6   warranty. In no event will the authors be held liable for any 
 7   damages arising from the use of this software.
 8
 9   Permission is granted to anyone to use this software for any 
10   purpose, including commercial applications, and to alter it and 
11   redistribute it freely, subject to the following restrictions:
12
13   1. The origin of this software must not be misrepresented; you 
14      must not claim that you wrote the original software. If you use
15      this software in a product, an acknowledgment in the product 
16      documentation would be appreciated but is not required.
17
18   2. Altered source versions must be plainly marked as such, and 
19      must not be misrepresented as being the original software.
20
21   3. This notice may not be removed or altered from any source 
22      distribution.
23
24   The original version of this library can be located at:
25   http://www.angelcode.com/angelscript/
26
27   Andreas Jonsson
28   andreas@angelcode.com
29*/
30
31
32//
33// as_tokenizer.cpp
34//
35// This class identifies tokens from the script code
36//
37
38
39
40#ifndef AS_TOKENIZER_H
41#define AS_TOKENIZER_H
42
43#include "as_tokendef.h"
44
45BEGIN_AS_NAMESPACE
46
47const char *asGetTokenDefinition(int tokenType);
48
49class asCTokenizer
50{
51public:
52	asCTokenizer();
53	~asCTokenizer();
54
55	eTokenType GetToken(const char *source, size_t sourceLength, size_t *tokenLength, asETokenClass *tc = 0);
56
57protected:
58	asETokenClass ParseToken();
59	bool IsWhiteSpace();
60	bool IsComment();
61	bool IsConstant();
62	bool IsKeyWord();
63	bool IsIdentifier();
64
65	const char *source;
66	size_t sourceLength;
67
68	eTokenType tokenType;
69	size_t tokenLength;
70};
71
72END_AS_NAMESPACE
73
74#endif
75