]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_codesigning/lib/RequirementLexer.cpp
Security-58286.260.20.tar.gz
[apple/security.git] / OSX / libsecurity_codesigning / lib / RequirementLexer.cpp
1 /* $ANTLR 2.7.7 (20121221): "requirements.grammar" -> "RequirementLexer.cpp"$ */
2 #include "RequirementLexer.hpp"
3 #include <antlr/CharBuffer.hpp>
4 #include <antlr/TokenStreamException.hpp>
5 #include <antlr/TokenStreamIOException.hpp>
6 #include <antlr/TokenStreamRecognitionException.hpp>
7 #include <antlr/CharStreamException.hpp>
8 #include <antlr/CharStreamIOException.hpp>
9 #include <antlr/NoViableAltForCharException.hpp>
10
11
12 #include "requirement.h"
13 #include "reqmaker.h"
14 #include "csutilities.h"
15 #include <libDER/libDER.h>
16 #include <libDER/asn1Types.h>
17 #include <security_utilities/cfutilities.h>
18 #include <security_utilities/hashing.h>
19 #include <security_cdsa_utilities/cssmdata.h> // OID coding
20 #include <Security/SecCertificate.h>
21 using namespace CodeSigning;
22 typedef Requirement::Maker Maker;
23
24 extern "C" {
25
26 /* Decode a choice of UTCTime or GeneralizedTime to a CFAbsoluteTime. Return
27 an absoluteTime if the date was valid and properly decoded. Return
28 NULL_TIME otherwise. */
29 CFAbsoluteTime SecAbsoluteTimeFromDateContent(DERTag tag, const uint8_t *bytes,
30 size_t length);
31
32 }
33
34
35 ANTLR_BEGIN_NAMESPACE(Security_CodeSigning)
36 RequirementLexer::RequirementLexer(std::istream& in)
37 : antlr::CharScanner(new antlr::CharBuffer(in),true)
38 {
39 initLiterals();
40 }
41
42 RequirementLexer::RequirementLexer(antlr::InputBuffer& ib)
43 : antlr::CharScanner(ib,true)
44 {
45 initLiterals();
46 }
47
48 RequirementLexer::RequirementLexer(const antlr::LexerSharedInputState& state)
49 : antlr::CharScanner(state,true)
50 {
51 initLiterals();
52 }
53
54 void RequirementLexer::initLiterals()
55 {
56 literals["certificate"] = 26;
57 literals["always"] = 15;
58 literals["host"] = 6;
59 literals["guest"] = 5;
60 literals["cdhash"] = 20;
61 literals["entitlement"] = 30;
62 literals["library"] = 8;
63 literals["timestamp"] = 52;
64 literals["never"] = 17;
65 literals["cert"] = 27;
66 literals["plugin"] = 9;
67 literals["absent"] = 32;
68 literals["or"] = 10;
69 literals["leaf"] = 44;
70 literals["info"] = 29;
71 literals["designated"] = 7;
72 literals["apple"] = 24;
73 literals["trusted"] = 28;
74 literals["true"] = 16;
75 literals["notarized"] = 22;
76 literals["and"] = 11;
77 literals["root"] = 45;
78 literals["platform"] = 21;
79 literals["anchor"] = 23;
80 literals["false"] = 18;
81 literals["generic"] = 25;
82 literals["identifier"] = 19;
83 literals["exists"] = 31;
84 }
85
86 antlr::RefToken RequirementLexer::nextToken()
87 {
88 antlr::RefToken theRetToken;
89 for (;;) {
90 antlr::RefToken theRetToken;
91 int _ttype = antlr::Token::INVALID_TYPE;
92 resetText();
93 try { // for lexical and char stream error handling
94 switch ( LA(1)) {
95 case 0x22 /* '\"' */ :
96 {
97 mSTRING(true);
98 theRetToken=_returnToken;
99 break;
100 }
101 case 0x3b /* ';' */ :
102 {
103 mSEMI(true);
104 theRetToken=_returnToken;
105 break;
106 }
107 case 0x28 /* '(' */ :
108 {
109 mLPAREN(true);
110 theRetToken=_returnToken;
111 break;
112 }
113 case 0x29 /* ')' */ :
114 {
115 mRPAREN(true);
116 theRetToken=_returnToken;
117 break;
118 }
119 case 0x5b /* '[' */ :
120 {
121 mLBRACK(true);
122 theRetToken=_returnToken;
123 break;
124 }
125 case 0x5d /* ']' */ :
126 {
127 mRBRACK(true);
128 theRetToken=_returnToken;
129 break;
130 }
131 case 0x2c /* ',' */ :
132 {
133 mCOMMA(true);
134 theRetToken=_returnToken;
135 break;
136 }
137 case 0x7e /* '~' */ :
138 {
139 mSUBS(true);
140 theRetToken=_returnToken;
141 break;
142 }
143 case 0x2d /* '-' */ :
144 {
145 mNEG(true);
146 theRetToken=_returnToken;
147 break;
148 }
149 case 0x21 /* '!' */ :
150 {
151 mNOT(true);
152 theRetToken=_returnToken;
153 break;
154 }
155 case 0x2a /* '*' */ :
156 {
157 mSTAR(true);
158 theRetToken=_returnToken;
159 break;
160 }
161 case 0x9 /* '\t' */ :
162 case 0xa /* '\n' */ :
163 case 0x20 /* ' ' */ :
164 {
165 mWS(true);
166 theRetToken=_returnToken;
167 break;
168 }
169 case 0x23 /* '#' */ :
170 {
171 mSHELLCOMMENT(true);
172 theRetToken=_returnToken;
173 break;
174 }
175 default:
176 if ((LA(1) == 0x2f /* '/' */ ) && (_tokenSet_0.member(LA(2)))) {
177 mPATHNAME(true);
178 theRetToken=_returnToken;
179 }
180 else if ((LA(1) == 0x48 /* 'H' */ ) && (LA(2) == 0x22 /* '\"' */ )) {
181 mHASHCONSTANT(true);
182 theRetToken=_returnToken;
183 }
184 else if ((LA(1) == 0x30 /* '0' */ ) && (LA(2) == 0x78 /* 'x' */ )) {
185 mHEXCONSTANT(true);
186 theRetToken=_returnToken;
187 }
188 else if ((LA(1) == 0x3d /* '=' */ ) && (LA(2) == 0x3e /* '>' */ )) {
189 mARROW(true);
190 theRetToken=_returnToken;
191 }
192 else if ((LA(1) == 0x3c /* '<' */ ) && (LA(2) == 0x3d /* '=' */ )) {
193 mLE(true);
194 theRetToken=_returnToken;
195 }
196 else if ((LA(1) == 0x3e /* '>' */ ) && (LA(2) == 0x3d /* '=' */ )) {
197 mGE(true);
198 theRetToken=_returnToken;
199 }
200 else if ((LA(1) == 0x3d /* '=' */ ) && (LA(2) == 0x3d /* '=' */ )) {
201 mEQQL(true);
202 theRetToken=_returnToken;
203 }
204 else if ((LA(1) == 0x2f /* '/' */ ) && (LA(2) == 0x2a /* '*' */ )) {
205 mC_COMMENT(true);
206 theRetToken=_returnToken;
207 }
208 else if ((LA(1) == 0x2f /* '/' */ ) && (LA(2) == 0x2f /* '/' */ )) {
209 mCPP_COMMENT(true);
210 theRetToken=_returnToken;
211 }
212 else if ((_tokenSet_0.member(LA(1))) && (true)) {
213 mDOTKEY(true);
214 theRetToken=_returnToken;
215 }
216 else if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true)) {
217 mINTEGER(true);
218 theRetToken=_returnToken;
219 }
220 else if ((LA(1) == 0x3c /* '<' */ ) && (true)) {
221 mLESS(true);
222 theRetToken=_returnToken;
223 }
224 else if ((LA(1) == 0x3e /* '>' */ ) && (true)) {
225 mGT(true);
226 theRetToken=_returnToken;
227 }
228 else if ((LA(1) == 0x3d /* '=' */ ) && (true)) {
229 mEQL(true);
230 theRetToken=_returnToken;
231 }
232 else {
233 if (LA(1)==EOF_CHAR)
234 {
235 uponEOF();
236 _returnToken = makeToken(antlr::Token::EOF_TYPE);
237 }
238 else {throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
239 }
240 }
241 if ( !_returnToken )
242 goto tryAgain; // found SKIP token
243
244 _ttype = _returnToken->getType();
245 _returnToken->setType(_ttype);
246 return _returnToken;
247 }
248 catch (antlr::RecognitionException& e) {
249 throw antlr::TokenStreamRecognitionException(e);
250 }
251 catch (antlr::CharStreamIOException& csie) {
252 throw antlr::TokenStreamIOException(csie.io);
253 }
254 catch (antlr::CharStreamException& cse) {
255 throw antlr::TokenStreamException(cse.getMessage());
256 }
257 tryAgain:;
258 }
259 }
260
261 void RequirementLexer::mIDENT(bool _createToken) {
262 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
263 _ttype = IDENT;
264 std::string::size_type _saveIndex;
265
266 {
267 switch ( LA(1)) {
268 case 0x41 /* 'A' */ :
269 case 0x42 /* 'B' */ :
270 case 0x43 /* 'C' */ :
271 case 0x44 /* 'D' */ :
272 case 0x45 /* 'E' */ :
273 case 0x46 /* 'F' */ :
274 case 0x47 /* 'G' */ :
275 case 0x48 /* 'H' */ :
276 case 0x49 /* 'I' */ :
277 case 0x4a /* 'J' */ :
278 case 0x4b /* 'K' */ :
279 case 0x4c /* 'L' */ :
280 case 0x4d /* 'M' */ :
281 case 0x4e /* 'N' */ :
282 case 0x4f /* 'O' */ :
283 case 0x50 /* 'P' */ :
284 case 0x51 /* 'Q' */ :
285 case 0x52 /* 'R' */ :
286 case 0x53 /* 'S' */ :
287 case 0x54 /* 'T' */ :
288 case 0x55 /* 'U' */ :
289 case 0x56 /* 'V' */ :
290 case 0x57 /* 'W' */ :
291 case 0x58 /* 'X' */ :
292 case 0x59 /* 'Y' */ :
293 case 0x5a /* 'Z' */ :
294 {
295 matchRange('A','Z');
296 break;
297 }
298 case 0x61 /* 'a' */ :
299 case 0x62 /* 'b' */ :
300 case 0x63 /* 'c' */ :
301 case 0x64 /* 'd' */ :
302 case 0x65 /* 'e' */ :
303 case 0x66 /* 'f' */ :
304 case 0x67 /* 'g' */ :
305 case 0x68 /* 'h' */ :
306 case 0x69 /* 'i' */ :
307 case 0x6a /* 'j' */ :
308 case 0x6b /* 'k' */ :
309 case 0x6c /* 'l' */ :
310 case 0x6d /* 'm' */ :
311 case 0x6e /* 'n' */ :
312 case 0x6f /* 'o' */ :
313 case 0x70 /* 'p' */ :
314 case 0x71 /* 'q' */ :
315 case 0x72 /* 'r' */ :
316 case 0x73 /* 's' */ :
317 case 0x74 /* 't' */ :
318 case 0x75 /* 'u' */ :
319 case 0x76 /* 'v' */ :
320 case 0x77 /* 'w' */ :
321 case 0x78 /* 'x' */ :
322 case 0x79 /* 'y' */ :
323 case 0x7a /* 'z' */ :
324 {
325 matchRange('a','z');
326 break;
327 }
328 default:
329 {
330 throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
331 }
332 }
333 }
334 { // ( ... )*
335 for (;;) {
336 switch ( LA(1)) {
337 case 0x41 /* 'A' */ :
338 case 0x42 /* 'B' */ :
339 case 0x43 /* 'C' */ :
340 case 0x44 /* 'D' */ :
341 case 0x45 /* 'E' */ :
342 case 0x46 /* 'F' */ :
343 case 0x47 /* 'G' */ :
344 case 0x48 /* 'H' */ :
345 case 0x49 /* 'I' */ :
346 case 0x4a /* 'J' */ :
347 case 0x4b /* 'K' */ :
348 case 0x4c /* 'L' */ :
349 case 0x4d /* 'M' */ :
350 case 0x4e /* 'N' */ :
351 case 0x4f /* 'O' */ :
352 case 0x50 /* 'P' */ :
353 case 0x51 /* 'Q' */ :
354 case 0x52 /* 'R' */ :
355 case 0x53 /* 'S' */ :
356 case 0x54 /* 'T' */ :
357 case 0x55 /* 'U' */ :
358 case 0x56 /* 'V' */ :
359 case 0x57 /* 'W' */ :
360 case 0x58 /* 'X' */ :
361 case 0x59 /* 'Y' */ :
362 case 0x5a /* 'Z' */ :
363 {
364 matchRange('A','Z');
365 break;
366 }
367 case 0x61 /* 'a' */ :
368 case 0x62 /* 'b' */ :
369 case 0x63 /* 'c' */ :
370 case 0x64 /* 'd' */ :
371 case 0x65 /* 'e' */ :
372 case 0x66 /* 'f' */ :
373 case 0x67 /* 'g' */ :
374 case 0x68 /* 'h' */ :
375 case 0x69 /* 'i' */ :
376 case 0x6a /* 'j' */ :
377 case 0x6b /* 'k' */ :
378 case 0x6c /* 'l' */ :
379 case 0x6d /* 'm' */ :
380 case 0x6e /* 'n' */ :
381 case 0x6f /* 'o' */ :
382 case 0x70 /* 'p' */ :
383 case 0x71 /* 'q' */ :
384 case 0x72 /* 'r' */ :
385 case 0x73 /* 's' */ :
386 case 0x74 /* 't' */ :
387 case 0x75 /* 'u' */ :
388 case 0x76 /* 'v' */ :
389 case 0x77 /* 'w' */ :
390 case 0x78 /* 'x' */ :
391 case 0x79 /* 'y' */ :
392 case 0x7a /* 'z' */ :
393 {
394 matchRange('a','z');
395 break;
396 }
397 case 0x30 /* '0' */ :
398 case 0x31 /* '1' */ :
399 case 0x32 /* '2' */ :
400 case 0x33 /* '3' */ :
401 case 0x34 /* '4' */ :
402 case 0x35 /* '5' */ :
403 case 0x36 /* '6' */ :
404 case 0x37 /* '7' */ :
405 case 0x38 /* '8' */ :
406 case 0x39 /* '9' */ :
407 {
408 matchRange('0','9');
409 break;
410 }
411 default:
412 {
413 goto _loop49;
414 }
415 }
416 }
417 _loop49:;
418 } // ( ... )*
419 _ttype = testLiteralsTable(text.substr(_begin, text.length()-_begin),_ttype);
420 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
421 _token = makeToken(_ttype);
422 _token->setText(text.substr(_begin, text.length()-_begin));
423 }
424 _returnToken = _token;
425 _saveIndex=0;
426 }
427
428 void RequirementLexer::mDOTKEY(bool _createToken) {
429 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
430 _ttype = DOTKEY;
431 std::string::size_type _saveIndex;
432
433 mIDENT(false);
434 { // ( ... )*
435 for (;;) {
436 if ((LA(1) == 0x2e /* '.' */ )) {
437 match(".");
438 {
439 switch ( LA(1)) {
440 case 0x41 /* 'A' */ :
441 case 0x42 /* 'B' */ :
442 case 0x43 /* 'C' */ :
443 case 0x44 /* 'D' */ :
444 case 0x45 /* 'E' */ :
445 case 0x46 /* 'F' */ :
446 case 0x47 /* 'G' */ :
447 case 0x48 /* 'H' */ :
448 case 0x49 /* 'I' */ :
449 case 0x4a /* 'J' */ :
450 case 0x4b /* 'K' */ :
451 case 0x4c /* 'L' */ :
452 case 0x4d /* 'M' */ :
453 case 0x4e /* 'N' */ :
454 case 0x4f /* 'O' */ :
455 case 0x50 /* 'P' */ :
456 case 0x51 /* 'Q' */ :
457 case 0x52 /* 'R' */ :
458 case 0x53 /* 'S' */ :
459 case 0x54 /* 'T' */ :
460 case 0x55 /* 'U' */ :
461 case 0x56 /* 'V' */ :
462 case 0x57 /* 'W' */ :
463 case 0x58 /* 'X' */ :
464 case 0x59 /* 'Y' */ :
465 case 0x5a /* 'Z' */ :
466 case 0x61 /* 'a' */ :
467 case 0x62 /* 'b' */ :
468 case 0x63 /* 'c' */ :
469 case 0x64 /* 'd' */ :
470 case 0x65 /* 'e' */ :
471 case 0x66 /* 'f' */ :
472 case 0x67 /* 'g' */ :
473 case 0x68 /* 'h' */ :
474 case 0x69 /* 'i' */ :
475 case 0x6a /* 'j' */ :
476 case 0x6b /* 'k' */ :
477 case 0x6c /* 'l' */ :
478 case 0x6d /* 'm' */ :
479 case 0x6e /* 'n' */ :
480 case 0x6f /* 'o' */ :
481 case 0x70 /* 'p' */ :
482 case 0x71 /* 'q' */ :
483 case 0x72 /* 'r' */ :
484 case 0x73 /* 's' */ :
485 case 0x74 /* 't' */ :
486 case 0x75 /* 'u' */ :
487 case 0x76 /* 'v' */ :
488 case 0x77 /* 'w' */ :
489 case 0x78 /* 'x' */ :
490 case 0x79 /* 'y' */ :
491 case 0x7a /* 'z' */ :
492 {
493 mIDENT(false);
494 break;
495 }
496 case 0x30 /* '0' */ :
497 case 0x31 /* '1' */ :
498 case 0x32 /* '2' */ :
499 case 0x33 /* '3' */ :
500 case 0x34 /* '4' */ :
501 case 0x35 /* '5' */ :
502 case 0x36 /* '6' */ :
503 case 0x37 /* '7' */ :
504 case 0x38 /* '8' */ :
505 case 0x39 /* '9' */ :
506 {
507 mINTEGER(false);
508 break;
509 }
510 default:
511 {
512 throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
513 }
514 }
515 }
516 }
517 else {
518 goto _loop53;
519 }
520
521 }
522 _loop53:;
523 } // ( ... )*
524 _ttype = testLiteralsTable(_ttype);
525 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
526 _token = makeToken(_ttype);
527 _token->setText(text.substr(_begin, text.length()-_begin));
528 }
529 _returnToken = _token;
530 _saveIndex=0;
531 }
532
533 void RequirementLexer::mINTEGER(bool _createToken) {
534 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
535 _ttype = INTEGER;
536 std::string::size_type _saveIndex;
537
538 { // ( ... )+
539 int _cnt71=0;
540 for (;;) {
541 if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
542 matchRange('0','9');
543 }
544 else {
545 if ( _cnt71>=1 ) { goto _loop71; } else {throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
546 }
547
548 _cnt71++;
549 }
550 _loop71:;
551 } // ( ... )+
552 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
553 _token = makeToken(_ttype);
554 _token->setText(text.substr(_begin, text.length()-_begin));
555 }
556 _returnToken = _token;
557 _saveIndex=0;
558 }
559
560 void RequirementLexer::mPATHNAME(bool _createToken) {
561 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
562 _ttype = PATHNAME;
563 std::string::size_type _saveIndex;
564
565 match("/");
566 mIDENT(false);
567 { // ( ... )+
568 int _cnt56=0;
569 for (;;) {
570 if ((LA(1) == 0x2f /* '/' */ )) {
571 match("/");
572 mIDENT(false);
573 }
574 else {
575 if ( _cnt56>=1 ) { goto _loop56; } else {throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
576 }
577
578 _cnt56++;
579 }
580 _loop56:;
581 } // ( ... )+
582 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
583 _token = makeToken(_ttype);
584 _token->setText(text.substr(_begin, text.length()-_begin));
585 }
586 _returnToken = _token;
587 _saveIndex=0;
588 }
589
590 void RequirementLexer::mHASHCONSTANT(bool _createToken) {
591 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
592 _ttype = HASHCONSTANT;
593 std::string::size_type _saveIndex;
594
595 _saveIndex = text.length();
596 match('H' /* charlit */ );
597 text.erase(_saveIndex);
598 _saveIndex = text.length();
599 match('\"' /* charlit */ );
600 text.erase(_saveIndex);
601 { // ( ... )+
602 int _cnt59=0;
603 for (;;) {
604 if ((_tokenSet_1.member(LA(1)))) {
605 mHEX(false);
606 }
607 else {
608 if ( _cnt59>=1 ) { goto _loop59; } else {throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
609 }
610
611 _cnt59++;
612 }
613 _loop59:;
614 } // ( ... )+
615 _saveIndex = text.length();
616 match('\"' /* charlit */ );
617 text.erase(_saveIndex);
618 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
619 _token = makeToken(_ttype);
620 _token->setText(text.substr(_begin, text.length()-_begin));
621 }
622 _returnToken = _token;
623 _saveIndex=0;
624 }
625
626 void RequirementLexer::mHEX(bool _createToken) {
627 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
628 _ttype = HEX;
629 std::string::size_type _saveIndex;
630
631 switch ( LA(1)) {
632 case 0x30 /* '0' */ :
633 case 0x31 /* '1' */ :
634 case 0x32 /* '2' */ :
635 case 0x33 /* '3' */ :
636 case 0x34 /* '4' */ :
637 case 0x35 /* '5' */ :
638 case 0x36 /* '6' */ :
639 case 0x37 /* '7' */ :
640 case 0x38 /* '8' */ :
641 case 0x39 /* '9' */ :
642 {
643 matchRange('0','9');
644 break;
645 }
646 case 0x61 /* 'a' */ :
647 case 0x62 /* 'b' */ :
648 case 0x63 /* 'c' */ :
649 case 0x64 /* 'd' */ :
650 case 0x65 /* 'e' */ :
651 case 0x66 /* 'f' */ :
652 {
653 matchRange('a','f');
654 break;
655 }
656 case 0x41 /* 'A' */ :
657 case 0x42 /* 'B' */ :
658 case 0x43 /* 'C' */ :
659 case 0x44 /* 'D' */ :
660 case 0x45 /* 'E' */ :
661 case 0x46 /* 'F' */ :
662 {
663 matchRange('A','F');
664 break;
665 }
666 default:
667 {
668 throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
669 }
670 }
671 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
672 _token = makeToken(_ttype);
673 _token->setText(text.substr(_begin, text.length()-_begin));
674 }
675 _returnToken = _token;
676 _saveIndex=0;
677 }
678
679 void RequirementLexer::mHEXCONSTANT(bool _createToken) {
680 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
681 _ttype = HEXCONSTANT;
682 std::string::size_type _saveIndex;
683
684 _saveIndex = text.length();
685 match('0' /* charlit */ );
686 text.erase(_saveIndex);
687 _saveIndex = text.length();
688 match('x' /* charlit */ );
689 text.erase(_saveIndex);
690 { // ( ... )+
691 int _cnt62=0;
692 for (;;) {
693 if ((_tokenSet_1.member(LA(1)))) {
694 mHEX(false);
695 }
696 else {
697 if ( _cnt62>=1 ) { goto _loop62; } else {throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
698 }
699
700 _cnt62++;
701 }
702 _loop62:;
703 } // ( ... )+
704 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
705 _token = makeToken(_ttype);
706 _token->setText(text.substr(_begin, text.length()-_begin));
707 }
708 _returnToken = _token;
709 _saveIndex=0;
710 }
711
712 void RequirementLexer::mSTRING(bool _createToken) {
713 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
714 _ttype = STRING;
715 std::string::size_type _saveIndex;
716
717 _saveIndex = text.length();
718 match('\"' /* charlit */ );
719 text.erase(_saveIndex);
720 { // ( ... )*
721 for (;;) {
722 if ((LA(1) == 0x5c /* '\\' */ )) {
723 {
724 _saveIndex = text.length();
725 match('\\' /* charlit */ );
726 text.erase(_saveIndex);
727 match('\"' /* charlit */ );
728 }
729 }
730 else if ((_tokenSet_2.member(LA(1)))) {
731 {
732 {
733 match(_tokenSet_2);
734 }
735 }
736 }
737 else {
738 goto _loop68;
739 }
740
741 }
742 _loop68:;
743 } // ( ... )*
744 _saveIndex = text.length();
745 match('\"' /* charlit */ );
746 text.erase(_saveIndex);
747 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
748 _token = makeToken(_ttype);
749 _token->setText(text.substr(_begin, text.length()-_begin));
750 }
751 _returnToken = _token;
752 _saveIndex=0;
753 }
754
755 void RequirementLexer::mARROW(bool _createToken) {
756 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
757 _ttype = ARROW;
758 std::string::size_type _saveIndex;
759
760 match("=>");
761 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
762 _token = makeToken(_ttype);
763 _token->setText(text.substr(_begin, text.length()-_begin));
764 }
765 _returnToken = _token;
766 _saveIndex=0;
767 }
768
769 void RequirementLexer::mSEMI(bool _createToken) {
770 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
771 _ttype = SEMI;
772 std::string::size_type _saveIndex;
773
774 match(';' /* charlit */ );
775 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
776 _token = makeToken(_ttype);
777 _token->setText(text.substr(_begin, text.length()-_begin));
778 }
779 _returnToken = _token;
780 _saveIndex=0;
781 }
782
783 void RequirementLexer::mLPAREN(bool _createToken) {
784 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
785 _ttype = LPAREN;
786 std::string::size_type _saveIndex;
787
788 match('(' /* charlit */ );
789 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
790 _token = makeToken(_ttype);
791 _token->setText(text.substr(_begin, text.length()-_begin));
792 }
793 _returnToken = _token;
794 _saveIndex=0;
795 }
796
797 void RequirementLexer::mRPAREN(bool _createToken) {
798 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
799 _ttype = RPAREN;
800 std::string::size_type _saveIndex;
801
802 match(')' /* charlit */ );
803 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
804 _token = makeToken(_ttype);
805 _token->setText(text.substr(_begin, text.length()-_begin));
806 }
807 _returnToken = _token;
808 _saveIndex=0;
809 }
810
811 void RequirementLexer::mLBRACK(bool _createToken) {
812 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
813 _ttype = LBRACK;
814 std::string::size_type _saveIndex;
815
816 match('[' /* charlit */ );
817 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
818 _token = makeToken(_ttype);
819 _token->setText(text.substr(_begin, text.length()-_begin));
820 }
821 _returnToken = _token;
822 _saveIndex=0;
823 }
824
825 void RequirementLexer::mRBRACK(bool _createToken) {
826 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
827 _ttype = RBRACK;
828 std::string::size_type _saveIndex;
829
830 match(']' /* charlit */ );
831 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
832 _token = makeToken(_ttype);
833 _token->setText(text.substr(_begin, text.length()-_begin));
834 }
835 _returnToken = _token;
836 _saveIndex=0;
837 }
838
839 void RequirementLexer::mLESS(bool _createToken) {
840 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
841 _ttype = LESS;
842 std::string::size_type _saveIndex;
843
844 match('<' /* charlit */ );
845 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
846 _token = makeToken(_ttype);
847 _token->setText(text.substr(_begin, text.length()-_begin));
848 }
849 _returnToken = _token;
850 _saveIndex=0;
851 }
852
853 void RequirementLexer::mGT(bool _createToken) {
854 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
855 _ttype = GT;
856 std::string::size_type _saveIndex;
857
858 match('>' /* charlit */ );
859 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
860 _token = makeToken(_ttype);
861 _token->setText(text.substr(_begin, text.length()-_begin));
862 }
863 _returnToken = _token;
864 _saveIndex=0;
865 }
866
867 void RequirementLexer::mLE(bool _createToken) {
868 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
869 _ttype = LE;
870 std::string::size_type _saveIndex;
871
872 match("<=");
873 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
874 _token = makeToken(_ttype);
875 _token->setText(text.substr(_begin, text.length()-_begin));
876 }
877 _returnToken = _token;
878 _saveIndex=0;
879 }
880
881 void RequirementLexer::mGE(bool _createToken) {
882 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
883 _ttype = GE;
884 std::string::size_type _saveIndex;
885
886 match(">=");
887 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
888 _token = makeToken(_ttype);
889 _token->setText(text.substr(_begin, text.length()-_begin));
890 }
891 _returnToken = _token;
892 _saveIndex=0;
893 }
894
895 void RequirementLexer::mCOMMA(bool _createToken) {
896 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
897 _ttype = COMMA;
898 std::string::size_type _saveIndex;
899
900 match(',' /* charlit */ );
901 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
902 _token = makeToken(_ttype);
903 _token->setText(text.substr(_begin, text.length()-_begin));
904 }
905 _returnToken = _token;
906 _saveIndex=0;
907 }
908
909 void RequirementLexer::mEQL(bool _createToken) {
910 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
911 _ttype = EQL;
912 std::string::size_type _saveIndex;
913
914 match('=' /* charlit */ );
915 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
916 _token = makeToken(_ttype);
917 _token->setText(text.substr(_begin, text.length()-_begin));
918 }
919 _returnToken = _token;
920 _saveIndex=0;
921 }
922
923 void RequirementLexer::mEQQL(bool _createToken) {
924 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
925 _ttype = EQQL;
926 std::string::size_type _saveIndex;
927
928 match("==");
929 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
930 _token = makeToken(_ttype);
931 _token->setText(text.substr(_begin, text.length()-_begin));
932 }
933 _returnToken = _token;
934 _saveIndex=0;
935 }
936
937 void RequirementLexer::mSUBS(bool _createToken) {
938 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
939 _ttype = SUBS;
940 std::string::size_type _saveIndex;
941
942 match('~' /* charlit */ );
943 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
944 _token = makeToken(_ttype);
945 _token->setText(text.substr(_begin, text.length()-_begin));
946 }
947 _returnToken = _token;
948 _saveIndex=0;
949 }
950
951 void RequirementLexer::mNEG(bool _createToken) {
952 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
953 _ttype = NEG;
954 std::string::size_type _saveIndex;
955
956 match('-' /* charlit */ );
957 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
958 _token = makeToken(_ttype);
959 _token->setText(text.substr(_begin, text.length()-_begin));
960 }
961 _returnToken = _token;
962 _saveIndex=0;
963 }
964
965 void RequirementLexer::mNOT(bool _createToken) {
966 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
967 _ttype = NOT;
968 std::string::size_type _saveIndex;
969
970 match('!' /* charlit */ );
971 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
972 _token = makeToken(_ttype);
973 _token->setText(text.substr(_begin, text.length()-_begin));
974 }
975 _returnToken = _token;
976 _saveIndex=0;
977 }
978
979 void RequirementLexer::mSTAR(bool _createToken) {
980 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
981 _ttype = STAR;
982 std::string::size_type _saveIndex;
983
984 match('*' /* charlit */ );
985 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
986 _token = makeToken(_ttype);
987 _token->setText(text.substr(_begin, text.length()-_begin));
988 }
989 _returnToken = _token;
990 _saveIndex=0;
991 }
992
993 void RequirementLexer::mWS(bool _createToken) {
994 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
995 _ttype = WS;
996 std::string::size_type _saveIndex;
997
998 { // ( ... )+
999 int _cnt92=0;
1000 for (;;) {
1001 switch ( LA(1)) {
1002 case 0x20 /* ' ' */ :
1003 {
1004 match(' ' /* charlit */ );
1005 break;
1006 }
1007 case 0xa /* '\n' */ :
1008 {
1009 match('\n' /* charlit */ );
1010 newline();
1011 break;
1012 }
1013 case 0x9 /* '\t' */ :
1014 {
1015 match('\t' /* charlit */ );
1016 break;
1017 }
1018 default:
1019 {
1020 if ( _cnt92>=1 ) { goto _loop92; } else {throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
1021 }
1022 }
1023 _cnt92++;
1024 }
1025 _loop92:;
1026 } // ( ... )+
1027 _ttype = antlr::Token::SKIP;
1028 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
1029 _token = makeToken(_ttype);
1030 _token->setText(text.substr(_begin, text.length()-_begin));
1031 }
1032 _returnToken = _token;
1033 _saveIndex=0;
1034 }
1035
1036 void RequirementLexer::mSHELLCOMMENT(bool _createToken) {
1037 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
1038 _ttype = SHELLCOMMENT;
1039 std::string::size_type _saveIndex;
1040
1041 match('#' /* charlit */ );
1042 { // ( ... )*
1043 for (;;) {
1044 if ((_tokenSet_3.member(LA(1)))) {
1045 matchNot('\n' /* charlit */ );
1046 }
1047 else {
1048 goto _loop95;
1049 }
1050
1051 }
1052 _loop95:;
1053 } // ( ... )*
1054 _ttype = antlr::Token::SKIP;
1055 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
1056 _token = makeToken(_ttype);
1057 _token->setText(text.substr(_begin, text.length()-_begin));
1058 }
1059 _returnToken = _token;
1060 _saveIndex=0;
1061 }
1062
1063 void RequirementLexer::mC_COMMENT(bool _createToken) {
1064 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
1065 _ttype = C_COMMENT;
1066 std::string::size_type _saveIndex;
1067
1068 match("/*");
1069 { // ( ... )*
1070 for (;;) {
1071 if ((LA(1) == 0x2a /* '*' */ ) && (_tokenSet_4.member(LA(2)))) {
1072 {
1073 match('*' /* charlit */ );
1074 {
1075 matchNot('/' /* charlit */ );
1076 }
1077 }
1078 }
1079 else if ((_tokenSet_5.member(LA(1)))) {
1080 {
1081 matchNot('*' /* charlit */ );
1082 }
1083 }
1084 else {
1085 goto _loop101;
1086 }
1087
1088 }
1089 _loop101:;
1090 } // ( ... )*
1091 match("*/");
1092 _ttype = antlr::Token::SKIP;
1093 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
1094 _token = makeToken(_ttype);
1095 _token->setText(text.substr(_begin, text.length()-_begin));
1096 }
1097 _returnToken = _token;
1098 _saveIndex=0;
1099 }
1100
1101 void RequirementLexer::mCPP_COMMENT(bool _createToken) {
1102 int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length();
1103 _ttype = CPP_COMMENT;
1104 std::string::size_type _saveIndex;
1105
1106 match("//");
1107 { // ( ... )*
1108 for (;;) {
1109 if ((_tokenSet_3.member(LA(1)))) {
1110 matchNot('\n' /* charlit */ );
1111 }
1112 else {
1113 goto _loop104;
1114 }
1115
1116 }
1117 _loop104:;
1118 } // ( ... )*
1119 _ttype = antlr::Token::SKIP;
1120 if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) {
1121 _token = makeToken(_ttype);
1122 _token->setText(text.substr(_begin, text.length()-_begin));
1123 }
1124 _returnToken = _token;
1125 _saveIndex=0;
1126 }
1127
1128
1129 const unsigned long RequirementLexer::_tokenSet_0_data_[] = { 0UL, 0UL, 134217726UL, 134217726UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
1130 const antlr::BitSet RequirementLexer::_tokenSet_0(_tokenSet_0_data_,10);
1131 const unsigned long RequirementLexer::_tokenSet_1_data_[] = { 0UL, 67043328UL, 126UL, 126UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
1132 // 0 1 2 3 4 5 6 7 8 9
1133 const antlr::BitSet RequirementLexer::_tokenSet_1(_tokenSet_1_data_,10);
1134 const unsigned long RequirementLexer::_tokenSet_2_data_[] = { 4294967295UL, 4294967291UL, 4026531839UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967292UL, 2097151UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
1135 // 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10
1136 // 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e
1137 // 0x1f ! # $ % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; <
1138 const antlr::BitSet RequirementLexer::_tokenSet_2(_tokenSet_2_data_,16);
1139 const unsigned long RequirementLexer::_tokenSet_3_data_[] = { 4294966271UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967292UL, 2097151UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
1140 // 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xd 0xe 0xf 0x10 0x11
1141 // 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f
1142 // ! \" # $ % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; <
1143 const antlr::BitSet RequirementLexer::_tokenSet_3(_tokenSet_3_data_,16);
1144 const unsigned long RequirementLexer::_tokenSet_4_data_[] = { 4294967295UL, 4294934527UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967292UL, 2097151UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
1145 // 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10
1146 // 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e
1147 // 0x1f ! \" # $ % & \' ( ) * + , - . 0 1 2 3 4 5 6 7 8 9 : ; <
1148 const antlr::BitSet RequirementLexer::_tokenSet_4(_tokenSet_4_data_,16);
1149 const unsigned long RequirementLexer::_tokenSet_5_data_[] = { 4294967295UL, 4294966271UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967292UL, 2097151UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
1150 // 0x0 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10
1151 // 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e
1152 // 0x1f ! \" # $ % & \' ( ) + , - . / 0 1 2 3 4 5 6 7 8 9 : ; <
1153 const antlr::BitSet RequirementLexer::_tokenSet_5(_tokenSet_5_data_,16);
1154
1155 ANTLR_END_NAMESPACE