00001 package edu.ksu.cis.bandera.specification.predicate.lexer;
00002
00003
00004
00005 import java.io.*;
00006 import java.util.*;
00007 import edu.ksu.cis.bandera.specification.predicate.node.*;
00008
00009 public class Lexer
00010 {
00011 protected Token token;
00012 protected State state = State.INITIAL;
00013
00014 private PushbackReader in;
00015 private int line;
00016 private int pos;
00017 private boolean cr;
00018 private boolean eof;
00019 private final StringBuffer text = new StringBuffer();
00020
00021 private static int[][][][] gotoTable;
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272 private static int[][] accept;
00273
00274
00275
00276
00277
00278
00279 public static class State
00280 {
00281 public final static State INITIAL = new State(0);
00282
00283 private int id;
00284
00285 private State(int id)
00286 {
00287 this.id = id;
00288 }
00289
00290 public int id()
00291 {
00292 return id;
00293 }
00294 }
00295 public Lexer(PushbackReader in)
00296 {
00297 this.in = in;
00298
00299 if(gotoTable == null)
00300 {
00301 try
00302 {
00303 DataInputStream s = new DataInputStream(
00304 new BufferedInputStream(
00305 Lexer.class.getResourceAsStream("lexer.dat")));
00306
00307
00308 int length = s.readInt();
00309 gotoTable = new int[length][][][];
00310 for(int i = 0; i < gotoTable.length; i++)
00311 {
00312 length = s.readInt();
00313 gotoTable[i] = new int[length][][];
00314 for(int j = 0; j < gotoTable[i].length; j++)
00315 {
00316 length = s.readInt();
00317 gotoTable[i][j] = new int[length][3];
00318 for(int k = 0; k < gotoTable[i][j].length; k++)
00319 {
00320 for(int l = 0; l < 3; l++)
00321 {
00322 gotoTable[i][j][k][l] = s.readInt();
00323 }
00324 }
00325 }
00326 }
00327
00328
00329 length = s.readInt();
00330 accept = new int[length][];
00331 for(int i = 0; i < accept.length; i++)
00332 {
00333 length = s.readInt();
00334 accept[i] = new int[length];
00335 for(int j = 0; j < accept[i].length; j++)
00336 {
00337 accept[i][j] = s.readInt();
00338 }
00339 }
00340
00341 s.close();
00342 }
00343 catch(Exception e)
00344 {
00345 throw new RuntimeException("Unable to read lexer.dat.");
00346 }
00347 }
00348 }
00349 protected void filter() throws LexerException, IOException
00350 {
00351 }
00352 private int getChar() throws IOException
00353 {
00354 if(eof)
00355 {
00356 return -1;
00357 }
00358
00359 int result = in.read();
00360
00361 if(result == -1)
00362 {
00363 eof = true;
00364 }
00365
00366 return result;
00367 }
00368 private String getText(int acceptLength)
00369 {
00370 StringBuffer s = new StringBuffer(acceptLength);
00371 for(int i = 0; i < acceptLength; i++)
00372 {
00373 s.append(text.charAt(i));
00374 }
00375
00376 return s.toString();
00377 }
00378 protected Token getToken() throws IOException, LexerException
00379 {
00380 int dfa_state = 0;
00381
00382 int start_pos = pos;
00383 int start_line = line;
00384
00385 int accept_state = -1;
00386 int accept_token = -1;
00387 int accept_length = -1;
00388 int accept_pos = -1;
00389 int accept_line = -1;
00390
00391 int[][][] gotoTable = this.gotoTable[state.id()];
00392 int[] accept = this.accept[state.id()];
00393 text.setLength(0);
00394
00395 while(true)
00396 {
00397 int c = getChar();
00398
00399 if(c != -1)
00400 {
00401 switch(c)
00402 {
00403 case 10:
00404 if(cr)
00405 {
00406 cr = false;
00407 }
00408 else
00409 {
00410 line++;
00411 pos = 0;
00412 }
00413 break;
00414 case 13:
00415 line++;
00416 pos = 0;
00417 cr = true;
00418 break;
00419 default:
00420 pos++;
00421 cr = false;
00422 break;
00423 };
00424
00425 text.append((char) c);
00426
00427 do
00428 {
00429 int oldState = (dfa_state < -1) ? (-2 -dfa_state) : dfa_state;
00430
00431 dfa_state = -1;
00432
00433 int[][] tmp1 = gotoTable[oldState];
00434 int low = 0;
00435 int high = tmp1.length - 1;
00436
00437 while(low <= high)
00438 {
00439 int middle = (low + high) / 2;
00440 int[] tmp2 = tmp1[middle];
00441
00442 if(c < tmp2[0])
00443 {
00444 high = middle - 1;
00445 }
00446 else if(c > tmp2[1])
00447 {
00448 low = middle + 1;
00449 }
00450 else
00451 {
00452 dfa_state = tmp2[2];
00453 break;
00454 }
00455 }
00456 }while(dfa_state < -1);
00457 }
00458 else
00459 {
00460 dfa_state = -1;
00461 }
00462
00463 if(dfa_state >= 0)
00464 {
00465 if(accept[dfa_state] != -1)
00466 {
00467 accept_state = dfa_state;
00468 accept_token = accept[dfa_state];
00469 accept_length = text.length();
00470 accept_pos = pos;
00471 accept_line = line;
00472 }
00473 }
00474 else
00475 {
00476 if(accept_state != -1)
00477 {
00478 switch(accept_token)
00479 {
00480 case 0:
00481 {
00482 Token token = new0(
00483 getText(accept_length),
00484 start_line + 1,
00485 start_pos + 1);
00486 pushBack(accept_length);
00487 pos = accept_pos;
00488 line = accept_line;
00489 return token;
00490 }
00491 case 1:
00492 {
00493 Token token = new1(
00494 getText(accept_length),
00495 start_line + 1,
00496 start_pos + 1);
00497 pushBack(accept_length);
00498 pos = accept_pos;
00499 line = accept_line;
00500 return token;
00501 }
00502 case 2:
00503 {
00504 Token token = new2(
00505 getText(accept_length),
00506 start_line + 1,
00507 start_pos + 1);
00508 pushBack(accept_length);
00509 pos = accept_pos;
00510 line = accept_line;
00511 return token;
00512 }
00513 case 3:
00514 {
00515 Token token = new3(
00516 getText(accept_length),
00517 start_line + 1,
00518 start_pos + 1);
00519 pushBack(accept_length);
00520 pos = accept_pos;
00521 line = accept_line;
00522 return token;
00523 }
00524 case 4:
00525 {
00526 Token token = new4(
00527 start_line + 1,
00528 start_pos + 1);
00529 pushBack(accept_length);
00530 pos = accept_pos;
00531 line = accept_line;
00532 return token;
00533 }
00534 case 5:
00535 {
00536 Token token = new5(
00537 start_line + 1,
00538 start_pos + 1);
00539 pushBack(accept_length);
00540 pos = accept_pos;
00541 line = accept_line;
00542 return token;
00543 }
00544 case 6:
00545 {
00546 Token token = new6(
00547 start_line + 1,
00548 start_pos + 1);
00549 pushBack(accept_length);
00550 pos = accept_pos;
00551 line = accept_line;
00552 return token;
00553 }
00554 case 7:
00555 {
00556 Token token = new7(
00557 start_line + 1,
00558 start_pos + 1);
00559 pushBack(accept_length);
00560 pos = accept_pos;
00561 line = accept_line;
00562 return token;
00563 }
00564 case 8:
00565 {
00566 Token token = new8(
00567 start_line + 1,
00568 start_pos + 1);
00569 pushBack(accept_length);
00570 pos = accept_pos;
00571 line = accept_line;
00572 return token;
00573 }
00574 case 9:
00575 {
00576 Token token = new9(
00577 start_line + 1,
00578 start_pos + 1);
00579 pushBack(accept_length);
00580 pos = accept_pos;
00581 line = accept_line;
00582 return token;
00583 }
00584 case 10:
00585 {
00586 Token token = new10(
00587 start_line + 1,
00588 start_pos + 1);
00589 pushBack(accept_length);
00590 pos = accept_pos;
00591 line = accept_line;
00592 return token;
00593 }
00594 case 11:
00595 {
00596 Token token = new11(
00597 start_line + 1,
00598 start_pos + 1);
00599 pushBack(accept_length);
00600 pos = accept_pos;
00601 line = accept_line;
00602 return token;
00603 }
00604 case 12:
00605 {
00606 Token token = new12(
00607 start_line + 1,
00608 start_pos + 1);
00609 pushBack(accept_length);
00610 pos = accept_pos;
00611 line = accept_line;
00612 return token;
00613 }
00614 case 13:
00615 {
00616 Token token = new13(
00617 start_line + 1,
00618 start_pos + 1);
00619 pushBack(accept_length);
00620 pos = accept_pos;
00621 line = accept_line;
00622 return token;
00623 }
00624 case 14:
00625 {
00626 Token token = new14(
00627 start_line + 1,
00628 start_pos + 1);
00629 pushBack(accept_length);
00630 pos = accept_pos;
00631 line = accept_line;
00632 return token;
00633 }
00634 case 15:
00635 {
00636 Token token = new15(
00637 start_line + 1,
00638 start_pos + 1);
00639 pushBack(accept_length);
00640 pos = accept_pos;
00641 line = accept_line;
00642 return token;
00643 }
00644 case 16:
00645 {
00646 Token token = new16(
00647 start_line + 1,
00648 start_pos + 1);
00649 pushBack(accept_length);
00650 pos = accept_pos;
00651 line = accept_line;
00652 return token;
00653 }
00654 case 17:
00655 {
00656 Token token = new17(
00657 start_line + 1,
00658 start_pos + 1);
00659 pushBack(accept_length);
00660 pos = accept_pos;
00661 line = accept_line;
00662 return token;
00663 }
00664 case 18:
00665 {
00666 Token token = new18(
00667 start_line + 1,
00668 start_pos + 1);
00669 pushBack(accept_length);
00670 pos = accept_pos;
00671 line = accept_line;
00672 return token;
00673 }
00674 case 19:
00675 {
00676 Token token = new19(
00677 start_line + 1,
00678 start_pos + 1);
00679 pushBack(accept_length);
00680 pos = accept_pos;
00681 line = accept_line;
00682 return token;
00683 }
00684 case 20:
00685 {
00686 Token token = new20(
00687 start_line + 1,
00688 start_pos + 1);
00689 pushBack(accept_length);
00690 pos = accept_pos;
00691 line = accept_line;
00692 return token;
00693 }
00694 case 21:
00695 {
00696 Token token = new21(
00697 start_line + 1,
00698 start_pos + 1);
00699 pushBack(accept_length);
00700 pos = accept_pos;
00701 line = accept_line;
00702 return token;
00703 }
00704 case 22:
00705 {
00706 Token token = new22(
00707 start_line + 1,
00708 start_pos + 1);
00709 pushBack(accept_length);
00710 pos = accept_pos;
00711 line = accept_line;
00712 return token;
00713 }
00714 case 23:
00715 {
00716 Token token = new23(
00717 start_line + 1,
00718 start_pos + 1);
00719 pushBack(accept_length);
00720 pos = accept_pos;
00721 line = accept_line;
00722 return token;
00723 }
00724 case 24:
00725 {
00726 Token token = new24(
00727 start_line + 1,
00728 start_pos + 1);
00729 pushBack(accept_length);
00730 pos = accept_pos;
00731 line = accept_line;
00732 return token;
00733 }
00734 case 25:
00735 {
00736 Token token = new25(
00737 start_line + 1,
00738 start_pos + 1);
00739 pushBack(accept_length);
00740 pos = accept_pos;
00741 line = accept_line;
00742 return token;
00743 }
00744 case 26:
00745 {
00746 Token token = new26(
00747 start_line + 1,
00748 start_pos + 1);
00749 pushBack(accept_length);
00750 pos = accept_pos;
00751 line = accept_line;
00752 return token;
00753 }
00754 case 27:
00755 {
00756 Token token = new27(
00757 start_line + 1,
00758 start_pos + 1);
00759 pushBack(accept_length);
00760 pos = accept_pos;
00761 line = accept_line;
00762 return token;
00763 }
00764 case 28:
00765 {
00766 Token token = new28(
00767 start_line + 1,
00768 start_pos + 1);
00769 pushBack(accept_length);
00770 pos = accept_pos;
00771 line = accept_line;
00772 return token;
00773 }
00774 case 29:
00775 {
00776 Token token = new29(
00777 start_line + 1,
00778 start_pos + 1);
00779 pushBack(accept_length);
00780 pos = accept_pos;
00781 line = accept_line;
00782 return token;
00783 }
00784 case 30:
00785 {
00786 Token token = new30(
00787 start_line + 1,
00788 start_pos + 1);
00789 pushBack(accept_length);
00790 pos = accept_pos;
00791 line = accept_line;
00792 return token;
00793 }
00794 case 31:
00795 {
00796 Token token = new31(
00797 start_line + 1,
00798 start_pos + 1);
00799 pushBack(accept_length);
00800 pos = accept_pos;
00801 line = accept_line;
00802 return token;
00803 }
00804 case 32:
00805 {
00806 Token token = new32(
00807 start_line + 1,
00808 start_pos + 1);
00809 pushBack(accept_length);
00810 pos = accept_pos;
00811 line = accept_line;
00812 return token;
00813 }
00814 case 33:
00815 {
00816 Token token = new33(
00817 start_line + 1,
00818 start_pos + 1);
00819 pushBack(accept_length);
00820 pos = accept_pos;
00821 line = accept_line;
00822 return token;
00823 }
00824 case 34:
00825 {
00826 Token token = new34(
00827 start_line + 1,
00828 start_pos + 1);
00829 pushBack(accept_length);
00830 pos = accept_pos;
00831 line = accept_line;
00832 return token;
00833 }
00834 case 35:
00835 {
00836 Token token = new35(
00837 start_line + 1,
00838 start_pos + 1);
00839 pushBack(accept_length);
00840 pos = accept_pos;
00841 line = accept_line;
00842 return token;
00843 }
00844 case 36:
00845 {
00846 Token token = new36(
00847 start_line + 1,
00848 start_pos + 1);
00849 pushBack(accept_length);
00850 pos = accept_pos;
00851 line = accept_line;
00852 return token;
00853 }
00854 case 37:
00855 {
00856 Token token = new37(
00857 start_line + 1,
00858 start_pos + 1);
00859 pushBack(accept_length);
00860 pos = accept_pos;
00861 line = accept_line;
00862 return token;
00863 }
00864 case 38:
00865 {
00866 Token token = new38(
00867 start_line + 1,
00868 start_pos + 1);
00869 pushBack(accept_length);
00870 pos = accept_pos;
00871 line = accept_line;
00872 return token;
00873 }
00874 case 39:
00875 {
00876 Token token = new39(
00877 start_line + 1,
00878 start_pos + 1);
00879 pushBack(accept_length);
00880 pos = accept_pos;
00881 line = accept_line;
00882 return token;
00883 }
00884 case 40:
00885 {
00886 Token token = new40(
00887 start_line + 1,
00888 start_pos + 1);
00889 pushBack(accept_length);
00890 pos = accept_pos;
00891 line = accept_line;
00892 return token;
00893 }
00894 case 41:
00895 {
00896 Token token = new41(
00897 start_line + 1,
00898 start_pos + 1);
00899 pushBack(accept_length);
00900 pos = accept_pos;
00901 line = accept_line;
00902 return token;
00903 }
00904 case 42:
00905 {
00906 Token token = new42(
00907 start_line + 1,
00908 start_pos + 1);
00909 pushBack(accept_length);
00910 pos = accept_pos;
00911 line = accept_line;
00912 return token;
00913 }
00914 case 43:
00915 {
00916 Token token = new43(
00917 start_line + 1,
00918 start_pos + 1);
00919 pushBack(accept_length);
00920 pos = accept_pos;
00921 line = accept_line;
00922 return token;
00923 }
00924 case 44:
00925 {
00926 Token token = new44(
00927 start_line + 1,
00928 start_pos + 1);
00929 pushBack(accept_length);
00930 pos = accept_pos;
00931 line = accept_line;
00932 return token;
00933 }
00934 case 45:
00935 {
00936 Token token = new45(
00937 start_line + 1,
00938 start_pos + 1);
00939 pushBack(accept_length);
00940 pos = accept_pos;
00941 line = accept_line;
00942 return token;
00943 }
00944 case 46:
00945 {
00946 Token token = new46(
00947 start_line + 1,
00948 start_pos + 1);
00949 pushBack(accept_length);
00950 pos = accept_pos;
00951 line = accept_line;
00952 return token;
00953 }
00954 case 47:
00955 {
00956 Token token = new47(
00957 start_line + 1,
00958 start_pos + 1);
00959 pushBack(accept_length);
00960 pos = accept_pos;
00961 line = accept_line;
00962 return token;
00963 }
00964 case 48:
00965 {
00966 Token token = new48(
00967 start_line + 1,
00968 start_pos + 1);
00969 pushBack(accept_length);
00970 pos = accept_pos;
00971 line = accept_line;
00972 return token;
00973 }
00974 case 49:
00975 {
00976 Token token = new49(
00977 start_line + 1,
00978 start_pos + 1);
00979 pushBack(accept_length);
00980 pos = accept_pos;
00981 line = accept_line;
00982 return token;
00983 }
00984 case 50:
00985 {
00986 Token token = new50(
00987 start_line + 1,
00988 start_pos + 1);
00989 pushBack(accept_length);
00990 pos = accept_pos;
00991 line = accept_line;
00992 return token;
00993 }
00994 case 51:
00995 {
00996 Token token = new51(
00997 start_line + 1,
00998 start_pos + 1);
00999 pushBack(accept_length);
01000 pos = accept_pos;
01001 line = accept_line;
01002 return token;
01003 }
01004 case 52:
01005 {
01006 Token token = new52(
01007 start_line + 1,
01008 start_pos + 1);
01009 pushBack(accept_length);
01010 pos = accept_pos;
01011 line = accept_line;
01012 return token;
01013 }
01014 case 53:
01015 {
01016 Token token = new53(
01017 start_line + 1,
01018 start_pos + 1);
01019 pushBack(accept_length);
01020 pos = accept_pos;
01021 line = accept_line;
01022 return token;
01023 }
01024 case 54:
01025 {
01026 Token token = new54(
01027 start_line + 1,
01028 start_pos + 1);
01029 pushBack(accept_length);
01030 pos = accept_pos;
01031 line = accept_line;
01032 return token;
01033 }
01034 case 55:
01035 {
01036 Token token = new55(
01037 start_line + 1,
01038 start_pos + 1);
01039 pushBack(accept_length);
01040 pos = accept_pos;
01041 line = accept_line;
01042 return token;
01043 }
01044 case 56:
01045 {
01046 Token token = new56(
01047 start_line + 1,
01048 start_pos + 1);
01049 pushBack(accept_length);
01050 pos = accept_pos;
01051 line = accept_line;
01052 return token;
01053 }
01054 case 57:
01055 {
01056 Token token = new57(
01057 getText(accept_length),
01058 start_line + 1,
01059 start_pos + 1);
01060 pushBack(accept_length);
01061 pos = accept_pos;
01062 line = accept_line;
01063 return token;
01064 }
01065 case 58:
01066 {
01067 Token token = new58(
01068 getText(accept_length),
01069 start_line + 1,
01070 start_pos + 1);
01071 pushBack(accept_length);
01072 pos = accept_pos;
01073 line = accept_line;
01074 return token;
01075 }
01076 case 59:
01077 {
01078 Token token = new59(
01079 getText(accept_length),
01080 start_line + 1,
01081 start_pos + 1);
01082 pushBack(accept_length);
01083 pos = accept_pos;
01084 line = accept_line;
01085 return token;
01086 }
01087 case 60:
01088 {
01089 Token token = new60(
01090 getText(accept_length),
01091 start_line + 1,
01092 start_pos + 1);
01093 pushBack(accept_length);
01094 pos = accept_pos;
01095 line = accept_line;
01096 return token;
01097 }
01098 case 61:
01099 {
01100 Token token = new61(
01101 getText(accept_length),
01102 start_line + 1,
01103 start_pos + 1);
01104 pushBack(accept_length);
01105 pos = accept_pos;
01106 line = accept_line;
01107 return token;
01108 }
01109 case 62:
01110 {
01111 Token token = new62(
01112 getText(accept_length),
01113 start_line + 1,
01114 start_pos + 1);
01115 pushBack(accept_length);
01116 pos = accept_pos;
01117 line = accept_line;
01118 return token;
01119 }
01120 case 63:
01121 {
01122 Token token = new63(
01123 getText(accept_length),
01124 start_line + 1,
01125 start_pos + 1);
01126 pushBack(accept_length);
01127 pos = accept_pos;
01128 line = accept_line;
01129 return token;
01130 }
01131 case 64:
01132 {
01133 Token token = new64(
01134 getText(accept_length),
01135 start_line + 1,
01136 start_pos + 1);
01137 pushBack(accept_length);
01138 pos = accept_pos;
01139 line = accept_line;
01140 return token;
01141 }
01142 case 65:
01143 {
01144 Token token = new65(
01145 getText(accept_length),
01146 start_line + 1,
01147 start_pos + 1);
01148 pushBack(accept_length);
01149 pos = accept_pos;
01150 line = accept_line;
01151 return token;
01152 }
01153 case 66:
01154 {
01155 Token token = new66(
01156 getText(accept_length),
01157 start_line + 1,
01158 start_pos + 1);
01159 pushBack(accept_length);
01160 pos = accept_pos;
01161 line = accept_line;
01162 return token;
01163 }
01164 case 67:
01165 {
01166 Token token = new67(
01167 getText(accept_length),
01168 start_line + 1,
01169 start_pos + 1);
01170 pushBack(accept_length);
01171 pos = accept_pos;
01172 line = accept_line;
01173 return token;
01174 }
01175 }
01176 }
01177 else
01178 {
01179 if(text.length() > 0)
01180 {
01181 throw new LexerException(
01182 "[" + (start_line + 1) + "," + (start_pos + 1) + "]" +
01183 " Unknown token: " + text);
01184 }
01185 else
01186 {
01187 EOF token = new EOF(
01188 start_line + 1,
01189 start_pos + 1);
01190 return token;
01191 }
01192 }
01193 }
01194 }
01195 }
01196 Token new0(String text, int line, int pos) { return new TWhiteSpace(text, line, pos); }
01197 Token new1(String text, int line, int pos) { return new TTraditionalComment(text, line, pos); }
01198 Token new10(int line, int pos) { return new TLBrace(line, pos); }
01199 Token new11(int line, int pos) { return new TRBrace(line, pos); }
01200 Token new12(int line, int pos) { return new TLBracket(line, pos); }
01201 Token new13(int line, int pos) { return new TRBracket(line, pos); }
01202 Token new14(int line, int pos) { return new TSemicolon(line, pos); }
01203 Token new15(int line, int pos) { return new TColon(line, pos); }
01204 Token new16(int line, int pos) { return new TComma(line, pos); }
01205 Token new17(int line, int pos) { return new TDot(line, pos); }
01206 Token new18(int line, int pos) { return new TEqual(line, pos); }
01207 Token new19(int line, int pos) { return new TLess(line, pos); }
01208 Token new2(String text, int line, int pos) { return new TDocumentationComment(text, line, pos); }
01209 Token new20(int line, int pos) { return new TGreater(line, pos); }
01210 Token new21(int line, int pos) { return new TLessEqual(line, pos); }
01211 Token new22(int line, int pos) { return new TGreaterEqual(line, pos); }
01212 Token new23(int line, int pos) { return new TNotEqual(line, pos); }
01213 Token new24(int line, int pos) { return new TAnd(line, pos); }
01214 Token new25(int line, int pos) { return new TOr(line, pos); }
01215 Token new26(int line, int pos) { return new TShiftLeft(line, pos); }
01216 Token new27(int line, int pos) { return new TSignedShiftRight(line, pos); }
01217 Token new28(int line, int pos) { return new TUnsignedShiftRight(line, pos); }
01218 Token new29(int line, int pos) { return new TNot(line, pos); }
01219 Token new3(String text, int line, int pos) { return new TEndOfLineComment(text, line, pos); }
01220 Token new30(int line, int pos) { return new TBitComplement(line, pos); }
01221 Token new31(int line, int pos) { return new TQuestion(line, pos); }
01222 Token new32(int line, int pos) { return new TPlus(line, pos); }
01223 Token new33(int line, int pos) { return new TMinus(line, pos); }
01224 Token new34(int line, int pos) { return new TStar(line, pos); }
01225 Token new35(int line, int pos) { return new TWeakDiv(line, pos); }
01226 Token new36(int line, int pos) { return new TWeakMod(line, pos); }
01227 Token new37(int line, int pos) { return new TStrongDiv(line, pos); }
01228 Token new38(int line, int pos) { return new TStrongMod(line, pos); }
01229 Token new39(int line, int pos) { return new TBitXor(line, pos); }
01230 Token new4(int line, int pos) { return new TDim(line, pos); }
01231 Token new40(int line, int pos) { return new TBitOr(line, pos); }
01232 Token new41(int line, int pos) { return new TBitAnd(line, pos); }
01233 Token new42(int line, int pos) { return new TBoolean(line, pos); }
01234 Token new43(int line, int pos) { return new TByte(line, pos); }
01235 Token new44(int line, int pos) { return new TShort(line, pos); }
01236 Token new45(int line, int pos) { return new TChar(line, pos); }
01237 Token new46(int line, int pos) { return new TInt(line, pos); }
01238 Token new47(int line, int pos) { return new TLong(line, pos); }
01239 Token new48(int line, int pos) { return new TFloat(line, pos); }
01240 Token new49(int line, int pos) { return new TDouble(line, pos); }
01241 Token new5(int line, int pos) { return new TTrue(line, pos); }
01242 Token new50(int line, int pos) { return new TInvoke(line, pos); }
01243 Token new51(int line, int pos) { return new TReturn(line, pos); }
01244 Token new52(int line, int pos) { return new TLocation(line, pos); }
01245 Token new53(int line, int pos) { return new TExpression(line, pos); }
01246 Token new54(int line, int pos) { return new TInstanceof(line, pos); }
01247 Token new55(int line, int pos) { return new TRetVal(line, pos); }
01248 Token new56(int line, int pos) { return new TThis(line, pos); }
01249 Token new57(String text, int line, int pos) { return new TDecIntLiteral(text, line, pos); }
01250 Token new58(String text, int line, int pos) { return new THexIntLiteral(text, line, pos); }
01251 Token new59(String text, int line, int pos) { return new TOctIntLiteral(text, line, pos); }
01252 Token new6(int line, int pos) { return new TFalse(line, pos); }
01253 Token new60(String text, int line, int pos) { return new TDecLongLiteral(text, line, pos); }
01254 Token new61(String text, int line, int pos) { return new THexLongLiteral(text, line, pos); }
01255 Token new62(String text, int line, int pos) { return new TOctLongLiteral(text, line, pos); }
01256 Token new63(String text, int line, int pos) { return new TDoubleLiteral(text, line, pos); }
01257 Token new64(String text, int line, int pos) { return new TFloatLiteral(text, line, pos); }
01258 Token new65(String text, int line, int pos) { return new TCharLiteral(text, line, pos); }
01259 Token new66(String text, int line, int pos) { return new TStringLiteral(text, line, pos); }
01260 Token new67(String text, int line, int pos) { return new TId(text, line, pos); }
01261 Token new7(int line, int pos) { return new TNull(line, pos); }
01262 Token new8(int line, int pos) { return new TLParen(line, pos); }
01263 Token new9(int line, int pos) { return new TRParen(line, pos); }
01264 public Token next() throws LexerException, IOException
01265 {
01266 while(token == null)
01267 {
01268 token = getToken();
01269 filter();
01270 }
01271
01272 Token result = token;
01273 token = null;
01274 return result;
01275 }
01276 public Token peek() throws LexerException, IOException
01277 {
01278 while(token == null)
01279 {
01280 token = getToken();
01281 filter();
01282 }
01283
01284 return token;
01285 }
01286 private void pushBack(int acceptLength) throws IOException
01287 {
01288 int length = text.length();
01289 for(int i = length - 1; i >= acceptLength; i--)
01290 {
01291 eof = false;
01292
01293 in.unread(text.charAt(i));
01294 }
01295 }
01296 protected void unread(Token token) throws IOException
01297 {
01298 String text = token.getText();
01299 int length = text.length();
01300
01301 for(int i = length - 1; i >= 0; i--)
01302 {
01303 eof = false;
01304
01305 in.unread(text.charAt(i));
01306 }
01307
01308 pos = token.getPos() - 1;
01309 line = token.getLine() - 1;
01310 }
01311 }