OSDN Git Service

Increment the version number.
[android-x86/external-swiftshader.git] / src / Radiance / compiler / preprocessor / Tokenizer.h
1 //\r
2 // Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.\r
3 // Use of this source code is governed by a BSD-style license that can be\r
4 // found in the LICENSE file.\r
5 //\r
6 \r
7 #ifndef COMPILER_PREPROCESSOR_TOKENIZER_H_\r
8 #define COMPILER_PREPROCESSOR_TOKENIZER_H_\r
9 \r
10 #include "Input.h"\r
11 #include "Lexer.h"\r
12 #include "pp_utils.h"\r
13 \r
14 #include <algorithm>\r
15 \r
16 namespace pp\r
17 {\r
18 \r
19 class Diagnostics;\r
20 \r
21 class Tokenizer : public Lexer\r
22 {\r
23   public:\r
24     struct Context\r
25     {\r
26         Diagnostics* diagnostics;\r
27 \r
28         Input input;\r
29         // The location where yytext points to. Token location should track\r
30         // scanLoc instead of Input::mReadLoc because they may not be the same\r
31         // if text is buffered up in the scanner input buffer.\r
32         Input::Location scanLoc;\r
33 \r
34         bool leadingSpace;\r
35         bool lineStart;\r
36     };\r
37     static const size_t kMaxTokenLength;\r
38 \r
39     Tokenizer(Diagnostics* diagnostics);\r
40     ~Tokenizer();\r
41 \r
42     bool init(int count, const char* const string[], const int length[]);\r
43 \r
44     void setFileNumber(int file);\r
45     void setLineNumber(int line);\r
46 \r
47     virtual void lex(Token* token);\r
48 \r
49   private:\r
50     PP_DISALLOW_COPY_AND_ASSIGN(Tokenizer);\r
51     bool initScanner();\r
52     void destroyScanner();\r
53 \r
54     void* mHandle;  // Scanner handle.\r
55     Context mContext;  // Scanner extra.\r
56 };\r
57 \r
58 }  // namespace pp\r
59 #endif  // COMPILER_PREPROCESSOR_TOKENIZER_H_\r
60 \r