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