blob: c5cd7f7d8bb7402f145521ad23625c435e4be0fd [file] [log] [blame]
alokp@chromium.org04d7d222012-05-16 19:24:07 +00001//
2// Copyright (c) 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
Geoff Lang0a73dd82014-11-19 16:18:08 -05007#ifndef COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_
8#define COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_
alokp@chromium.org04d7d222012-05-16 19:24:07 +00009
Corentin Wallez054f7ed2016-09-20 17:15:59 -040010#include "common/angleutils.h"
11#include "compiler/preprocessor/DiagnosticsBase.h"
alokp@chromium.org04d7d222012-05-16 19:24:07 +000012
Geoff Lang197d5292018-04-25 14:29:00 -040013namespace angle
14{
15
alokp@chromium.org04d7d222012-05-16 19:24:07 +000016namespace pp
17{
18
19class Lexer;
20struct Token;
21
Corentin Wallez054f7ed2016-09-20 17:15:59 -040022class ExpressionParser : angle::NonCopyable
alokp@chromium.org04d7d222012-05-16 19:24:07 +000023{
24 public:
Olli Etuaho247374c2015-09-09 15:07:24 +030025 struct ErrorSettings
26 {
27 Diagnostics::ID unexpectedIdentifier;
28 bool integerLiteralsMustFit32BitSignedRange;
29 };
30
Zhenyao Mod526f982014-05-13 14:51:19 -070031 ExpressionParser(Lexer *lexer, Diagnostics *diagnostics);
alokp@chromium.org04d7d222012-05-16 19:24:07 +000032
Olli Etuaho247374c2015-09-09 15:07:24 +030033 bool parse(Token *token,
34 int *result,
35 bool parsePresetToken,
36 const ErrorSettings &errorSettings,
37 bool *valid);
alokp@chromium.org04d7d222012-05-16 19:24:07 +000038
39 private:
Zhenyao Mod526f982014-05-13 14:51:19 -070040 Lexer *mLexer;
41 Diagnostics *mDiagnostics;
alokp@chromium.org04d7d222012-05-16 19:24:07 +000042};
43
44} // namespace pp
Geoff Lang0a73dd82014-11-19 16:18:08 -050045
Geoff Lang197d5292018-04-25 14:29:00 -040046} // namespace angle
47
Geoff Lang0a73dd82014-11-19 16:18:08 -050048#endif // COMPILER_PREPROCESSOR_EXPRESSIONPARSER_H_