]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_codesigning/lib/RequirementParser.hpp
Security-58286.200.222.tar.gz
[apple/security.git] / OSX / libsecurity_codesigning / lib / RequirementParser.hpp
1 #ifndef INC_RequirementParser_hpp_
2 #define INC_RequirementParser_hpp_
3
4 #include <antlr/config.hpp>
5 /* $ANTLR 2.7.7 (20121221): "requirements.grammar" -> "RequirementParser.hpp"$ */
6 #include <antlr/TokenStream.hpp>
7 #include <antlr/TokenBuffer.hpp>
8 #include "RequirementParserTokenTypes.hpp"
9 #include <antlr/LLkParser.hpp>
10
11
12 #include "requirement.h"
13 using namespace CodeSigning;
14 typedef Requirement::Maker Maker;
15
16 ANTLR_BEGIN_NAMESPACE(Security_CodeSigning)
17 class CUSTOM_API RequirementParser : public antlr::LLkParser, public RequirementParserTokenTypes
18 {
19
20 public:
21 std::string errors;
22 void reportError(const antlr::RecognitionException &ex);
23 void reportError(const std::string &s);
24
25 private:
26 static string hexString(const string &s);
27 static void hashString(const string &s, SHA1::Digest hash);
28 void certMatchOperation(Maker &maker, int32_t slot, string key);
29 public:
30 void initializeASTFactory( antlr::ASTFactory& factory );
31 protected:
32 RequirementParser(antlr::TokenBuffer& tokenBuf, int k);
33 public:
34 RequirementParser(antlr::TokenBuffer& tokenBuf);
35 protected:
36 RequirementParser(antlr::TokenStream& lexer, int k);
37 public:
38 RequirementParser(antlr::TokenStream& lexer);
39 RequirementParser(const antlr::ParserSharedInputState& state);
40 int getNumTokens() const
41 {
42 return RequirementParser::NUM_TOKENS;
43 }
44 const char* getTokenName( int type ) const
45 {
46 if( type > getNumTokens() ) return 0;
47 return RequirementParser::tokenNames[type];
48 }
49 const char* const* getTokenNames() const
50 {
51 return RequirementParser::tokenNames;
52 }
53 public: BlobCore * autosense();
54 public: Requirement * requirement();
55 public: Requirements * requirementSet();
56 public: uint32_t requirementType();
57 public: Requirement * requirementElement();
58 public: int32_t integer();
59 public: void expr(
60 Maker &maker
61 );
62 public: void fluff();
63 public: void term(
64 Maker &maker
65 );
66 public: void primary(
67 Maker &maker
68 );
69 public: void certspec(
70 Maker &maker
71 );
72 public: void infospec(
73 Maker &maker
74 );
75 public: void entitlementspec(
76 Maker &maker
77 );
78 public: void eql();
79 public: string identifierString();
80 public: void hash(
81 SHA1::Digest digest
82 );
83 public: void appleanchor(
84 Maker &maker
85 );
86 public: int32_t certSlot();
87 public: void certslotspec(
88 Maker &maker, int32_t slot
89 );
90 public: void empty();
91 public: void certificateDigest(
92 SHA1::Digest digest
93 );
94 public: string bracketKey();
95 public: void match_suffix(
96 Maker &maker
97 );
98 public: string datavalue();
99 public: string stringvalue();
100 public: string pathstring();
101 public:
102 antlr::RefAST getAST()
103 {
104 return returnAST;
105 }
106
107 protected:
108 antlr::RefAST returnAST;
109 private:
110 static const char* tokenNames[];
111 #ifndef NO_STATIC_CONSTS
112 static const int NUM_TOKENS = 59;
113 #else
114 enum {
115 NUM_TOKENS = 59
116 };
117 #endif
118
119 static const unsigned long _tokenSet_0_data_[];
120 static const antlr::BitSet _tokenSet_0;
121 static const unsigned long _tokenSet_1_data_[];
122 static const antlr::BitSet _tokenSet_1;
123 static const unsigned long _tokenSet_2_data_[];
124 static const antlr::BitSet _tokenSet_2;
125 static const unsigned long _tokenSet_3_data_[];
126 static const antlr::BitSet _tokenSet_3;
127 static const unsigned long _tokenSet_4_data_[];
128 static const antlr::BitSet _tokenSet_4;
129 static const unsigned long _tokenSet_5_data_[];
130 static const antlr::BitSet _tokenSet_5;
131 static const unsigned long _tokenSet_6_data_[];
132 static const antlr::BitSet _tokenSet_6;
133 static const unsigned long _tokenSet_7_data_[];
134 static const antlr::BitSet _tokenSet_7;
135 static const unsigned long _tokenSet_8_data_[];
136 static const antlr::BitSet _tokenSet_8;
137 static const unsigned long _tokenSet_9_data_[];
138 static const antlr::BitSet _tokenSet_9;
139 static const unsigned long _tokenSet_10_data_[];
140 static const antlr::BitSet _tokenSet_10;
141 static const unsigned long _tokenSet_11_data_[];
142 static const antlr::BitSet _tokenSet_11;
143 static const unsigned long _tokenSet_12_data_[];
144 static const antlr::BitSet _tokenSet_12;
145 static const unsigned long _tokenSet_13_data_[];
146 static const antlr::BitSet _tokenSet_13;
147 static const unsigned long _tokenSet_14_data_[];
148 static const antlr::BitSet _tokenSet_14;
149 static const unsigned long _tokenSet_15_data_[];
150 static const antlr::BitSet _tokenSet_15;
151 static const unsigned long _tokenSet_16_data_[];
152 static const antlr::BitSet _tokenSet_16;
153 static const unsigned long _tokenSet_17_data_[];
154 static const antlr::BitSet _tokenSet_17;
155 };
156
157 ANTLR_END_NAMESPACE
158 #endif /*INC_RequirementParser_hpp_*/