| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.kuali.student.common.messagebuilder.booleanmessage.ast.parsers; |
| 18 | |
|
| 19 | |
import org.antlr.runtime.CharStream; |
| 20 | |
import org.antlr.runtime.EarlyExitException; |
| 21 | |
import org.antlr.runtime.Lexer; |
| 22 | |
import org.antlr.runtime.MismatchedSetException; |
| 23 | |
import org.antlr.runtime.NoViableAltException; |
| 24 | |
import org.antlr.runtime.RecognitionException; |
| 25 | |
import org.antlr.runtime.RecognizerSharedState; |
| 26 | |
|
| 27 | |
public class BooleanFunctionLexer extends Lexer { |
| 28 | |
public static final int UPPERCASE=9; |
| 29 | |
public static final int LOWERCASE=12; |
| 30 | |
public static final int RP=7; |
| 31 | |
public static final int OR=4; |
| 32 | |
public static final int LP=6; |
| 33 | |
public static final int NUMBER=10; |
| 34 | |
public static final int WHITESPACE=11; |
| 35 | |
public static final int AND=5; |
| 36 | |
public static final int EOF=-1; |
| 37 | |
public static final int ALPHA=8; |
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | 0 | public BooleanFunctionLexer() {;} |
| 43 | |
public BooleanFunctionLexer(CharStream input) { |
| 44 | 46 | this(input, new RecognizerSharedState()); |
| 45 | 46 | } |
| 46 | |
public BooleanFunctionLexer(CharStream input, RecognizerSharedState state) { |
| 47 | 46 | super(input,state); |
| 48 | |
|
| 49 | 46 | } |
| 50 | 0 | public String getGrammarFileName() { return "BooleanFunction.g"; } |
| 51 | |
|
| 52 | |
|
| 53 | |
public final void mOR() throws RecognitionException { |
| 54 | |
try { |
| 55 | 42 | int _type = OR; |
| 56 | 42 | int _channel = DEFAULT_TOKEN_CHANNEL; |
| 57 | |
|
| 58 | |
|
| 59 | |
{ |
| 60 | 42 | match('+'); |
| 61 | |
|
| 62 | |
} |
| 63 | |
|
| 64 | 42 | state.type = _type; |
| 65 | 42 | state.channel = _channel; |
| 66 | |
} |
| 67 | 0 | finally { |
| 68 | 42 | } |
| 69 | 42 | } |
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
public final void mAND() throws RecognitionException { |
| 74 | |
try { |
| 75 | 67 | int _type = AND; |
| 76 | 67 | int _channel = DEFAULT_TOKEN_CHANNEL; |
| 77 | |
|
| 78 | |
|
| 79 | |
{ |
| 80 | 67 | match('*'); |
| 81 | |
|
| 82 | |
} |
| 83 | |
|
| 84 | 67 | state.type = _type; |
| 85 | 67 | state.channel = _channel; |
| 86 | |
} |
| 87 | 0 | finally { |
| 88 | 67 | } |
| 89 | 67 | } |
| 90 | |
|
| 91 | |
|
| 92 | |
|
| 93 | |
public final void mLP() throws RecognitionException { |
| 94 | |
try { |
| 95 | 44 | int _type = LP; |
| 96 | 44 | int _channel = DEFAULT_TOKEN_CHANNEL; |
| 97 | |
|
| 98 | |
|
| 99 | |
{ |
| 100 | 44 | match('('); |
| 101 | |
|
| 102 | |
} |
| 103 | |
|
| 104 | 44 | state.type = _type; |
| 105 | 44 | state.channel = _channel; |
| 106 | |
} |
| 107 | 0 | finally { |
| 108 | 44 | } |
| 109 | 44 | } |
| 110 | |
|
| 111 | |
|
| 112 | |
|
| 113 | |
public final void mRP() throws RecognitionException { |
| 114 | |
try { |
| 115 | 44 | int _type = RP; |
| 116 | 44 | int _channel = DEFAULT_TOKEN_CHANNEL; |
| 117 | |
|
| 118 | |
|
| 119 | |
{ |
| 120 | 44 | match(')'); |
| 121 | |
|
| 122 | |
} |
| 123 | |
|
| 124 | 44 | state.type = _type; |
| 125 | 44 | state.channel = _channel; |
| 126 | |
} |
| 127 | 0 | finally { |
| 128 | 44 | } |
| 129 | 44 | } |
| 130 | |
|
| 131 | |
|
| 132 | |
|
| 133 | |
public final void mALPHA() throws RecognitionException { |
| 134 | |
try { |
| 135 | 153 | int _type = ALPHA; |
| 136 | 153 | int _channel = DEFAULT_TOKEN_CHANNEL; |
| 137 | |
|
| 138 | 153 | int alt1=2; |
| 139 | 153 | int LA1_0 = input.LA(1); |
| 140 | |
|
| 141 | 153 | if ( ((LA1_0>='A' && LA1_0<='Z')) ) { |
| 142 | 153 | int LA1_1 = input.LA(2); |
| 143 | |
|
| 144 | 153 | if ( ((LA1_1>='0' && LA1_1<='9')) ) { |
| 145 | 77 | alt1=2; |
| 146 | |
} |
| 147 | |
else { |
| 148 | 76 | alt1=1;} |
| 149 | 153 | } |
| 150 | |
else { |
| 151 | 0 | NoViableAltException nvae = |
| 152 | |
new NoViableAltException("", 1, 0, input); |
| 153 | |
|
| 154 | 0 | throw nvae; |
| 155 | |
} |
| 156 | 153 | switch (alt1) { |
| 157 | |
case 1 : |
| 158 | |
|
| 159 | |
{ |
| 160 | 76 | mUPPERCASE(); |
| 161 | |
|
| 162 | |
} |
| 163 | 76 | break; |
| 164 | |
case 2 : |
| 165 | |
|
| 166 | |
{ |
| 167 | |
|
| 168 | |
|
| 169 | |
{ |
| 170 | 77 | mUPPERCASE(); |
| 171 | 77 | mNUMBER(); |
| 172 | |
|
| 173 | |
} |
| 174 | |
|
| 175 | |
|
| 176 | |
} |
| 177 | |
break; |
| 178 | |
|
| 179 | |
} |
| 180 | 153 | state.type = _type; |
| 181 | 153 | state.channel = _channel; |
| 182 | |
} |
| 183 | 0 | finally { |
| 184 | 153 | } |
| 185 | 153 | } |
| 186 | |
|
| 187 | |
|
| 188 | |
|
| 189 | |
public final void mNUMBER() throws RecognitionException { |
| 190 | |
try { |
| 191 | 77 | int _type = NUMBER; |
| 192 | 77 | int _channel = DEFAULT_TOKEN_CHANNEL; |
| 193 | |
|
| 194 | |
|
| 195 | |
{ |
| 196 | |
|
| 197 | 77 | int cnt2=0; |
| 198 | |
loop2: |
| 199 | |
do { |
| 200 | 154 | int alt2=2; |
| 201 | 154 | int LA2_0 = input.LA(1); |
| 202 | |
|
| 203 | 154 | if ( ((LA2_0>='0' && LA2_0<='9')) ) { |
| 204 | 77 | alt2=1; |
| 205 | |
} |
| 206 | |
|
| 207 | |
|
| 208 | 154 | switch (alt2) { |
| 209 | |
case 1 : |
| 210 | |
|
| 211 | |
{ |
| 212 | 77 | matchRange('0','9'); |
| 213 | |
|
| 214 | |
} |
| 215 | 77 | break; |
| 216 | |
|
| 217 | |
default : |
| 218 | 77 | if ( cnt2 >= 1 ) break loop2; |
| 219 | 0 | EarlyExitException eee = |
| 220 | |
new EarlyExitException(2, input); |
| 221 | 0 | throw eee; |
| 222 | |
} |
| 223 | 77 | cnt2++; |
| 224 | 77 | } while (true); |
| 225 | |
|
| 226 | |
|
| 227 | |
} |
| 228 | |
|
| 229 | 77 | state.type = _type; |
| 230 | 77 | state.channel = _channel; |
| 231 | |
} |
| 232 | 0 | finally { |
| 233 | 77 | } |
| 234 | 77 | } |
| 235 | |
|
| 236 | |
|
| 237 | |
|
| 238 | |
public final void mWHITESPACE() throws RecognitionException { |
| 239 | |
try { |
| 240 | 0 | int _type = WHITESPACE; |
| 241 | 0 | int _channel = DEFAULT_TOKEN_CHANNEL; |
| 242 | |
|
| 243 | |
|
| 244 | |
{ |
| 245 | |
|
| 246 | 0 | int cnt3=0; |
| 247 | |
loop3: |
| 248 | |
do { |
| 249 | 0 | int alt3=2; |
| 250 | 0 | int LA3_0 = input.LA(1); |
| 251 | |
|
| 252 | 0 | if ( ((LA3_0>='\t' && LA3_0<='\n')||(LA3_0>='\f' && LA3_0<='\r')||LA3_0==' ') ) { |
| 253 | 0 | alt3=1; |
| 254 | |
} |
| 255 | |
|
| 256 | |
|
| 257 | 0 | switch (alt3) { |
| 258 | |
case 1 : |
| 259 | |
|
| 260 | |
{ |
| 261 | 0 | if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||(input.LA(1)>='\f' && input.LA(1)<='\r')||input.LA(1)==' ' ) { |
| 262 | 0 | input.consume(); |
| 263 | |
|
| 264 | |
} |
| 265 | |
else { |
| 266 | 0 | MismatchedSetException mse = new MismatchedSetException(null,input); |
| 267 | 0 | recover(mse); |
| 268 | 0 | throw mse;} |
| 269 | |
|
| 270 | |
|
| 271 | |
} |
| 272 | |
break; |
| 273 | |
|
| 274 | |
default : |
| 275 | 0 | if ( cnt3 >= 1 ) break loop3; |
| 276 | 0 | EarlyExitException eee = |
| 277 | |
new EarlyExitException(3, input); |
| 278 | 0 | throw eee; |
| 279 | |
} |
| 280 | 0 | cnt3++; |
| 281 | 0 | } while (true); |
| 282 | |
|
| 283 | 0 | _channel = HIDDEN; |
| 284 | |
|
| 285 | |
} |
| 286 | |
|
| 287 | 0 | state.type = _type; |
| 288 | 0 | state.channel = _channel; |
| 289 | |
} |
| 290 | 0 | finally { |
| 291 | 0 | } |
| 292 | 0 | } |
| 293 | |
|
| 294 | |
|
| 295 | |
|
| 296 | |
public final void mLOWERCASE() throws RecognitionException { |
| 297 | |
try { |
| 298 | 0 | int _type = LOWERCASE; |
| 299 | 0 | int _channel = DEFAULT_TOKEN_CHANNEL; |
| 300 | |
|
| 301 | |
|
| 302 | |
{ |
| 303 | 0 | matchRange('a','z'); |
| 304 | |
|
| 305 | |
} |
| 306 | |
|
| 307 | 0 | state.type = _type; |
| 308 | 0 | state.channel = _channel; |
| 309 | |
} |
| 310 | 0 | finally { |
| 311 | 0 | } |
| 312 | 0 | } |
| 313 | |
|
| 314 | |
|
| 315 | |
|
| 316 | |
public final void mUPPERCASE() throws RecognitionException { |
| 317 | |
try { |
| 318 | |
|
| 319 | |
|
| 320 | |
{ |
| 321 | 153 | matchRange('A','Z'); |
| 322 | |
|
| 323 | |
} |
| 324 | |
|
| 325 | |
} |
| 326 | 0 | finally { |
| 327 | 153 | } |
| 328 | 153 | } |
| 329 | |
|
| 330 | |
|
| 331 | |
public void mTokens() throws RecognitionException { |
| 332 | |
|
| 333 | 350 | int alt4=8; |
| 334 | 350 | switch ( input.LA(1) ) { |
| 335 | |
case '+': |
| 336 | |
{ |
| 337 | 42 | alt4=1; |
| 338 | |
} |
| 339 | 42 | break; |
| 340 | |
case '*': |
| 341 | |
{ |
| 342 | 67 | alt4=2; |
| 343 | |
} |
| 344 | 67 | break; |
| 345 | |
case '(': |
| 346 | |
{ |
| 347 | 44 | alt4=3; |
| 348 | |
} |
| 349 | 44 | break; |
| 350 | |
case ')': |
| 351 | |
{ |
| 352 | 44 | alt4=4; |
| 353 | |
} |
| 354 | 44 | break; |
| 355 | |
case 'A': |
| 356 | |
case 'B': |
| 357 | |
case 'C': |
| 358 | |
case 'D': |
| 359 | |
case 'E': |
| 360 | |
case 'F': |
| 361 | |
case 'G': |
| 362 | |
case 'H': |
| 363 | |
case 'I': |
| 364 | |
case 'J': |
| 365 | |
case 'K': |
| 366 | |
case 'L': |
| 367 | |
case 'M': |
| 368 | |
case 'N': |
| 369 | |
case 'O': |
| 370 | |
case 'P': |
| 371 | |
case 'Q': |
| 372 | |
case 'R': |
| 373 | |
case 'S': |
| 374 | |
case 'T': |
| 375 | |
case 'U': |
| 376 | |
case 'V': |
| 377 | |
case 'W': |
| 378 | |
case 'X': |
| 379 | |
case 'Y': |
| 380 | |
case 'Z': |
| 381 | |
{ |
| 382 | 153 | alt4=5; |
| 383 | |
} |
| 384 | 153 | break; |
| 385 | |
case '0': |
| 386 | |
case '1': |
| 387 | |
case '2': |
| 388 | |
case '3': |
| 389 | |
case '4': |
| 390 | |
case '5': |
| 391 | |
case '6': |
| 392 | |
case '7': |
| 393 | |
case '8': |
| 394 | |
case '9': |
| 395 | |
{ |
| 396 | 0 | alt4=6; |
| 397 | |
} |
| 398 | 0 | break; |
| 399 | |
case '\t': |
| 400 | |
case '\n': |
| 401 | |
case '\f': |
| 402 | |
case '\r': |
| 403 | |
case ' ': |
| 404 | |
{ |
| 405 | 0 | alt4=7; |
| 406 | |
} |
| 407 | 0 | break; |
| 408 | |
case 'a': |
| 409 | |
case 'b': |
| 410 | |
case 'c': |
| 411 | |
case 'd': |
| 412 | |
case 'e': |
| 413 | |
case 'f': |
| 414 | |
case 'g': |
| 415 | |
case 'h': |
| 416 | |
case 'i': |
| 417 | |
case 'j': |
| 418 | |
case 'k': |
| 419 | |
case 'l': |
| 420 | |
case 'm': |
| 421 | |
case 'n': |
| 422 | |
case 'o': |
| 423 | |
case 'p': |
| 424 | |
case 'q': |
| 425 | |
case 'r': |
| 426 | |
case 's': |
| 427 | |
case 't': |
| 428 | |
case 'u': |
| 429 | |
case 'v': |
| 430 | |
case 'w': |
| 431 | |
case 'x': |
| 432 | |
case 'y': |
| 433 | |
case 'z': |
| 434 | |
{ |
| 435 | 0 | alt4=8; |
| 436 | |
} |
| 437 | 0 | break; |
| 438 | |
default: |
| 439 | 0 | NoViableAltException nvae = |
| 440 | |
new NoViableAltException("", 4, 0, input); |
| 441 | |
|
| 442 | 0 | throw nvae; |
| 443 | |
} |
| 444 | |
|
| 445 | 350 | switch (alt4) { |
| 446 | |
case 1 : |
| 447 | |
|
| 448 | |
{ |
| 449 | 42 | mOR(); |
| 450 | |
|
| 451 | |
} |
| 452 | 42 | break; |
| 453 | |
case 2 : |
| 454 | |
|
| 455 | |
{ |
| 456 | 67 | mAND(); |
| 457 | |
|
| 458 | |
} |
| 459 | 67 | break; |
| 460 | |
case 3 : |
| 461 | |
|
| 462 | |
{ |
| 463 | 44 | mLP(); |
| 464 | |
|
| 465 | |
} |
| 466 | 44 | break; |
| 467 | |
case 4 : |
| 468 | |
|
| 469 | |
{ |
| 470 | 44 | mRP(); |
| 471 | |
|
| 472 | |
} |
| 473 | 44 | break; |
| 474 | |
case 5 : |
| 475 | |
|
| 476 | |
{ |
| 477 | 153 | mALPHA(); |
| 478 | |
|
| 479 | |
} |
| 480 | 153 | break; |
| 481 | |
case 6 : |
| 482 | |
|
| 483 | |
{ |
| 484 | 0 | mNUMBER(); |
| 485 | |
|
| 486 | |
} |
| 487 | 0 | break; |
| 488 | |
case 7 : |
| 489 | |
|
| 490 | |
{ |
| 491 | 0 | mWHITESPACE(); |
| 492 | |
|
| 493 | |
} |
| 494 | 0 | break; |
| 495 | |
case 8 : |
| 496 | |
|
| 497 | |
{ |
| 498 | 0 | mLOWERCASE(); |
| 499 | |
|
| 500 | |
} |
| 501 | |
break; |
| 502 | |
|
| 503 | |
} |
| 504 | |
|
| 505 | 350 | } |
| 506 | |
|
| 507 | |
|
| 508 | |
|
| 509 | |
|
| 510 | |
} |