Path: blob/main_old/src/compiler/preprocessor/Tokenizer.h
1693 views
//1// Copyright 2012 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_TOKENIZER_H_7#define COMPILER_PREPROCESSOR_TOKENIZER_H_89#include "common/angleutils.h"10#include "compiler/preprocessor/Input.h"11#include "compiler/preprocessor/Lexer.h"1213namespace angle14{1516namespace pp17{1819class Diagnostics;2021class Tokenizer : public Lexer22{23public:24struct Context25{26Diagnostics *diagnostics;2728Input input;29// The location where yytext points to. Token location should track30// scanLoc instead of Input::mReadLoc because they may not be the same31// if text is buffered up in the scanner input buffer.32Input::Location scanLoc;3334bool leadingSpace;35bool lineStart;36};3738Tokenizer(Diagnostics *diagnostics);39~Tokenizer() override;4041bool init(size_t count, const char *const string[], const int length[]);4243void setFileNumber(int file);44void setLineNumber(int line);45void setMaxTokenSize(size_t maxTokenSize);4647void lex(Token *token) override;4849private:50bool initScanner();51void destroyScanner();5253void *mHandle; // Scanner handle.54Context mContext; // Scanner extra.55size_t mMaxTokenSize; // Maximum token size56};5758} // namespace pp5960} // namespace angle6162#endif // COMPILER_PREPROCESSOR_TOKENIZER_H_636465