1 #ifndef EXPRESSION_HPP
2 #define EXPRESSION_HPP
3 #include <sngcpp/parser/ParserApi.hpp>
4 #include <sngcpp/ast/Expression.hpp>
5 #include <sngcpp/parser/ParsingContext.hpp>
6 #include <soulng/lexer/Token.hpp>
7 #include <soulng/parser/Match.hpp>
8 #include <soulng/parser/Value.hpp>
9
10
11
12 class CppLexer;
13
14 struct ExpressionParser
15 {
16 static std::unique_ptr<sngcpp::ast::Node> Parse(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
17 static soulng::parser::Match Expression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
18 static soulng::parser::Match ConstantExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
19 static soulng::parser::Match AssignmentExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
20 static soulng::parser::Match AssignmentOperator(CppLexer& lexer);
21 static soulng::parser::Match ConditionalExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
22 static soulng::parser::Match ThrowExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
23 static soulng::parser::Match LogicalOrExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
24 static soulng::parser::Match LogicalAndExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
25 static soulng::parser::Match InclusiveOrExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
26 static soulng::parser::Match ExclusiveOrExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
27 static soulng::parser::Match AndExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
28 static soulng::parser::Match EqualityExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
29 static soulng::parser::Match EqualityOperator(CppLexer& lexer);
30 static soulng::parser::Match RelationalExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
31 static soulng::parser::Match RelationalOperator(CppLexer& lexer);
32 static soulng::parser::Match ShiftExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
33 static soulng::parser::Match ShiftOperator(CppLexer& lexer);
34 static soulng::parser::Match AdditiveExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
35 static soulng::parser::Match AdditiveOperator(CppLexer& lexer);
36 static soulng::parser::Match MultiplicativeExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
37 static soulng::parser::Match MultiplicativeOperator(CppLexer& lexer);
38 static soulng::parser::Match PMExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
39 static soulng::parser::Match PMOperator(CppLexer& lexer);
40 static soulng::parser::Match CastExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
41 static soulng::parser::Match UnaryExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
42 static soulng::parser::Match UnaryOperator(CppLexer& lexer);
43 static soulng::parser::Match NewExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
44 static soulng::parser::Match NewPlacement(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
45 static soulng::parser::Match NewInitializer(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
46 static soulng::parser::Match ExpressionList(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
47 static soulng::parser::Match ArgumentList(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
48 static soulng::parser::Match DeleteExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
49 static soulng::parser::Match PostfixExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
50 static soulng::parser::Match PrimaryExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
51 static soulng::parser::Match CppCastExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
52 static soulng::parser::Match TypeIdExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
53 static soulng::parser::Match IdExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
54 static soulng::parser::Match UnqualifiedId(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
55 static soulng::parser::Match QualifiedId(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
56 static soulng::parser::Match OperatorFunctionId(CppLexer& lexer);
57 static soulng::parser::Match Operator(CppLexer& lexer);
58 static soulng::parser::Match ConversionFunctionId(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
59 static soulng::parser::Match LambdaExpression(CppLexer& lexer, sngcpp::cppparser::ParsingContext* ctx);
60 static soulng::parser::Match LambdaCaptures(CppLexer& lexer, sngcpp::ast::LambdaExpressionNode* lambdaExpression);
61 static soulng::parser::Match CaptureDefault(CppLexer& lexer);
62 static soulng::parser::Match Captures(CppLexer& lexer, sngcpp::ast::LambdaExpressionNode* lambdaExpression);
63 static soulng::parser::Match Capture(CppLexer& lexer);
64 };
65
66 #endif // EXPRESSION_HPP