1 // 2 // Copyright 2012 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_EXPRESSIONPARSER_H_ 8 #define COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_ 9 10 #include "common/angleutils.h" 11 #include "compiler/preprocessor/DiagnosticsBase.h" 12 13 namespace angle 14 { 15 16 namespace pp 17 { 18 19 class Lexer; 20 struct Token; 21 22 class ExpressionParser : angle::NonCopyable 23 { 24 public: 25 struct ErrorSettings 26 { 27 Diagnostics::ID unexpectedIdentifier; 28 bool integerLiteralsMustFit32BitSignedRange; 29 }; 30 31 ExpressionParser(Lexer *lexer, Diagnostics *diagnostics); 32 33 bool parse(Token *token, 34 int *result, 35 bool parsePresetToken, 36 const ErrorSettings &errorSettings, 37 bool *valid); 38 39 private: 40 Lexer *mLexer; 41 Diagnostics *mDiagnostics; 42 }; 43 44 } // namespace pp 45 46 } // namespace angle 47 48 #endif // COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_ 49