1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/compiler/preprocessor/Input.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +// 1.5 +// Copyright (c) 2011 The ANGLE Project Authors. All rights reserved. 1.6 +// Use of this source code is governed by a BSD-style license that can be 1.7 +// found in the LICENSE file. 1.8 +// 1.9 + 1.10 +#ifndef COMPILER_PREPROCESSOR_INPUT_H_ 1.11 +#define COMPILER_PREPROCESSOR_INPUT_H_ 1.12 + 1.13 +#include <stddef.h> 1.14 +#include <vector> 1.15 + 1.16 +namespace pp 1.17 +{ 1.18 + 1.19 +// Holds and reads input for Lexer. 1.20 +class Input 1.21 +{ 1.22 + public: 1.23 + Input(); 1.24 + Input(size_t count, const char* const string[], const int length[]); 1.25 + 1.26 + size_t count() const { return mCount; } 1.27 + const char* string(size_t index) const { return mString[index]; } 1.28 + size_t length(size_t index) const { return mLength[index]; } 1.29 + 1.30 + size_t read(char* buf, size_t maxSize); 1.31 + 1.32 + struct Location 1.33 + { 1.34 + size_t sIndex; // String index; 1.35 + size_t cIndex; // Char index. 1.36 + 1.37 + Location() : sIndex(0), cIndex(0) { } 1.38 + }; 1.39 + const Location& readLoc() const { return mReadLoc; } 1.40 + 1.41 + private: 1.42 + // Input. 1.43 + size_t mCount; 1.44 + const char* const* mString; 1.45 + std::vector<size_t> mLength; 1.46 + 1.47 + Location mReadLoc; 1.48 +}; 1.49 + 1.50 +} // namespace pp 1.51 +#endif // COMPILER_PREPROCESSOR_INPUT_H_ 1.52 +