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