Path: blob/main_old/src/compiler/preprocessor/Input.h
1693 views
//1// Copyright 2011 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//56#ifndef COMPILER_PREPROCESSOR_INPUT_H_7#define COMPILER_PREPROCESSOR_INPUT_H_89#include <cstddef>10#include <vector>1112namespace angle13{1415namespace pp16{1718// Holds and reads input for Lexer.19class Input20{21public:22Input();23~Input();24Input(size_t count, const char *const string[], const int length[]);2526size_t count() const { return mCount; }27const char *string(size_t index) const { return mString[index]; }28size_t length(size_t index) const { return mLength[index]; }2930size_t read(char *buf, size_t maxSize, int *lineNo);3132struct Location33{34size_t sIndex; // String index;35size_t cIndex; // Char index.3637Location() : sIndex(0), cIndex(0) {}38};39const Location &readLoc() const { return mReadLoc; }4041private:42// Skip a character and return the next character after the one that was skipped.43// Return nullptr if data runs out.44const char *skipChar();4546// Input.47size_t mCount;48const char *const *mString;49std::vector<size_t> mLength;5051Location mReadLoc;52};5354} // namespace pp5556} // namespace angle5758#endif // COMPILER_PREPROCESSOR_INPUT_H_596061