00001 package edu.ksu.cis.bandera.abstraction.specification.lexer;
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 import java.io.*;
00039 import java.util.*;
00040 import edu.ksu.cis.bandera.abstraction.specification.node.*;
00041
00042 public class Lexer
00043 {
00044 protected Token token;
00045 protected State state = State.INITIAL;
00046
00047 private PushbackReader in;
00048 private int line;
00049 private int pos;
00050 private boolean cr;
00051 private boolean eof;
00052 private final StringBuffer text = new StringBuffer();
00053
00054 private static int[][][][] gotoTable;
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 private static int[][] accept;
00251
00252
00253
00254
00255
00256
00257 public static class State
00258 {
00259 public final static State INITIAL = new State(0);
00260
00261 private int id;
00262
00263 private State(int id)
00264 {
00265 this.id = id;
00266 }
00267
00268 public int id()
00269 {
00270 return id;
00271 }
00272 }
00273 public Lexer(PushbackReader in)
00274 {
00275 this.in = in;
00276
00277 if(gotoTable == null)
00278 {
00279 try
00280 {
00281 DataInputStream s = new DataInputStream(
00282 new BufferedInputStream(
00283 Lexer.class.getResourceAsStream("lexer.dat")));
00284
00285
00286 int length = s.readInt();
00287 gotoTable = new int[length][][][];
00288 for(int i = 0; i < gotoTable.length; i++)
00289 {
00290 length = s.readInt();
00291 gotoTable[i] = new int[length][][];
00292 for(int j = 0; j < gotoTable[i].length; j++)
00293 {
00294 length = s.readInt();
00295 gotoTable[i][j] = new int[length][3];
00296 for(int k = 0; k < gotoTable[i][j].length; k++)
00297 {
00298 for(int l = 0; l < 3; l++)
00299 {
00300 gotoTable[i][j][k][l] = s.readInt();
00301 }
00302 }
00303 }
00304 }
00305
00306
00307 length = s.readInt();
00308 accept = new int[length][];
00309 for(int i = 0; i < accept.length; i++)
00310 {
00311 length = s.readInt();
00312 accept[i] = new int[length];
00313 for(int j = 0; j < accept[i].length; j++)
00314 {
00315 accept[i][j] = s.readInt();
00316 }
00317 }
00318
00319 s.close();
00320 }
00321 catch(Exception e)
00322 {
00323 throw new RuntimeException("Unable to read lexer.dat.");
00324 }
00325 }
00326 }
00327 protected void filter() throws LexerException, IOException
00328 {
00329 }
00330 private int getChar() throws IOException
00331 {
00332 if(eof)
00333 {
00334 return -1;
00335 }
00336
00337 int result = in.read();
00338
00339 if(result == -1)
00340 {
00341 eof = true;
00342 }
00343
00344 return result;
00345 }
00346 private String getText(int acceptLength)
00347 {
00348 StringBuffer s = new StringBuffer(acceptLength);
00349 for(int i = 0; i < acceptLength; i++)
00350 {
00351 s.append(text.charAt(i));
00352 }
00353
00354 return s.toString();
00355 }
00356 protected Token getToken() throws IOException, LexerException
00357 {
00358 int dfa_state = 0;
00359
00360 int start_pos = pos;
00361 int start_line = line;
00362
00363 int accept_state = -1;
00364 int accept_token = -1;
00365 int accept_length = -1;
00366 int accept_pos = -1;
00367 int accept_line = -1;
00368
00369 int[][][] gotoTable = this.gotoTable[state.id()];
00370 int[] accept = this.accept[state.id()];
00371 text.setLength(0);
00372
00373 while(true)
00374 {
00375 int c = getChar();
00376
00377 if(c != -1)
00378 {
00379 switch(c)
00380 {
00381 case 10:
00382 if(cr)
00383 {
00384 cr = false;
00385 }
00386 else
00387 {
00388 line++;
00389 pos = 0;
00390 }
00391 break;
00392 case 13:
00393 line++;
00394 pos = 0;
00395 cr = true;
00396 break;
00397 default:
00398 pos++;
00399 cr = false;
00400 break;
00401 };
00402
00403 text.append((char) c);
00404
00405 do
00406 {
00407 int oldState = (dfa_state < -1) ? (-2 -dfa_state) : dfa_state;
00408
00409 dfa_state = -1;
00410
00411 int[][] tmp1 = gotoTable[oldState];
00412 int low = 0;
00413 int high = tmp1.length - 1;
00414
00415 while(low <= high)
00416 {
00417 int middle = (low + high) / 2;
00418 int[] tmp2 = tmp1[middle];
00419
00420 if(c < tmp2[0])
00421 {
00422 high = middle - 1;
00423 }
00424 else if(c > tmp2[1])
00425 {
00426 low = middle + 1;
00427 }
00428 else
00429 {
00430 dfa_state = tmp2[2];
00431 break;
00432 }
00433 }
00434 }while(dfa_state < -1);
00435 }
00436 else
00437 {
00438 dfa_state = -1;
00439 }
00440
00441 if(dfa_state >= 0)
00442 {
00443 if(accept[dfa_state] != -1)
00444 {
00445 accept_state = dfa_state;
00446 accept_token = accept[dfa_state];
00447 accept_length = text.length();
00448 accept_pos = pos;
00449 accept_line = line;
00450 }
00451 }
00452 else
00453 {
00454 if(accept_state != -1)
00455 {
00456 switch(accept_token)
00457 {
00458 case 0:
00459 {
00460 Token token = new0(
00461 getText(accept_length),
00462 start_line + 1,
00463 start_pos + 1);
00464 pushBack(accept_length);
00465 pos = accept_pos;
00466 line = accept_line;
00467 return token;
00468 }
00469 case 1:
00470 {
00471 Token token = new1(
00472 getText(accept_length),
00473 start_line + 1,
00474 start_pos + 1);
00475 pushBack(accept_length);
00476 pos = accept_pos;
00477 line = accept_line;
00478 return token;
00479 }
00480 case 2:
00481 {
00482 Token token = new2(
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 3:
00492 {
00493 Token token = new3(
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 4:
00503 {
00504 Token token = new4(
00505 start_line + 1,
00506 start_pos + 1);
00507 pushBack(accept_length);
00508 pos = accept_pos;
00509 line = accept_line;
00510 return token;
00511 }
00512 case 5:
00513 {
00514 Token token = new5(
00515 start_line + 1,
00516 start_pos + 1);
00517 pushBack(accept_length);
00518 pos = accept_pos;
00519 line = accept_line;
00520 return token;
00521 }
00522 case 6:
00523 {
00524 Token token = new6(
00525 start_line + 1,
00526 start_pos + 1);
00527 pushBack(accept_length);
00528 pos = accept_pos;
00529 line = accept_line;
00530 return token;
00531 }
00532 case 7:
00533 {
00534 Token token = new7(
00535 start_line + 1,
00536 start_pos + 1);
00537 pushBack(accept_length);
00538 pos = accept_pos;
00539 line = accept_line;
00540 return token;
00541 }
00542 case 8:
00543 {
00544 Token token = new8(
00545 start_line + 1,
00546 start_pos + 1);
00547 pushBack(accept_length);
00548 pos = accept_pos;
00549 line = accept_line;
00550 return token;
00551 }
00552 case 9:
00553 {
00554 Token token = new9(
00555 start_line + 1,
00556 start_pos + 1);
00557 pushBack(accept_length);
00558 pos = accept_pos;
00559 line = accept_line;
00560 return token;
00561 }
00562 case 10:
00563 {
00564 Token token = new10(
00565 start_line + 1,
00566 start_pos + 1);
00567 pushBack(accept_length);
00568 pos = accept_pos;
00569 line = accept_line;
00570 return token;
00571 }
00572 case 11:
00573 {
00574 Token token = new11(
00575 start_line + 1,
00576 start_pos + 1);
00577 pushBack(accept_length);
00578 pos = accept_pos;
00579 line = accept_line;
00580 return token;
00581 }
00582 case 12:
00583 {
00584 Token token = new12(
00585 start_line + 1,
00586 start_pos + 1);
00587 pushBack(accept_length);
00588 pos = accept_pos;
00589 line = accept_line;
00590 return token;
00591 }
00592 case 13:
00593 {
00594 Token token = new13(
00595 start_line + 1,
00596 start_pos + 1);
00597 pushBack(accept_length);
00598 pos = accept_pos;
00599 line = accept_line;
00600 return token;
00601 }
00602 case 14:
00603 {
00604 Token token = new14(
00605 start_line + 1,
00606 start_pos + 1);
00607 pushBack(accept_length);
00608 pos = accept_pos;
00609 line = accept_line;
00610 return token;
00611 }
00612 case 15:
00613 {
00614 Token token = new15(
00615 start_line + 1,
00616 start_pos + 1);
00617 pushBack(accept_length);
00618 pos = accept_pos;
00619 line = accept_line;
00620 return token;
00621 }
00622 case 16:
00623 {
00624 Token token = new16(
00625 start_line + 1,
00626 start_pos + 1);
00627 pushBack(accept_length);
00628 pos = accept_pos;
00629 line = accept_line;
00630 return token;
00631 }
00632 case 17:
00633 {
00634 Token token = new17(
00635 start_line + 1,
00636 start_pos + 1);
00637 pushBack(accept_length);
00638 pos = accept_pos;
00639 line = accept_line;
00640 return token;
00641 }
00642 case 18:
00643 {
00644 Token token = new18(
00645 start_line + 1,
00646 start_pos + 1);
00647 pushBack(accept_length);
00648 pos = accept_pos;
00649 line = accept_line;
00650 return token;
00651 }
00652 case 19:
00653 {
00654 Token token = new19(
00655 start_line + 1,
00656 start_pos + 1);
00657 pushBack(accept_length);
00658 pos = accept_pos;
00659 line = accept_line;
00660 return token;
00661 }
00662 case 20:
00663 {
00664 Token token = new20(
00665 start_line + 1,
00666 start_pos + 1);
00667 pushBack(accept_length);
00668 pos = accept_pos;
00669 line = accept_line;
00670 return token;
00671 }
00672 case 21:
00673 {
00674 Token token = new21(
00675 start_line + 1,
00676 start_pos + 1);
00677 pushBack(accept_length);
00678 pos = accept_pos;
00679 line = accept_line;
00680 return token;
00681 }
00682 case 22:
00683 {
00684 Token token = new22(
00685 start_line + 1,
00686 start_pos + 1);
00687 pushBack(accept_length);
00688 pos = accept_pos;
00689 line = accept_line;
00690 return token;
00691 }
00692 case 23:
00693 {
00694 Token token = new23(
00695 start_line + 1,
00696 start_pos + 1);
00697 pushBack(accept_length);
00698 pos = accept_pos;
00699 line = accept_line;
00700 return token;
00701 }
00702 case 24:
00703 {
00704 Token token = new24(
00705 start_line + 1,
00706 start_pos + 1);
00707 pushBack(accept_length);
00708 pos = accept_pos;
00709 line = accept_line;
00710 return token;
00711 }
00712 case 25:
00713 {
00714 Token token = new25(
00715 start_line + 1,
00716 start_pos + 1);
00717 pushBack(accept_length);
00718 pos = accept_pos;
00719 line = accept_line;
00720 return token;
00721 }
00722 case 26:
00723 {
00724 Token token = new26(
00725 start_line + 1,
00726 start_pos + 1);
00727 pushBack(accept_length);
00728 pos = accept_pos;
00729 line = accept_line;
00730 return token;
00731 }
00732 case 27:
00733 {
00734 Token token = new27(
00735 start_line + 1,
00736 start_pos + 1);
00737 pushBack(accept_length);
00738 pos = accept_pos;
00739 line = accept_line;
00740 return token;
00741 }
00742 case 28:
00743 {
00744 Token token = new28(
00745 start_line + 1,
00746 start_pos + 1);
00747 pushBack(accept_length);
00748 pos = accept_pos;
00749 line = accept_line;
00750 return token;
00751 }
00752 case 29:
00753 {
00754 Token token = new29(
00755 start_line + 1,
00756 start_pos + 1);
00757 pushBack(accept_length);
00758 pos = accept_pos;
00759 line = accept_line;
00760 return token;
00761 }
00762 case 30:
00763 {
00764 Token token = new30(
00765 start_line + 1,
00766 start_pos + 1);
00767 pushBack(accept_length);
00768 pos = accept_pos;
00769 line = accept_line;
00770 return token;
00771 }
00772 case 31:
00773 {
00774 Token token = new31(
00775 start_line + 1,
00776 start_pos + 1);
00777 pushBack(accept_length);
00778 pos = accept_pos;
00779 line = accept_line;
00780 return token;
00781 }
00782 case 32:
00783 {
00784 Token token = new32(
00785 start_line + 1,
00786 start_pos + 1);
00787 pushBack(accept_length);
00788 pos = accept_pos;
00789 line = accept_line;
00790 return token;
00791 }
00792 case 33:
00793 {
00794 Token token = new33(
00795 start_line + 1,
00796 start_pos + 1);
00797 pushBack(accept_length);
00798 pos = accept_pos;
00799 line = accept_line;
00800 return token;
00801 }
00802 case 34:
00803 {
00804 Token token = new34(
00805 start_line + 1,
00806 start_pos + 1);
00807 pushBack(accept_length);
00808 pos = accept_pos;
00809 line = accept_line;
00810 return token;
00811 }
00812 case 35:
00813 {
00814 Token token = new35(
00815 start_line + 1,
00816 start_pos + 1);
00817 pushBack(accept_length);
00818 pos = accept_pos;
00819 line = accept_line;
00820 return token;
00821 }
00822 case 36:
00823 {
00824 Token token = new36(
00825 start_line + 1,
00826 start_pos + 1);
00827 pushBack(accept_length);
00828 pos = accept_pos;
00829 line = accept_line;
00830 return token;
00831 }
00832 case 37:
00833 {
00834 Token token = new37(
00835 start_line + 1,
00836 start_pos + 1);
00837 pushBack(accept_length);
00838 pos = accept_pos;
00839 line = accept_line;
00840 return token;
00841 }
00842 case 38:
00843 {
00844 Token token = new38(
00845 start_line + 1,
00846 start_pos + 1);
00847 pushBack(accept_length);
00848 pos = accept_pos;
00849 line = accept_line;
00850 return token;
00851 }
00852 case 39:
00853 {
00854 Token token = new39(
00855 start_line + 1,
00856 start_pos + 1);
00857 pushBack(accept_length);
00858 pos = accept_pos;
00859 line = accept_line;
00860 return token;
00861 }
00862 case 40:
00863 {
00864 Token token = new40(
00865 start_line + 1,
00866 start_pos + 1);
00867 pushBack(accept_length);
00868 pos = accept_pos;
00869 line = accept_line;
00870 return token;
00871 }
00872 case 41:
00873 {
00874 Token token = new41(
00875 start_line + 1,
00876 start_pos + 1);
00877 pushBack(accept_length);
00878 pos = accept_pos;
00879 line = accept_line;
00880 return token;
00881 }
00882 case 42:
00883 {
00884 Token token = new42(
00885 start_line + 1,
00886 start_pos + 1);
00887 pushBack(accept_length);
00888 pos = accept_pos;
00889 line = accept_line;
00890 return token;
00891 }
00892 case 43:
00893 {
00894 Token token = new43(
00895 start_line + 1,
00896 start_pos + 1);
00897 pushBack(accept_length);
00898 pos = accept_pos;
00899 line = accept_line;
00900 return token;
00901 }
00902 case 44:
00903 {
00904 Token token = new44(
00905 start_line + 1,
00906 start_pos + 1);
00907 pushBack(accept_length);
00908 pos = accept_pos;
00909 line = accept_line;
00910 return token;
00911 }
00912 case 45:
00913 {
00914 Token token = new45(
00915 start_line + 1,
00916 start_pos + 1);
00917 pushBack(accept_length);
00918 pos = accept_pos;
00919 line = accept_line;
00920 return token;
00921 }
00922 case 46:
00923 {
00924 Token token = new46(
00925 start_line + 1,
00926 start_pos + 1);
00927 pushBack(accept_length);
00928 pos = accept_pos;
00929 line = accept_line;
00930 return token;
00931 }
00932 case 47:
00933 {
00934 Token token = new47(
00935 start_line + 1,
00936 start_pos + 1);
00937 pushBack(accept_length);
00938 pos = accept_pos;
00939 line = accept_line;
00940 return token;
00941 }
00942 case 48:
00943 {
00944 Token token = new48(
00945 start_line + 1,
00946 start_pos + 1);
00947 pushBack(accept_length);
00948 pos = accept_pos;
00949 line = accept_line;
00950 return token;
00951 }
00952 case 49:
00953 {
00954 Token token = new49(
00955 start_line + 1,
00956 start_pos + 1);
00957 pushBack(accept_length);
00958 pos = accept_pos;
00959 line = accept_line;
00960 return token;
00961 }
00962 case 50:
00963 {
00964 Token token = new50(
00965 getText(accept_length),
00966 start_line + 1,
00967 start_pos + 1);
00968 pushBack(accept_length);
00969 pos = accept_pos;
00970 line = accept_line;
00971 return token;
00972 }
00973 case 51:
00974 {
00975 Token token = new51(
00976 getText(accept_length),
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 52:
00985 {
00986 Token token = new52(
00987 getText(accept_length),
00988 start_line + 1,
00989 start_pos + 1);
00990 pushBack(accept_length);
00991 pos = accept_pos;
00992 line = accept_line;
00993 return token;
00994 }
00995 case 53:
00996 {
00997 Token token = new53(
00998 getText(accept_length),
00999 start_line + 1,
01000 start_pos + 1);
01001 pushBack(accept_length);
01002 pos = accept_pos;
01003 line = accept_line;
01004 return token;
01005 }
01006 case 54:
01007 {
01008 Token token = new54(
01009 getText(accept_length),
01010 start_line + 1,
01011 start_pos + 1);
01012 pushBack(accept_length);
01013 pos = accept_pos;
01014 line = accept_line;
01015 return token;
01016 }
01017 case 55:
01018 {
01019 Token token = new55(
01020 getText(accept_length),
01021 start_line + 1,
01022 start_pos + 1);
01023 pushBack(accept_length);
01024 pos = accept_pos;
01025 line = accept_line;
01026 return token;
01027 }
01028 case 56:
01029 {
01030 Token token = new56(
01031 getText(accept_length),
01032 start_line + 1,
01033 start_pos + 1);
01034 pushBack(accept_length);
01035 pos = accept_pos;
01036 line = accept_line;
01037 return token;
01038 }
01039 case 57:
01040 {
01041 Token token = new57(
01042 getText(accept_length),
01043 start_line + 1,
01044 start_pos + 1);
01045 pushBack(accept_length);
01046 pos = accept_pos;
01047 line = accept_line;
01048 return token;
01049 }
01050 case 58:
01051 {
01052 Token token = new58(
01053 getText(accept_length),
01054 start_line + 1,
01055 start_pos + 1);
01056 pushBack(accept_length);
01057 pos = accept_pos;
01058 line = accept_line;
01059 return token;
01060 }
01061 }
01062 }
01063 else
01064 {
01065 if(text.length() > 0)
01066 {
01067 throw new LexerException(
01068 "[" + (start_line + 1) + "," + (start_pos + 1) + "]" +
01069 " Unknown token: " + text);
01070 }
01071 else
01072 {
01073 EOF token = new EOF(
01074 start_line + 1,
01075 start_pos + 1);
01076 return token;
01077 }
01078 }
01079 }
01080 }
01081 }
01082 Token new0(String text, int line, int pos) { return new TWhiteSpace(text, line, pos); }
01083 Token new1(String text, int line, int pos) { return new TTraditionalComment(text, line, pos); }
01084 Token new10(int line, int pos) { return new TComma(line, pos); }
01085 Token new11(int line, int pos) { return new TDot(line, pos); }
01086 Token new12(int line, int pos) { return new TEqual(line, pos); }
01087 Token new13(int line, int pos) { return new TEq(line, pos); }
01088 Token new14(int line, int pos) { return new TLess(line, pos); }
01089 Token new15(int line, int pos) { return new TGreater(line, pos); }
01090 Token new16(int line, int pos) { return new TLessEqual(line, pos); }
01091 Token new17(int line, int pos) { return new TGreaterEqual(line, pos); }
01092 Token new18(int line, int pos) { return new TNotEqual(line, pos); }
01093 Token new19(int line, int pos) { return new TAnd(line, pos); }
01094 Token new2(String text, int line, int pos) { return new TDocumentationComment(text, line, pos); }
01095 Token new20(int line, int pos) { return new TOr(line, pos); }
01096 Token new21(int line, int pos) { return new TShiftLeft(line, pos); }
01097 Token new22(int line, int pos) { return new TSignedShiftRight(line, pos); }
01098 Token new23(int line, int pos) { return new TUnsignedShiftRight(line, pos); }
01099 Token new24(int line, int pos) { return new TNot(line, pos); }
01100 Token new25(int line, int pos) { return new TBitComplement(line, pos); }
01101 Token new26(int line, int pos) { return new TQuestion(line, pos); }
01102 Token new27(int line, int pos) { return new TPlus(line, pos); }
01103 Token new28(int line, int pos) { return new TMinus(line, pos); }
01104 Token new29(int line, int pos) { return new TTimes(line, pos); }
01105 Token new3(String text, int line, int pos) { return new TEndOfLineComment(text, line, pos); }
01106 Token new30(int line, int pos) { return new TDiv(line, pos); }
01107 Token new31(int line, int pos) { return new TMod(line, pos); }
01108 Token new32(int line, int pos) { return new TBitXor(line, pos); }
01109 Token new33(int line, int pos) { return new TBitOr(line, pos); }
01110 Token new34(int line, int pos) { return new TBitAnd(line, pos); }
01111 Token new35(int line, int pos) { return new TRightarrow(line, pos); }
01112 Token new36(int line, int pos) { return new TAny(line, pos); }
01113 Token new37(int line, int pos) { return new TExtends(line, pos); }
01114 Token new38(int line, int pos) { return new TAbstraction(line, pos); }
01115 Token new39(int line, int pos) { return new TBegin(line, pos); }
01116 Token new4(int line, int pos) { return new TLParen(line, pos); }
01117 Token new40(int line, int pos) { return new TEnd(line, pos); }
01118 Token new41(int line, int pos) { return new TAbstract(line, pos); }
01119 Token new42(int line, int pos) { return new TTokens(line, pos); }
01120 Token new43(int line, int pos) { return new TDefault(line, pos); }
01121 Token new44(int line, int pos) { return new TOne2one(line, pos); }
01122 Token new45(int line, int pos) { return new TAbtract(line, pos); }
01123 Token new46(int line, int pos) { return new TTest(line, pos); }
01124 Token new47(int line, int pos) { return new TReal(line, pos); }
01125 Token new48(int line, int pos) { return new TIntegral(line, pos); }
01126 Token new49(int line, int pos) { return new TOperator(line, pos); }
01127 Token new5(int line, int pos) { return new TRParen(line, pos); }
01128 Token new50(String text, int line, int pos) { return new TDecIntLiteral(text, line, pos); }
01129 Token new51(String text, int line, int pos) { return new THexIntLiteral(text, line, pos); }
01130 Token new52(String text, int line, int pos) { return new TOctIntLiteral(text, line, pos); }
01131 Token new53(String text, int line, int pos) { return new TDecLongLiteral(text, line, pos); }
01132 Token new54(String text, int line, int pos) { return new THexLongLiteral(text, line, pos); }
01133 Token new55(String text, int line, int pos) { return new TOctLongLiteral(text, line, pos); }
01134 Token new56(String text, int line, int pos) { return new TDoubleLiteral(text, line, pos); }
01135 Token new57(String text, int line, int pos) { return new TFloatLiteral(text, line, pos); }
01136 Token new58(String text, int line, int pos) { return new TId(text, line, pos); }
01137 Token new6(int line, int pos) { return new TLBrace(line, pos); }
01138 Token new7(int line, int pos) { return new TRBrace(line, pos); }
01139 Token new8(int line, int pos) { return new TSemicolon(line, pos); }
01140 Token new9(int line, int pos) { return new TColon(line, pos); }
01141 public Token next() throws LexerException, IOException
01142 {
01143 while(token == null)
01144 {
01145 token = getToken();
01146 filter();
01147 }
01148
01149 Token result = token;
01150 token = null;
01151 return result;
01152 }
01153 public Token peek() throws LexerException, IOException
01154 {
01155 while(token == null)
01156 {
01157 token = getToken();
01158 filter();
01159 }
01160
01161 return token;
01162 }
01163 private void pushBack(int acceptLength) throws IOException
01164 {
01165 int length = text.length();
01166 for(int i = length - 1; i >= acceptLength; i--)
01167 {
01168 eof = false;
01169
01170 in.unread(text.charAt(i));
01171 }
01172 }
01173 protected void unread(Token token) throws IOException
01174 {
01175 String text = token.getText();
01176 int length = text.length();
01177
01178 for(int i = length - 1; i >= 0; i--)
01179 {
01180 eof = false;
01181
01182 in.unread(text.charAt(i));
01183 }
01184
01185 pos = token.getPos() - 1;
01186 line = token.getLine() - 1;
01187 }
01188 }