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