1 // =================================
 2 // Copyright (c) 2021 Seppo Laakko
 3 // Distributed under the MIT license
 4 // =================================
 5 
 6 [hpp]#include <sngcm/cmparser/ParserApi.hpp>
 7 [hpp]#include <sngcm/ast/Specifier.hpp>
 8 [cpp]#include <sngcm/cmlexer/CmajorLexer.hpp>
 9 [cpp]#include <sngcm/cmlexer/CmajorTokens.hpp>
10 
11 using namespace CmajorTokens;
12 
13 parser api(SNGCM_PARSER_API) SpecifierParser
14 {
15     uselexer CmajorLexer;
16 
17     Specifiers(var sngcm::ast::Specifiers specifiers) : sngcm::ast::Specifiers
18         ::= ((Specifier:specifier{ specifiers = specifiers | specifier; })*){ return specifiers; }
19         ;
20 
21     Specifier : sngcm::ast::Specifiers
22         ::= PUBLIC{ return sngcm::ast::Specifiers::public_; }
23         |   PROTECTED{ return sngcm::ast::Specifiers::protected_; }
24         |   PRIVATE{ return sngcm::ast::Specifiers::private_; }
25         |   INTERNAL{ return sngcm::ast::Specifiers::internal_; }
26         |   STATIC{ return sngcm::ast::Specifiers::static_; }
27         |   VIRTUAL{ return sngcm::ast::Specifiers::virtual_; }
28         |   OVERRIDE{ return sngcm::ast::Specifiers::override_; }
29         |   ABSTRACT{ return sngcm::ast::Specifiers::abstract_; }
30         |   INLINE{ return sngcm::ast::Specifiers::inline_; }
31         |   EXPLICIT{ return sngcm::ast::Specifiers::explicit_; }
32         |   EXTERN{ return sngcm::ast::Specifiers::external_; }
33         |   SUPPRESS{ return sngcm::ast::Specifiers::suppress_; }
34         |   DEFAULT{ return sngcm::ast::Specifiers::default_; }
35         |   CONSTEXPR{ return sngcm::ast::Specifiers::constexpr_; }
36         |   CDECL{ return sngcm::ast::Specifiers::cdecl_; }
37         |   NOTHROW{ return sngcm::ast::Specifiers::nothrow_; }
38         |   THROW{ return sngcm::ast::Specifiers::throw_; }
39         |   NEW{ return sngcm::ast::Specifiers::new_; }
40         |   UNIT_TEST{ return sngcm::ast::Specifiers::unit_test_; }
41         |   WINAPI{ return sngcm::ast::Specifiers::winapi; }
42         ;
43 
44     ruleinfo
45     {
46         (Specifiers, "specifiers"), (Specifier, "specifier")
47     }
48 }