001// $ANTLR 2.7.7 (20060906): "TriggerSpecification.g" -> "AntlrTriggerSpecificationLexer.java"$ 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * https://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 * 021 */ 022 023 024package org.apache.directory.api.ldap.trigger; 025 026import java.util.ArrayList; 027import java.util.List; 028 029import org.apache.directory.api.i18n.I18n; 030import org.apache.directory.api.ldap.model.name.Dn; 031import org.apache.directory.api.ldap.model.schema.NormalizerMappingResolver; 032import org.apache.directory.api.ldap.trigger.StoredProcedureOption; 033import org.apache.directory.api.ldap.trigger.StoredProcedureParameter; 034import org.apache.directory.api.ldap.trigger.TriggerSpecification.SPSpec; 035import org.apache.directory.api.ldap.model.message.SearchScope; 036 037import org.slf4j.Logger; 038import org.slf4j.LoggerFactory; 039 040 041import java.io.InputStream; 042import antlr.TokenStreamException; 043import antlr.TokenStreamIOException; 044import antlr.TokenStreamRecognitionException; 045import antlr.CharStreamException; 046import antlr.CharStreamIOException; 047import antlr.ANTLRException; 048import java.io.Reader; 049import java.util.Hashtable; 050import antlr.CharScanner; 051import antlr.InputBuffer; 052import antlr.ByteBuffer; 053import antlr.CharBuffer; 054import antlr.Token; 055import antlr.CommonToken; 056import antlr.RecognitionException; 057import antlr.NoViableAltForCharException; 058import antlr.MismatchedCharException; 059import antlr.TokenStream; 060import antlr.ANTLRHashString; 061import antlr.LexerSharedInputState; 062import antlr.collections.impl.BitSet; 063import antlr.SemanticException; 064 065/** 066 * The parser's primary lexer. 067 * 068 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 069 */ 070public class AntlrTriggerSpecificationLexer extends antlr.CharScanner implements AntlrTriggerSpecificationParserTokenTypes, TokenStream 071 { 072 073 private static final Logger log = LoggerFactory.getLogger( AntlrTriggerSpecificationLexer.class ); 074public AntlrTriggerSpecificationLexer(InputStream in) { 075 this(new ByteBuffer(in)); 076} 077public AntlrTriggerSpecificationLexer(Reader in) { 078 this(new CharBuffer(in)); 079} 080public AntlrTriggerSpecificationLexer(InputBuffer ib) { 081 this(new LexerSharedInputState(ib)); 082} 083public AntlrTriggerSpecificationLexer(LexerSharedInputState state) { 084 super(state); 085 caseSensitiveLiterals = false; 086 setCaseSensitive(false); 087 literals = new Hashtable(); 088 literals.put(new ANTLRHashString("after", this), new Integer(5)); 089 literals.put(new ANTLRHashString("scope", this), new Integer(40)); 090 literals.put(new ANTLRHashString("rename", this), new Integer(14)); 091 literals.put(new ANTLRHashString("$deleteoldrdn", this), new Integer(28)); 092 literals.put(new ANTLRHashString("modifydn", this), new Integer(12)); 093 literals.put(new ANTLRHashString("call", this), new Integer(17)); 094 literals.put(new ANTLRHashString("$entry", this), new Integer(23)); 095 literals.put(new ANTLRHashString("base", this), new Integer(41)); 096 literals.put(new ANTLRHashString("$newrdn", this), new Integer(27)); 097 literals.put(new ANTLRHashString("$modification", this), new Integer(20)); 098 literals.put(new ANTLRHashString("$newSuperior", this), new Integer(29)); 099 literals.put(new ANTLRHashString("languagescheme", this), new Integer(37)); 100 literals.put(new ANTLRHashString("import", this), new Integer(16)); 101 literals.put(new ANTLRHashString("subtree", this), new Integer(43)); 102 literals.put(new ANTLRHashString("$attributes", this), new Integer(24)); 103 literals.put(new ANTLRHashString("$name", this), new Integer(25)); 104 literals.put(new ANTLRHashString("one", this), new Integer(42)); 105 literals.put(new ANTLRHashString("$ldapcontext", this), new Integer(34)); 106 literals.put(new ANTLRHashString("$newentry", this), new Integer(22)); 107 literals.put(new ANTLRHashString("$newDn", this), new Integer(32)); 108 literals.put(new ANTLRHashString("modify", this), new Integer(6)); 109 literals.put(new ANTLRHashString("add", this), new Integer(10)); 110 literals.put(new ANTLRHashString("$operationprincipal", this), new Integer(33)); 111 literals.put(new ANTLRHashString("searchcontext", this), new Integer(39)); 112 literals.put(new ANTLRHashString("$oldentry", this), new Integer(21)); 113 literals.put(new ANTLRHashString("$object", this), new Integer(19)); 114 literals.put(new ANTLRHashString("export", this), new Integer(15)); 115 literals.put(new ANTLRHashString("delete", this), new Integer(11)); 116 literals.put(new ANTLRHashString("$deletedentry", this), new Integer(26)); 117 literals.put(new ANTLRHashString("$oldSuperiorDn", this), new Integer(31)); 118 literals.put(new ANTLRHashString("$oldRdn", this), new Integer(30)); 119} 120 121public Token nextToken() throws TokenStreamException { 122 Token theRetToken=null; 123tryAgain: 124 for (;;) { 125 Token _token = null; 126 int _ttype = Token.INVALID_TYPE; 127 resetText(); 128 try { // for char stream error handling 129 try { // for lexical error handling 130 switch ( LA(1)) { 131 case '(': 132 { 133 mOPEN_PARAN(true); 134 theRetToken=_returnToken; 135 break; 136 } 137 case ')': 138 { 139 mCLOSE_PARAN(true); 140 theRetToken=_returnToken; 141 break; 142 } 143 case '{': 144 { 145 mOPEN_CURLY(true); 146 theRetToken=_returnToken; 147 break; 148 } 149 case '}': 150 { 151 mCLOSE_CURLY(true); 152 theRetToken=_returnToken; 153 break; 154 } 155 case ';': 156 { 157 mSEMI(true); 158 theRetToken=_returnToken; 159 break; 160 } 161 case ',': 162 { 163 mSEP(true); 164 theRetToken=_returnToken; 165 break; 166 } 167 case '\t': case '\n': case '\r': case ' ': 168 { 169 mSP(true); 170 theRetToken=_returnToken; 171 break; 172 } 173 case '.': 174 { 175 mDOT(true); 176 theRetToken=_returnToken; 177 break; 178 } 179 case '"': 180 { 181 mUTF8String(true); 182 theRetToken=_returnToken; 183 break; 184 } 185 case '#': 186 { 187 mCOMMENT(true); 188 theRetToken=_returnToken; 189 break; 190 } 191 case '$': case 'a': case 'b': case 'c': 192 case 'd': case 'e': case 'f': case 'g': 193 case 'h': case 'i': case 'j': case 'k': 194 case 'l': case 'm': case 'n': case 'o': 195 case 'p': case 'q': case 'r': case 's': 196 case 't': case 'u': case 'v': case 'w': 197 case 'x': case 'y': case 'z': 198 { 199 mIDENTIFIER(true); 200 theRetToken=_returnToken; 201 break; 202 } 203 default: 204 { 205 if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);} 206 else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} 207 } 208 } 209 if ( _returnToken==null ) continue tryAgain; // found SKIP token 210 _ttype = _returnToken.getType(); 211 _ttype = testLiteralsTable(_ttype); 212 _returnToken.setType(_ttype); 213 return _returnToken; 214 } 215 catch (RecognitionException e) { 216 throw new TokenStreamRecognitionException(e); 217 } 218 } 219 catch (CharStreamException cse) { 220 if ( cse instanceof CharStreamIOException ) { 221 throw new TokenStreamIOException(((CharStreamIOException)cse).io); 222 } 223 else { 224 throw new TokenStreamException(cse.getMessage()); 225 } 226 } 227 } 228} 229 230 public final void mOPEN_PARAN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 231 int _ttype; Token _token=null; int _begin=text.length(); 232 _ttype = OPEN_PARAN; 233 int _saveIndex; 234 235 match('('); 236 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 237 _token = makeToken(_ttype); 238 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 239 } 240 _returnToken = _token; 241 } 242 243 public final void mCLOSE_PARAN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 244 int _ttype; Token _token=null; int _begin=text.length(); 245 _ttype = CLOSE_PARAN; 246 int _saveIndex; 247 248 match(')'); 249 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 250 _token = makeToken(_ttype); 251 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 252 } 253 _returnToken = _token; 254 } 255 256 public final void mOPEN_CURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 257 int _ttype; Token _token=null; int _begin=text.length(); 258 _ttype = OPEN_CURLY; 259 int _saveIndex; 260 261 match('{'); 262 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 263 _token = makeToken(_ttype); 264 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 265 } 266 _returnToken = _token; 267 } 268 269 public final void mCLOSE_CURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 270 int _ttype; Token _token=null; int _begin=text.length(); 271 _ttype = CLOSE_CURLY; 272 int _saveIndex; 273 274 match('}'); 275 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 276 _token = makeToken(_ttype); 277 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 278 } 279 _returnToken = _token; 280 } 281 282 public final void mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 283 int _ttype; Token _token=null; int _begin=text.length(); 284 _ttype = SEMI; 285 int _saveIndex; 286 287 match(';'); 288 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 289 _token = makeToken(_ttype); 290 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 291 } 292 _returnToken = _token; 293 } 294 295 public final void mSEP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 296 int _ttype; Token _token=null; int _begin=text.length(); 297 _ttype = SEP; 298 int _saveIndex; 299 300 match(','); 301 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 302 _token = makeToken(_ttype); 303 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 304 } 305 _returnToken = _token; 306 } 307 308 public final void mSP(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 309 int _ttype; Token _token=null; int _begin=text.length(); 310 _ttype = SP; 311 int _saveIndex; 312 313 switch ( LA(1)) { 314 case ' ': 315 { 316 match(' '); 317 break; 318 } 319 case '\t': 320 { 321 match('\t'); 322 break; 323 } 324 case '\n': 325 { 326 match('\n'); 327 newline(); 328 break; 329 } 330 case '\r': 331 { 332 match('\r'); 333 { 334 if ((LA(1)=='\n')) { 335 match('\n'); 336 } 337 else { 338 } 339 340 } 341 newline(); 342 break; 343 } 344 default: 345 { 346 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 347 } 348 } 349 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 350 _token = makeToken(_ttype); 351 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 352 } 353 _returnToken = _token; 354 } 355 356 public final void mDOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 357 int _ttype; Token _token=null; int _begin=text.length(); 358 _ttype = DOT; 359 int _saveIndex; 360 361 match('.'); 362 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 363 _token = makeToken(_ttype); 364 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 365 } 366 _returnToken = _token; 367 } 368 369 public final void mUTF8String(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 370 int _ttype; Token _token=null; int _begin=text.length(); 371 _ttype = UTF8String; 372 int _saveIndex; 373 374 _saveIndex=text.length(); 375 match('"'); 376 text.setLength(_saveIndex); 377 { 378 _loop156: 379 do { 380 if ((_tokenSet_0.member(LA(1)))) { 381 mSAFEUTF8CHAR(false); 382 } 383 else { 384 break _loop156; 385 } 386 387 } while (true); 388 } 389 _saveIndex=text.length(); 390 match('"'); 391 text.setLength(_saveIndex); 392 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 393 _token = makeToken(_ttype); 394 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 395 } 396 _returnToken = _token; 397 } 398 399 protected final void mSAFEUTF8CHAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 400 int _ttype; Token _token=null; int _begin=text.length(); 401 _ttype = SAFEUTF8CHAR; 402 int _saveIndex; 403 404 switch ( LA(1)) { 405 case '\u0001': case '\u0002': case '\u0003': case '\u0004': 406 case '\u0005': case '\u0006': case '\u0007': case '\u0008': 407 case '\t': case '\n': case '\u000b': case '\u000c': 408 case '\r': case '\u000e': case '\u000f': case '\u0010': 409 case '\u0011': case '\u0012': case '\u0013': case '\u0014': 410 case '\u0015': case '\u0016': case '\u0017': case '\u0018': 411 case '\u0019': case '\u001a': case '\u001b': case '\u001c': 412 case '\u001d': case '\u001e': case '\u001f': case ' ': 413 case '!': 414 { 415 matchRange('\u0001','\u0021'); 416 break; 417 } 418 case '#': case '$': case '%': case '&': 419 case '\'': case '(': case ')': case '*': 420 case '+': case ',': case '-': case '.': 421 case '/': case '0': case '1': case '2': 422 case '3': case '4': case '5': case '6': 423 case '7': case '8': case '9': case ':': 424 case ';': case '<': case '=': case '>': 425 case '?': case '@': case 'A': case 'B': 426 case 'C': case 'D': case 'E': case 'F': 427 case 'G': case 'H': case 'I': case 'J': 428 case 'K': case 'L': case 'M': case 'N': 429 case 'O': case 'P': case 'Q': case 'R': 430 case 'S': case 'T': case 'U': case 'V': 431 case 'W': case 'X': case 'Y': case 'Z': 432 case '[': case '\\': case ']': case '^': 433 case '_': case '`': case 'a': case 'b': 434 case 'c': case 'd': case 'e': case 'f': 435 case 'g': case 'h': case 'i': case 'j': 436 case 'k': case 'l': case 'm': case 'n': 437 case 'o': case 'p': case 'q': case 'r': 438 case 's': case 't': case 'u': case 'v': 439 case 'w': case 'x': case 'y': case 'z': 440 case '{': case '|': case '}': case '~': 441 case '\u007f': 442 { 443 matchRange('\u0023','\u007F'); 444 break; 445 } 446 case '\u00c0': case '\u00c1': case '\u00c2': case '\u00c3': 447 case '\u00c4': case '\u00c5': case '\u00c6': case '\u00c7': 448 case '\u00c8': case '\u00c9': case '\u00ca': case '\u00cb': 449 case '\u00cc': case '\u00cd': case '\u00ce': case '\u00cf': 450 case '\u00d0': case '\u00d1': case '\u00d2': case '\u00d3': 451 case '\u00d4': case '\u00d5': case '\u00d6': 452 { 453 matchRange('\u00c0','\u00d6'); 454 break; 455 } 456 case '\u00d8': case '\u00d9': case '\u00da': case '\u00db': 457 case '\u00dc': case '\u00dd': case '\u00de': case '\u00df': 458 case '\u00e0': case '\u00e1': case '\u00e2': case '\u00e3': 459 case '\u00e4': case '\u00e5': case '\u00e6': case '\u00e7': 460 case '\u00e8': case '\u00e9': case '\u00ea': case '\u00eb': 461 case '\u00ec': case '\u00ed': case '\u00ee': case '\u00ef': 462 case '\u00f0': case '\u00f1': case '\u00f2': case '\u00f3': 463 case '\u00f4': case '\u00f5': case '\u00f6': 464 { 465 matchRange('\u00d8','\u00f6'); 466 break; 467 } 468 case '\u00f8': case '\u00f9': case '\u00fa': case '\u00fb': 469 case '\u00fc': case '\u00fd': case '\u00fe': case '\u00ff': 470 { 471 matchRange('\u00f8','\u00ff'); 472 break; 473 } 474 default: 475 if (((LA(1) >= '\u0100' && LA(1) <= '\u1fff'))) { 476 matchRange('\u0100','\u1fff'); 477 } 478 else if (((LA(1) >= '\u3040' && LA(1) <= '\u318f'))) { 479 matchRange('\u3040','\u318f'); 480 } 481 else if (((LA(1) >= '\u3300' && LA(1) <= '\u337f'))) { 482 matchRange('\u3300','\u337f'); 483 } 484 else if (((LA(1) >= '\u3400' && LA(1) <= '\u3d2d'))) { 485 matchRange('\u3400','\u3d2d'); 486 } 487 else if (((LA(1) >= '\u4e00' && LA(1) <= '\u9fff'))) { 488 matchRange('\u4e00','\u9fff'); 489 } 490 else if (((LA(1) >= '\uf900' && LA(1) <= '\ufaff'))) { 491 matchRange('\uf900','\ufaff'); 492 } 493 else { 494 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 495 } 496 } 497 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 498 _token = makeToken(_ttype); 499 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 500 } 501 _returnToken = _token; 502 } 503 504 public final void mCOMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 505 int _ttype; Token _token=null; int _begin=text.length(); 506 _ttype = COMMENT; 507 int _saveIndex; 508 509 match('#'); 510 { 511 _loop161: 512 do { 513 if ((_tokenSet_1.member(LA(1)))) { 514 { 515 match(_tokenSet_1); 516 } 517 } 518 else { 519 break _loop161; 520 } 521 522 } while (true); 523 } 524 { 525 if ((LA(1)=='\n'||LA(1)=='\r')) { 526 { 527 switch ( LA(1)) { 528 case '\n': 529 { 530 match('\n'); 531 break; 532 } 533 case '\r': 534 { 535 match('\r'); 536 { 537 if ((LA(1)=='\n')) { 538 match('\n'); 539 } 540 else { 541 } 542 543 } 544 break; 545 } 546 default: 547 { 548 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 549 } 550 } 551 } 552 newline(); 553 } 554 else { 555 } 556 557 } 558 _ttype = Token.SKIP; 559 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 560 _token = makeToken(_ttype); 561 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 562 } 563 _returnToken = _token; 564 } 565 566 public final void mIDENTIFIER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 567 int _ttype; Token _token=null; int _begin=text.length(); 568 _ttype = IDENTIFIER; 569 int _saveIndex; 570 571 mALPHA(false); 572 { 573 _loop167: 574 do { 575 if ((_tokenSet_2.member(LA(1)))) { 576 mALPHA(false); 577 } 578 else { 579 break _loop167; 580 } 581 582 } while (true); 583 } 584 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 585 _token = makeToken(_ttype); 586 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 587 } 588 _returnToken = _token; 589 } 590 591 protected final void mALPHA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { 592 int _ttype; Token _token=null; int _begin=text.length(); 593 _ttype = ALPHA; 594 int _saveIndex; 595 596 switch ( LA(1)) { 597 case 'a': case 'b': case 'c': case 'd': 598 case 'e': case 'f': case 'g': case 'h': 599 case 'i': case 'j': case 'k': case 'l': 600 case 'm': case 'n': case 'o': case 'p': 601 case 'q': case 'r': case 's': case 't': 602 case 'u': case 'v': case 'w': case 'x': 603 case 'y': case 'z': 604 { 605 matchRange('a','z'); 606 break; 607 } 608 case '$': 609 { 610 match('$'); 611 break; 612 } 613 default: 614 { 615 throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); 616 } 617 } 618 if ( _createToken && _token==null && _ttype!=Token.SKIP ) { 619 _token = makeToken(_ttype); 620 _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); 621 } 622 _returnToken = _token; 623 } 624 625 626 private static final long[] mk_tokenSet_0() { 627 long[] data = new long[3988]; 628 data[0]=-17179869186L; 629 data[1]=-1L; 630 data[3]=-36028797027352577L; 631 for (int i = 4; i<=127; i++) { data[i]=-1L; } 632 for (int i = 193; i<=197; i++) { data[i]=-1L; } 633 data[198]=65535L; 634 for (int i = 204; i<=205; i++) { data[i]=-1L; } 635 for (int i = 208; i<=243; i++) { data[i]=-1L; } 636 data[244]=70368744177663L; 637 for (int i = 312; i<=639; i++) { data[i]=-1L; } 638 for (int i = 996; i<=1003; i++) { data[i]=-1L; } 639 return data; 640 } 641 public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); 642 private static final long[] mk_tokenSet_1() { 643 long[] data = new long[2048]; 644 data[0]=-9218L; 645 for (int i = 1; i<=127; i++) { data[i]=-1L; } 646 for (int i = 193; i<=197; i++) { data[i]=-1L; } 647 data[198]=65535L; 648 for (int i = 204; i<=205; i++) { data[i]=-1L; } 649 for (int i = 208; i<=243; i++) { data[i]=-1L; } 650 data[244]=70368744177663L; 651 for (int i = 312; i<=639; i++) { data[i]=-1L; } 652 for (int i = 996; i<=1003; i++) { data[i]=-1L; } 653 return data; 654 } 655 public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); 656 private static final long[] mk_tokenSet_2() { 657 long[] data = new long[1025]; 658 data[0]=68719476736L; 659 data[1]=576460743713488896L; 660 return data; 661 } 662 public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); 663 664 }