1// 2// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved. 3// Use of this source code is governed by a BSD-style license that can be 4// found in the LICENSE file. 5// 6 7#ifndef COMPILER_PREPROCESSOR_PREPROCESSOR_H_ 8#define COMPILER_PREPROCESSOR_PREPROCESSOR_H_ 9 10#include <stddef.h> 11 12#include "pp_utils.h" 13 14namespace pp 15{ 16 17class Diagnostics; 18class DirectiveHandler; 19struct PreprocessorImpl; 20struct Token; 21 22class Preprocessor 23{ 24 public: 25 Preprocessor(Diagnostics *diagnostics, DirectiveHandler *directiveHandler); 26 ~Preprocessor(); 27 28 // count: specifies the number of elements in the string and length arrays. 29 // string: specifies an array of pointers to strings. 30 // length: specifies an array of string lengths. 31 // If length is NULL, each string is assumed to be null terminated. 32 // If length is a value other than NULL, it points to an array containing 33 // a string length for each of the corresponding elements of string. 34 // Each element in the length array may contain the length of the 35 // corresponding string or a value less than 0 to indicate that the string 36 // is null terminated. 37 bool init(size_t count, const char * const string[], const int length[]); 38 // Adds a pre-defined macro. 39 void predefineMacro(const char *name, int value); 40 41 void lex(Token *token); 42 43 // Set maximum preprocessor token size 44 void setMaxTokenSize(size_t maxTokenSize); 45 46 private: 47 PP_DISALLOW_COPY_AND_ASSIGN(Preprocessor); 48 49 PreprocessorImpl *mImpl; 50}; 51 52} // namespace pp 53#endif // COMPILER_PREPROCESSOR_PREPROCESSOR_H_ 54 55