2ac066c5682bcce8e1c4e8affbca3c63a7fff25a
1 # Lexer and its tokens.
2 # This file was generated by SableCC (http://www.sablecc.org/).
8 readable writable attr _text
: String
9 readable attr _filename
: String
10 readable attr _line
: Int
11 readable attr _pos
: Int
13 meth parser_index
: Int is abstract
15 redef meth to_s
: String do
21 redef meth parser_index
: Int
26 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
36 redef meth parser_index
: Int
41 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
50 redef class TKwpackage
51 redef meth parser_index
: Int
56 init init_tk
(fname
: String, line
: Int, pos
: Int)
58 _text
= once
"package"
66 redef meth parser_index
: Int
71 init init_tk
(fname
: String, line
: Int, pos
: Int)
81 redef meth parser_index
: Int
86 init init_tk
(fname
: String, line
: Int, pos
: Int)
95 redef class TKwabstract
96 redef meth parser_index
: Int
101 init init_tk
(fname
: String, line
: Int, pos
: Int)
103 _text
= once
"abstract"
110 redef class TKwinterface
111 redef meth parser_index
: Int
116 init init_tk
(fname
: String, line
: Int, pos
: Int)
118 _text
= once
"interface"
125 redef class TKwuniversal
126 redef meth parser_index
: Int
131 init init_tk
(fname
: String, line
: Int, pos
: Int)
133 _text
= once
"universal"
140 redef class TKwspecial
141 redef meth parser_index
: Int
146 init init_tk
(fname
: String, line
: Int, pos
: Int)
148 _text
= once
"special"
156 redef meth parser_index
: Int
161 init init_tk
(fname
: String, line
: Int, pos
: Int)
171 redef meth parser_index
: Int
176 init init_tk
(fname
: String, line
: Int, pos
: Int)
186 redef meth parser_index
: Int
191 init init_tk
(fname
: String, line
: Int, pos
: Int)
201 redef meth parser_index
: Int
206 init init_tk
(fname
: String, line
: Int, pos
: Int)
216 redef meth parser_index
: Int
221 init init_tk
(fname
: String, line
: Int, pos
: Int)
231 redef meth parser_index
: Int
236 init init_tk
(fname
: String, line
: Int, pos
: Int)
246 redef meth parser_index
: Int
251 init init_tk
(fname
: String, line
: Int, pos
: Int)
261 redef meth parser_index
: Int
266 init init_tk
(fname
: String, line
: Int, pos
: Int)
275 redef class TKwreadable
276 redef meth parser_index
: Int
281 init init_tk
(fname
: String, line
: Int, pos
: Int)
283 _text
= once
"readable"
290 redef class TKwwritable
291 redef meth parser_index
: Int
296 init init_tk
(fname
: String, line
: Int, pos
: Int)
298 _text
= once
"writable"
306 redef meth parser_index
: Int
311 init init_tk
(fname
: String, line
: Int, pos
: Int)
320 redef class TKwintern
321 redef meth parser_index
: Int
326 init init_tk
(fname
: String, line
: Int, pos
: Int)
328 _text
= once
"intern"
335 redef class TKwextern
336 redef meth parser_index
: Int
341 init init_tk
(fname
: String, line
: Int, pos
: Int)
343 _text
= once
"extern"
350 redef class TKwprotected
351 redef meth parser_index
: Int
356 init init_tk
(fname
: String, line
: Int, pos
: Int)
358 _text
= once
"protected"
365 redef class TKwprivate
366 redef meth parser_index
: Int
371 init init_tk
(fname
: String, line
: Int, pos
: Int)
373 _text
= once
"private"
380 redef class TKwintrude
381 redef meth parser_index
: Int
386 init init_tk
(fname
: String, line
: Int, pos
: Int)
388 _text
= once
"intrude"
396 redef meth parser_index
: Int
401 init init_tk
(fname
: String, line
: Int, pos
: Int)
411 redef meth parser_index
: Int
416 init init_tk
(fname
: String, line
: Int, pos
: Int)
426 redef meth parser_index
: Int
431 init init_tk
(fname
: String, line
: Int, pos
: Int)
441 redef meth parser_index
: Int
446 init init_tk
(fname
: String, line
: Int, pos
: Int)
456 redef meth parser_index
: Int
461 init init_tk
(fname
: String, line
: Int, pos
: Int)
471 redef meth parser_index
: Int
476 init init_tk
(fname
: String, line
: Int, pos
: Int)
486 redef meth parser_index
: Int
491 init init_tk
(fname
: String, line
: Int, pos
: Int)
501 redef meth parser_index
: Int
506 init init_tk
(fname
: String, line
: Int, pos
: Int)
516 redef meth parser_index
: Int
521 init init_tk
(fname
: String, line
: Int, pos
: Int)
530 redef class TKwreturn
531 redef meth parser_index
: Int
536 init init_tk
(fname
: String, line
: Int, pos
: Int)
538 _text
= once
"return"
545 redef class TKwcontinue
546 redef meth parser_index
: Int
551 init init_tk
(fname
: String, line
: Int, pos
: Int)
553 _text
= once
"continue"
561 redef meth parser_index
: Int
566 init init_tk
(fname
: String, line
: Int, pos
: Int)
576 redef meth parser_index
: Int
581 init init_tk
(fname
: String, line
: Int, pos
: Int)
590 redef class TKwassert
591 redef meth parser_index
: Int
596 init init_tk
(fname
: String, line
: Int, pos
: Int)
598 _text
= once
"assert"
606 redef meth parser_index
: Int
611 init init_tk
(fname
: String, line
: Int, pos
: Int)
621 redef meth parser_index
: Int
626 init init_tk
(fname
: String, line
: Int, pos
: Int)
636 redef meth parser_index
: Int
641 init init_tk
(fname
: String, line
: Int, pos
: Int)
651 redef meth parser_index
: Int
656 init init_tk
(fname
: String, line
: Int, pos
: Int)
666 redef meth parser_index
: Int
671 init init_tk
(fname
: String, line
: Int, pos
: Int)
681 redef meth parser_index
: Int
686 init init_tk
(fname
: String, line
: Int, pos
: Int)
696 redef meth parser_index
: Int
701 init init_tk
(fname
: String, line
: Int, pos
: Int)
711 redef meth parser_index
: Int
716 init init_tk
(fname
: String, line
: Int, pos
: Int)
726 redef meth parser_index
: Int
731 init init_tk
(fname
: String, line
: Int, pos
: Int)
741 redef meth parser_index
: Int
746 init init_tk
(fname
: String, line
: Int, pos
: Int)
756 redef meth parser_index
: Int
761 init init_tk
(fname
: String, line
: Int, pos
: Int)
771 redef meth parser_index
: Int
776 init init_tk
(fname
: String, line
: Int, pos
: Int)
786 redef meth parser_index
: Int
791 init init_tk
(fname
: String, line
: Int, pos
: Int)
801 redef meth parser_index
: Int
806 init init_tk
(fname
: String, line
: Int, pos
: Int)
816 redef meth parser_index
: Int
821 init init_tk
(fname
: String, line
: Int, pos
: Int)
831 redef meth parser_index
: Int
836 init init_tk
(fname
: String, line
: Int, pos
: Int)
846 redef meth parser_index
: Int
851 init init_tk
(fname
: String, line
: Int, pos
: Int)
861 redef meth parser_index
: Int
866 init init_tk
(fname
: String, line
: Int, pos
: Int)
876 redef meth parser_index
: Int
881 init init_tk
(fname
: String, line
: Int, pos
: Int)
890 redef class TDotdotdot
891 redef meth parser_index
: Int
896 init init_tk
(fname
: String, line
: Int, pos
: Int)
906 redef meth parser_index
: Int
911 init init_tk
(fname
: String, line
: Int, pos
: Int)
921 redef meth parser_index
: Int
926 init init_tk
(fname
: String, line
: Int, pos
: Int)
936 redef meth parser_index
: Int
941 init init_tk
(fname
: String, line
: Int, pos
: Int)
951 redef meth parser_index
: Int
956 init init_tk
(fname
: String, line
: Int, pos
: Int)
966 redef meth parser_index
: Int
971 init init_tk
(fname
: String, line
: Int, pos
: Int)
981 redef meth parser_index
: Int
986 init init_tk
(fname
: String, line
: Int, pos
: Int)
996 redef meth parser_index
: Int
1001 init init_tk
(fname
: String, line
: Int, pos
: Int)
1011 redef meth parser_index
: Int
1016 init init_tk
(fname
: String, line
: Int, pos
: Int)
1026 redef meth parser_index
: Int
1031 init init_tk
(fname
: String, line
: Int, pos
: Int)
1041 redef meth parser_index
: Int
1046 init init_tk
(fname
: String, line
: Int, pos
: Int)
1056 redef meth parser_index
: Int
1061 init init_tk
(fname
: String, line
: Int, pos
: Int)
1071 redef meth parser_index
: Int
1076 init init_tk
(fname
: String, line
: Int, pos
: Int)
1086 redef meth parser_index
: Int
1091 init init_tk
(fname
: String, line
: Int, pos
: Int)
1100 redef class TStarship
1101 redef meth parser_index
: Int
1106 init init_tk
(fname
: String, line
: Int, pos
: Int)
1115 redef class TClassid
1116 redef meth parser_index
: Int
1121 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1131 redef meth parser_index
: Int
1136 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1146 redef meth parser_index
: Int
1151 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1161 redef meth parser_index
: Int
1166 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1176 redef meth parser_index
: Int
1181 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1191 redef meth parser_index
: Int
1196 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1206 redef meth parser_index
: Int
1211 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1220 redef class TStartString
1221 redef meth parser_index
: Int
1226 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1235 redef class TMidString
1236 redef meth parser_index
: Int
1241 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1250 redef class TEndString
1251 redef meth parser_index
: Int
1256 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1267 redef meth parser_index
: Int
1272 init(fname
: String, line
: Int, pos
: Int)
1282 readable writable attr _message
: String
1284 init init_error
(fname
: String, line
: Int, pos
: Int, message
: String)
1286 init(fname
, line
, pos
)
1292 # The lexer extract NIT tokens from an input stream.
1293 # It is better user with the Parser
1298 # Lexer current state
1301 # Name of the stream (as given to tokens)
1302 readable attr _filename
: String
1304 # Input stream where character are read
1305 attr _stream
: IStream
1307 # Pushback buffer to store unread character
1308 attr _stream_buf
: String
1310 # Number of character stored in the pushback buffer
1311 attr _stream_pos
: Int
1313 # Current line number in the input stream
1316 # Current column in the input stream
1319 # Was the last character a cariage-return?
1322 # If the end of stream?
1325 # Current working text read from the input stream
1328 # Constante state values
1329 private meth state_initial
: Int do return 0 end
1331 # Create a new lexer for a stream (and a name)
1332 init(stream
: IStream, fname
: String)
1338 _stream_buf
= new String
1343 # Give the next token (but do not consume it)
1346 while _token
== null do
1352 # Give and consume the next token
1356 while result
== null do
1363 # Get a token, or null if it is discarded
1364 private meth get_token
: Token
1368 var start_pos
= _pos
1369 var start_line
= _line
1371 var accept_state
= -1
1372 var accept_token
= -1
1373 var accept_length
= -1
1375 var accept_line
= -1
1377 var goto_table
= _goto_table
[_state
]
1378 var accept
= _accept_table
[_state
]
1392 else if c
== 13 then
1403 var first_loop
= true # aka until
1404 while dfa_state
< -1 or first_loop
do
1405 var old_state
= dfa_state
1406 if dfa_state
< -1 then
1407 old_state
= -2 - dfa_state
1412 var tmp1
= goto_table
[old_state
]
1414 var high
= tmp1
.length
- 1
1416 while low
<= high
do
1417 var middle
= (low
+ high
) / 2
1418 var tmp2
= tmp1
[middle
]
1422 else if c
> tmp2
[1] then
1426 low
= high
+ 1 # aka break
1429 first_loop
= false # aka until
1435 if dfa_state
>= 0 then
1436 if accept
[dfa_state
] != -1 then
1437 accept_state
= dfa_state
1438 accept_token
= accept
[dfa_state
]
1439 accept_length
= _text
.length
1444 if accept_state
!= -1 then
1445 if accept_token
== 0 then
1446 push_back
(accept_length
)
1451 if accept_token
== 1 then
1452 var token_text
= _text
.substring
(0, accept_length
)
1453 var token
= new TEol.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1454 push_back
(accept_length
)
1459 if accept_token
== 2 then
1460 var token_text
= _text
.substring
(0, accept_length
)
1461 var token
= new TComment.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1462 push_back
(accept_length
)
1467 if accept_token
== 3 then
1468 var token
= new TKwpackage.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1469 push_back
(accept_length
)
1474 if accept_token
== 4 then
1475 var token
= new TKwimport.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1476 push_back
(accept_length
)
1481 if accept_token
== 5 then
1482 var token
= new TKwclass.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1483 push_back
(accept_length
)
1488 if accept_token
== 6 then
1489 var token
= new TKwabstract.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1490 push_back
(accept_length
)
1495 if accept_token
== 7 then
1496 var token
= new TKwinterface.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1497 push_back
(accept_length
)
1502 if accept_token
== 8 then
1503 var token
= new TKwuniversal.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1504 push_back
(accept_length
)
1509 if accept_token
== 9 then
1510 var token
= new TKwspecial.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1511 push_back
(accept_length
)
1516 if accept_token
== 10 then
1517 var token
= new TKwend.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1518 push_back
(accept_length
)
1523 if accept_token
== 11 then
1524 var token
= new TKwmeth.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1525 push_back
(accept_length
)
1530 if accept_token
== 12 then
1531 var token
= new TKwtype.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1532 push_back
(accept_length
)
1537 if accept_token
== 13 then
1538 var token
= new TKwattr.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1539 push_back
(accept_length
)
1544 if accept_token
== 14 then
1545 var token
= new TKwinit.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1546 push_back
(accept_length
)
1551 if accept_token
== 15 then
1552 var token
= new TKwredef.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1553 push_back
(accept_length
)
1558 if accept_token
== 16 then
1559 var token
= new TKwis.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1560 push_back
(accept_length
)
1565 if accept_token
== 17 then
1566 var token
= new TKwdo.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1567 push_back
(accept_length
)
1572 if accept_token
== 18 then
1573 var token
= new TKwreadable.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1574 push_back
(accept_length
)
1579 if accept_token
== 19 then
1580 var token
= new TKwwritable.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1581 push_back
(accept_length
)
1586 if accept_token
== 20 then
1587 var token
= new TKwvar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1588 push_back
(accept_length
)
1593 if accept_token
== 21 then
1594 var token
= new TKwintern.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1595 push_back
(accept_length
)
1600 if accept_token
== 22 then
1601 var token
= new TKwextern.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1602 push_back
(accept_length
)
1607 if accept_token
== 23 then
1608 var token
= new TKwprotected.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1609 push_back
(accept_length
)
1614 if accept_token
== 24 then
1615 var token
= new TKwprivate.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1616 push_back
(accept_length
)
1621 if accept_token
== 25 then
1622 var token
= new TKwintrude.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1623 push_back
(accept_length
)
1628 if accept_token
== 26 then
1629 var token
= new TKwif.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1630 push_back
(accept_length
)
1635 if accept_token
== 27 then
1636 var token
= new TKwthen.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1637 push_back
(accept_length
)
1642 if accept_token
== 28 then
1643 var token
= new TKwelse.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1644 push_back
(accept_length
)
1649 if accept_token
== 29 then
1650 var token
= new TKwwhile.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1651 push_back
(accept_length
)
1656 if accept_token
== 30 then
1657 var token
= new TKwfor.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1658 push_back
(accept_length
)
1663 if accept_token
== 31 then
1664 var token
= new TKwin.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1665 push_back
(accept_length
)
1670 if accept_token
== 32 then
1671 var token
= new TKwand.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1672 push_back
(accept_length
)
1677 if accept_token
== 33 then
1678 var token
= new TKwor.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1679 push_back
(accept_length
)
1684 if accept_token
== 34 then
1685 var token
= new TKwnot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1686 push_back
(accept_length
)
1691 if accept_token
== 35 then
1692 var token
= new TKwreturn.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1693 push_back
(accept_length
)
1698 if accept_token
== 36 then
1699 var token
= new TKwcontinue.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1700 push_back
(accept_length
)
1705 if accept_token
== 37 then
1706 var token
= new TKwbreak.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1707 push_back
(accept_length
)
1712 if accept_token
== 38 then
1713 var token
= new TKwabort.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1714 push_back
(accept_length
)
1719 if accept_token
== 39 then
1720 var token
= new TKwassert.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1721 push_back
(accept_length
)
1726 if accept_token
== 40 then
1727 var token
= new TKwnew.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1728 push_back
(accept_length
)
1733 if accept_token
== 41 then
1734 var token
= new TKwisa.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1735 push_back
(accept_length
)
1740 if accept_token
== 42 then
1741 var token
= new TKwonce.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1742 push_back
(accept_length
)
1747 if accept_token
== 43 then
1748 var token
= new TKwsuper.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1749 push_back
(accept_length
)
1754 if accept_token
== 44 then
1755 var token
= new TKwself.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1756 push_back
(accept_length
)
1761 if accept_token
== 45 then
1762 var token
= new TKwtrue.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1763 push_back
(accept_length
)
1768 if accept_token
== 46 then
1769 var token
= new TKwfalse.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1770 push_back
(accept_length
)
1775 if accept_token
== 47 then
1776 var token
= new TKwnull.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1777 push_back
(accept_length
)
1782 if accept_token
== 48 then
1783 var token
= new TKwas.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1784 push_back
(accept_length
)
1789 if accept_token
== 49 then
1790 var token
= new TOpar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1791 push_back
(accept_length
)
1796 if accept_token
== 50 then
1797 var token
= new TCpar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1798 push_back
(accept_length
)
1803 if accept_token
== 51 then
1804 var token
= new TObra.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1805 push_back
(accept_length
)
1810 if accept_token
== 52 then
1811 var token
= new TCbra.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1812 push_back
(accept_length
)
1817 if accept_token
== 53 then
1818 var token
= new TComma.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1819 push_back
(accept_length
)
1824 if accept_token
== 54 then
1825 var token
= new TColumn.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1826 push_back
(accept_length
)
1831 if accept_token
== 55 then
1832 var token
= new TQuad.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1833 push_back
(accept_length
)
1838 if accept_token
== 56 then
1839 var token
= new TAssign.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1840 push_back
(accept_length
)
1845 if accept_token
== 57 then
1846 var token
= new TPluseq.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1847 push_back
(accept_length
)
1852 if accept_token
== 58 then
1853 var token
= new TMinuseq.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1854 push_back
(accept_length
)
1859 if accept_token
== 59 then
1860 var token
= new TDotdotdot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1861 push_back
(accept_length
)
1866 if accept_token
== 60 then
1867 var token
= new TDotdot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1868 push_back
(accept_length
)
1873 if accept_token
== 61 then
1874 var token
= new TDot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1875 push_back
(accept_length
)
1880 if accept_token
== 62 then
1881 var token
= new TPlus.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1882 push_back
(accept_length
)
1887 if accept_token
== 63 then
1888 var token
= new TMinus.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1889 push_back
(accept_length
)
1894 if accept_token
== 64 then
1895 var token
= new TStar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1896 push_back
(accept_length
)
1901 if accept_token
== 65 then
1902 var token
= new TSlash.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1903 push_back
(accept_length
)
1908 if accept_token
== 66 then
1909 var token
= new TPercent.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1910 push_back
(accept_length
)
1915 if accept_token
== 67 then
1916 var token
= new TEq.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1917 push_back
(accept_length
)
1922 if accept_token
== 68 then
1923 var token
= new TNe.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1924 push_back
(accept_length
)
1929 if accept_token
== 69 then
1930 var token
= new TLt.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1931 push_back
(accept_length
)
1936 if accept_token
== 70 then
1937 var token
= new TLe.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1938 push_back
(accept_length
)
1943 if accept_token
== 71 then
1944 var token
= new TGt.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1945 push_back
(accept_length
)
1950 if accept_token
== 72 then
1951 var token
= new TGe.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1952 push_back
(accept_length
)
1957 if accept_token
== 73 then
1958 var token
= new TStarship.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1959 push_back
(accept_length
)
1964 if accept_token
== 74 then
1965 var token_text
= _text
.substring
(0, accept_length
)
1966 var token
= new TClassid.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1967 push_back
(accept_length
)
1972 if accept_token
== 75 then
1973 var token_text
= _text
.substring
(0, accept_length
)
1974 var token
= new TId.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1975 push_back
(accept_length
)
1980 if accept_token
== 76 then
1981 var token_text
= _text
.substring
(0, accept_length
)
1982 var token
= new TAttrid.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1983 push_back
(accept_length
)
1988 if accept_token
== 77 then
1989 var token_text
= _text
.substring
(0, accept_length
)
1990 var token
= new TNumber.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1991 push_back
(accept_length
)
1996 if accept_token
== 78 then
1997 var token_text
= _text
.substring
(0, accept_length
)
1998 var token
= new TFloat.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1999 push_back
(accept_length
)
2004 if accept_token
== 79 then
2005 var token_text
= _text
.substring
(0, accept_length
)
2006 var token
= new TChar.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2007 push_back
(accept_length
)
2012 if accept_token
== 80 then
2013 var token_text
= _text
.substring
(0, accept_length
)
2014 var token
= new TString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2015 push_back
(accept_length
)
2020 if accept_token
== 81 then
2021 var token_text
= _text
.substring
(0, accept_length
)
2022 var token
= new TStartString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2023 push_back
(accept_length
)
2028 if accept_token
== 82 then
2029 var token_text
= _text
.substring
(0, accept_length
)
2030 var token
= new TMidString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2031 push_back
(accept_length
)
2036 if accept_token
== 83 then
2037 var token_text
= _text
.substring
(0, accept_length
)
2038 var token
= new TEndString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2039 push_back
(accept_length
)
2045 if _text
.length
> 0 then
2046 var token
= new PError.init_error
(_filename
, start_line
+ 1, start_pos
+ 1, "Unknown token: {_text}")
2049 var token
= new EOF(_filename
, start_line
+ 1, start_pos
+ 1)
2058 # Read the next character.
2059 # The character is read from the stream of from the pushback buffer.
2060 private meth get_char
: Int
2068 var sp
= _stream_pos
2070 var res
= _stream_buf
[_stream_pos
]
2071 _stream_pos
= sp
- 1
2074 result
= _stream
.read_char
2077 if result
== -1 then
2084 # Unread some characters.
2085 # Unread characters are stored in the pushback buffer.
2086 private meth push_back
(accept_length
: Int)
2088 var length
= _text
.length
2090 while i
>= accept_length
do
2092 _stream_pos
= _stream_pos
+ 1
2093 _stream_buf
[_stream_pos
] = _text
[i
]
2098 attr _goto_table
: Array[Array[Array[Array[Int]]]]
2099 private meth build_goto_table
2101 _goto_table
= once
[
3250 private meth nil_array
: Array[Array[Int]]
3252 return once
new Array[Array[Int]]
3255 attr _accept_table
: Array[Array[Int]]
3256 private meth build_accept_table
do
3257 _accept_table
= once
[
3259 -1 , 0 , 1 , 1 , 0 , -1 , -1 , -1 , 66 , -1 , 49 , 50 , 64 , 62 , 53 , 63 , 61 , 65 , 77 , 54 , 69 , 56 , 71 , 74 , 51 , 52 , -1 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , -1 , 1 , 68 , -1 , 80 , -1 , 81 , -1 , 2 , 2 , -1 , 79 , 57 , 58 , 60 , 78 , -1 , 55 , 70 , 67 , 72 , 74 , 74 , 74 , 74 , 76 , 75 , 75 , 75 , 75 , 75 , 75 , 48 , 75 , 75 , 75 , 75 , 17 , 75 , 75 , 75 , 75 , 75 , 26 , 75 , 31 , 16 , 75 , 75 , 75 , 75 , 75 , 33 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , -1 , 83 , -1 , 82 , -1 , 2 , 59 , 73 , 76 , 76 , 76 , 76 , 75 , 75 , 32 , 75 , 75 , 75 , 75 , 75 , 75 , 10 , 75 , 75 , 30 , 75 , 75 , 75 , 41 , 75 , 40 , 34 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 20 , 75 , 75 , -1 , 75 , 75 , 75 , 13 , 75 , 75 , 75 , 28 , 75 , 75 , 75 , 14 , 75 , 75 , 11 , 47 , 42 , 75 , 75 , 75 , 75 , 75 , 75 , 44 , 75 , 75 , 27 , 45 , 12 , 75 , 75 , 75 , 38 , 75 , 75 , 37 , 5 , 75 , 75 , 46 , 75 , 75 , 75 , 75 , 75 , 75 , 75 , 15 , 75 , 75 , 43 , 75 , 29 , 75 , 75 , 39 , 75 , 22 , 4 , 75 , 21 , 75 , 75 , 75 , 75 , 75 , 35 , 75 , 75 , 75 , 75 , 75 , 75 , 25 , 3 , 24 , 75 , 75 , 9 , 75 , 75 , 6 , 36 , 75 , 75 , 18 , 75 , 19 , 7 , 23 , 8