1 # Lexer and its tokens.
2 # This file was generated by SableCC (http://www.sablecc.org/).
8 readable writable var _text
: String
9 readable var _filename
: String
10 readable var _line
: Int
11 readable var _pos
: Int
13 fun parser_index
: Int is abstract
15 redef fun to_s
: String do
21 redef fun parser_index
: Int
26 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
36 redef fun parser_index
: Int
41 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
50 redef class TKwpackage
51 redef fun parser_index
: Int
56 init init_tk
(fname
: String, line
: Int, pos
: Int)
58 _text
= once
"package"
66 redef fun parser_index
: Int
71 init init_tk
(fname
: String, line
: Int, pos
: Int)
81 redef fun parser_index
: Int
86 init init_tk
(fname
: String, line
: Int, pos
: Int)
95 redef class TKwabstract
96 redef fun parser_index
: Int
101 init init_tk
(fname
: String, line
: Int, pos
: Int)
103 _text
= once
"abstract"
110 redef class TKwinterface
111 redef fun parser_index
: Int
116 init init_tk
(fname
: String, line
: Int, pos
: Int)
118 _text
= once
"interface"
125 redef class TKwuniversal
126 redef fun parser_index
: Int
131 init init_tk
(fname
: String, line
: Int, pos
: Int)
133 _text
= once
"universal"
140 redef class TKwspecial
141 redef fun parser_index
: Int
146 init init_tk
(fname
: String, line
: Int, pos
: Int)
148 _text
= once
"special"
156 redef fun parser_index
: Int
161 init init_tk
(fname
: String, line
: Int, pos
: Int)
171 redef fun parser_index
: Int
176 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
186 redef fun parser_index
: Int
191 init init_tk
(fname
: String, line
: Int, pos
: Int)
201 redef fun parser_index
: Int
206 init init_tk
(fname
: String, line
: Int, pos
: Int)
216 redef fun parser_index
: Int
221 init init_tk
(fname
: String, line
: Int, pos
: Int)
231 redef fun parser_index
: Int
236 init init_tk
(fname
: String, line
: Int, pos
: Int)
246 redef fun parser_index
: Int
251 init init_tk
(fname
: String, line
: Int, pos
: Int)
261 redef fun parser_index
: Int
266 init init_tk
(fname
: String, line
: Int, pos
: Int)
275 redef class TKwreadable
276 redef fun parser_index
: Int
281 init init_tk
(fname
: String, line
: Int, pos
: Int)
283 _text
= once
"readable"
290 redef class TKwwritable
291 redef fun parser_index
: Int
296 init init_tk
(fname
: String, line
: Int, pos
: Int)
298 _text
= once
"writable"
306 redef fun parser_index
: Int
311 init init_tk
(fname
: String, line
: Int, pos
: Int)
320 redef class TKwintern
321 redef fun parser_index
: Int
326 init init_tk
(fname
: String, line
: Int, pos
: Int)
328 _text
= once
"intern"
335 redef class TKwextern
336 redef fun parser_index
: Int
341 init init_tk
(fname
: String, line
: Int, pos
: Int)
343 _text
= once
"extern"
350 redef class TKwprotected
351 redef fun parser_index
: Int
356 init init_tk
(fname
: String, line
: Int, pos
: Int)
358 _text
= once
"protected"
365 redef class TKwprivate
366 redef fun parser_index
: Int
371 init init_tk
(fname
: String, line
: Int, pos
: Int)
373 _text
= once
"private"
380 redef class TKwintrude
381 redef fun parser_index
: Int
386 init init_tk
(fname
: String, line
: Int, pos
: Int)
388 _text
= once
"intrude"
396 redef fun parser_index
: Int
401 init init_tk
(fname
: String, line
: Int, pos
: Int)
411 redef fun parser_index
: Int
416 init init_tk
(fname
: String, line
: Int, pos
: Int)
426 redef fun parser_index
: Int
431 init init_tk
(fname
: String, line
: Int, pos
: Int)
441 redef fun parser_index
: Int
446 init init_tk
(fname
: String, line
: Int, pos
: Int)
456 redef fun parser_index
: Int
461 init init_tk
(fname
: String, line
: Int, pos
: Int)
471 redef fun parser_index
: Int
476 init init_tk
(fname
: String, line
: Int, pos
: Int)
486 redef fun parser_index
: Int
491 init init_tk
(fname
: String, line
: Int, pos
: Int)
501 redef fun parser_index
: Int
506 init init_tk
(fname
: String, line
: Int, pos
: Int)
516 redef fun parser_index
: Int
521 init init_tk
(fname
: String, line
: Int, pos
: Int)
530 redef class TKwreturn
531 redef fun parser_index
: Int
536 init init_tk
(fname
: String, line
: Int, pos
: Int)
538 _text
= once
"return"
545 redef class TKwcontinue
546 redef fun parser_index
: Int
551 init init_tk
(fname
: String, line
: Int, pos
: Int)
553 _text
= once
"continue"
561 redef fun parser_index
: Int
566 init init_tk
(fname
: String, line
: Int, pos
: Int)
576 redef fun parser_index
: Int
581 init init_tk
(fname
: String, line
: Int, pos
: Int)
590 redef class TKwassert
591 redef fun parser_index
: Int
596 init init_tk
(fname
: String, line
: Int, pos
: Int)
598 _text
= once
"assert"
606 redef fun parser_index
: Int
611 init init_tk
(fname
: String, line
: Int, pos
: Int)
621 redef fun parser_index
: Int
626 init init_tk
(fname
: String, line
: Int, pos
: Int)
636 redef fun parser_index
: Int
641 init init_tk
(fname
: String, line
: Int, pos
: Int)
651 redef fun parser_index
: Int
656 init init_tk
(fname
: String, line
: Int, pos
: Int)
666 redef fun parser_index
: Int
671 init init_tk
(fname
: String, line
: Int, pos
: Int)
681 redef fun parser_index
: Int
686 init init_tk
(fname
: String, line
: Int, pos
: Int)
696 redef fun parser_index
: Int
701 init init_tk
(fname
: String, line
: Int, pos
: Int)
711 redef fun parser_index
: Int
716 init init_tk
(fname
: String, line
: Int, pos
: Int)
726 redef fun parser_index
: Int
731 init init_tk
(fname
: String, line
: Int, pos
: Int)
741 redef fun parser_index
: Int
746 init init_tk
(fname
: String, line
: Int, pos
: Int)
755 redef class TKwnullable
756 redef fun parser_index
: Int
761 init init_tk
(fname
: String, line
: Int, pos
: Int)
763 _text
= once
"nullable"
771 redef fun parser_index
: Int
776 init init_tk
(fname
: String, line
: Int, pos
: Int)
786 redef fun parser_index
: Int
791 init init_tk
(fname
: String, line
: Int, pos
: Int)
801 redef fun parser_index
: Int
806 init init_tk
(fname
: String, line
: Int, pos
: Int)
816 redef fun parser_index
: Int
821 init init_tk
(fname
: String, line
: Int, pos
: Int)
831 redef fun parser_index
: Int
836 init init_tk
(fname
: String, line
: Int, pos
: Int)
846 redef fun parser_index
: Int
851 init init_tk
(fname
: String, line
: Int, pos
: Int)
861 redef fun parser_index
: Int
866 init init_tk
(fname
: String, line
: Int, pos
: Int)
876 redef fun parser_index
: Int
881 init init_tk
(fname
: String, line
: Int, pos
: Int)
891 redef fun parser_index
: Int
896 init init_tk
(fname
: String, line
: Int, pos
: Int)
906 redef fun parser_index
: Int
911 init init_tk
(fname
: String, line
: Int, pos
: Int)
921 redef fun parser_index
: Int
926 init init_tk
(fname
: String, line
: Int, pos
: Int)
935 redef class TDotdotdot
936 redef fun parser_index
: Int
941 init init_tk
(fname
: String, line
: Int, pos
: Int)
951 redef fun parser_index
: Int
956 init init_tk
(fname
: String, line
: Int, pos
: Int)
966 redef fun parser_index
: Int
971 init init_tk
(fname
: String, line
: Int, pos
: Int)
981 redef fun parser_index
: Int
986 init init_tk
(fname
: String, line
: Int, pos
: Int)
996 redef fun parser_index
: Int
1001 init init_tk
(fname
: String, line
: Int, pos
: Int)
1011 redef fun parser_index
: Int
1016 init init_tk
(fname
: String, line
: Int, pos
: Int)
1026 redef fun parser_index
: Int
1031 init init_tk
(fname
: String, line
: Int, pos
: Int)
1040 redef class TPercent
1041 redef fun parser_index
: Int
1046 init init_tk
(fname
: String, line
: Int, pos
: Int)
1056 redef fun parser_index
: Int
1061 init init_tk
(fname
: String, line
: Int, pos
: Int)
1071 redef fun parser_index
: Int
1076 init init_tk
(fname
: String, line
: Int, pos
: Int)
1086 redef fun parser_index
: Int
1091 init init_tk
(fname
: String, line
: Int, pos
: Int)
1101 redef fun parser_index
: Int
1106 init init_tk
(fname
: String, line
: Int, pos
: Int)
1116 redef fun parser_index
: Int
1121 init init_tk
(fname
: String, line
: Int, pos
: Int)
1131 redef fun parser_index
: Int
1136 init init_tk
(fname
: String, line
: Int, pos
: Int)
1145 redef class TStarship
1146 redef fun parser_index
: Int
1151 init init_tk
(fname
: String, line
: Int, pos
: Int)
1160 redef class TClassid
1161 redef fun parser_index
: Int
1166 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1176 redef fun parser_index
: Int
1181 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1191 redef fun parser_index
: Int
1196 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1206 redef fun parser_index
: Int
1211 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1221 redef fun parser_index
: Int
1226 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1236 redef fun parser_index
: Int
1241 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1251 redef fun parser_index
: Int
1256 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1265 redef class TStartString
1266 redef fun parser_index
: Int
1271 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1280 redef class TMidString
1281 redef fun parser_index
: Int
1286 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1295 redef class TEndString
1296 redef fun parser_index
: Int
1301 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1312 redef fun parser_index
: Int
1317 init(fname
: String, line
: Int, pos
: Int)
1327 readable writable var _message
: String
1329 init init_error
(fname
: String, line
: Int, pos
: Int, message
: String)
1331 init(fname
, line
, pos
)
1337 # The lexer extract NIT tokens from an input stream.
1338 # It is better user with the Parser
1341 var _token
: nullable Token
1343 # Lexer current state
1346 # Name of the stream (as given to tokens)
1347 readable var _filename
: String
1349 # Input stream where character are read
1350 var _stream
: IStream
1352 # Pushback buffer to store unread character
1353 var _stream_buf
: Buffer
1355 # Number of character stored in the pushback buffer
1356 var _stream_pos
: Int
1358 # Current line number in the input stream
1361 # Current column in the input stream
1364 # Was the last character a cariage-return?
1365 var _cr
: Bool = false
1367 # If the end of stream?
1368 var _eof
: Bool = false
1370 # Current working text read from the input stream
1373 # Constante state values
1374 private fun state_initial
: Int do return 0 end
1376 # Create a new lexer for a stream (and a name)
1377 init(stream
: IStream, fname
: String)
1383 _stream_buf
= new Buffer
1388 # Give the next token (but do not consume it)
1391 while _token
== null do
1394 return _token
.as(not null)
1397 # Give and consume the next token
1401 while result
== null do
1405 return result
.as(not null)
1408 # Get a token, or null if it is discarded
1409 private fun get_token
: nullable Token
1413 var start_pos
= _pos
1414 var start_line
= _line
1416 var accept_state
= -1
1417 var accept_token
= -1
1418 var accept_length
= -1
1420 var accept_line
= -1
1422 var goto_table
= _goto_table
[_state
]
1423 var accept
= _accept_table
[_state
]
1437 else if c
== 13 then
1448 var first_loop
= true # aka until
1449 while dfa_state
< -1 or first_loop
do
1450 var old_state
= dfa_state
1451 if dfa_state
< -1 then
1452 old_state
= -2 - dfa_state
1457 var tmp1
= goto_table
[old_state
]
1459 var high
= tmp1
.length
- 1
1461 while low
<= high
do
1462 var middle
= (low
+ high
) / 2
1463 var tmp2
= tmp1
[middle
]
1467 else if c
> tmp2
[1] then
1471 low
= high
+ 1 # aka break
1474 first_loop
= false # aka until
1480 if dfa_state
>= 0 then
1481 if accept
[dfa_state
] != -1 then
1482 accept_state
= dfa_state
1483 accept_token
= accept
[dfa_state
]
1484 accept_length
= _text
.length
1489 if accept_state
!= -1 then
1490 if accept_token
== 0 then
1491 push_back
(accept_length
)
1496 if accept_token
== 1 then
1497 var token_text
= _text
.substring
(0, accept_length
)
1498 var token
= new TEol.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1499 push_back
(accept_length
)
1504 if accept_token
== 2 then
1505 var token_text
= _text
.substring
(0, accept_length
)
1506 var token
= new TComment.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1507 push_back
(accept_length
)
1512 if accept_token
== 3 then
1513 var token
= new TKwpackage.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1514 push_back
(accept_length
)
1519 if accept_token
== 4 then
1520 var token
= new TKwimport.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1521 push_back
(accept_length
)
1526 if accept_token
== 5 then
1527 var token
= new TKwclass.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1528 push_back
(accept_length
)
1533 if accept_token
== 6 then
1534 var token
= new TKwabstract.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1535 push_back
(accept_length
)
1540 if accept_token
== 7 then
1541 var token
= new TKwinterface.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1542 push_back
(accept_length
)
1547 if accept_token
== 8 then
1548 var token
= new TKwuniversal.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1549 push_back
(accept_length
)
1554 if accept_token
== 9 then
1555 var token
= new TKwspecial.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1556 push_back
(accept_length
)
1561 if accept_token
== 10 then
1562 var token
= new TKwend.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1563 push_back
(accept_length
)
1568 if accept_token
== 11 then
1569 var token_text
= _text
.substring
(0, accept_length
)
1570 var token
= new TKwmeth.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1571 push_back
(accept_length
)
1576 if accept_token
== 12 then
1577 var token
= new TKwtype.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1578 push_back
(accept_length
)
1583 if accept_token
== 13 then
1584 var token
= new TKwattr.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1585 push_back
(accept_length
)
1590 if accept_token
== 14 then
1591 var token
= new TKwinit.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1592 push_back
(accept_length
)
1597 if accept_token
== 15 then
1598 var token
= new TKwredef.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1599 push_back
(accept_length
)
1604 if accept_token
== 16 then
1605 var token
= new TKwis.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1606 push_back
(accept_length
)
1611 if accept_token
== 17 then
1612 var token
= new TKwdo.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1613 push_back
(accept_length
)
1618 if accept_token
== 18 then
1619 var token
= new TKwreadable.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1620 push_back
(accept_length
)
1625 if accept_token
== 19 then
1626 var token
= new TKwwritable.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1627 push_back
(accept_length
)
1632 if accept_token
== 20 then
1633 var token
= new TKwvar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1634 push_back
(accept_length
)
1639 if accept_token
== 21 then
1640 var token
= new TKwintern.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1641 push_back
(accept_length
)
1646 if accept_token
== 22 then
1647 var token
= new TKwextern.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1648 push_back
(accept_length
)
1653 if accept_token
== 23 then
1654 var token
= new TKwprotected.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1655 push_back
(accept_length
)
1660 if accept_token
== 24 then
1661 var token
= new TKwprivate.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1662 push_back
(accept_length
)
1667 if accept_token
== 25 then
1668 var token
= new TKwintrude.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1669 push_back
(accept_length
)
1674 if accept_token
== 26 then
1675 var token
= new TKwif.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1676 push_back
(accept_length
)
1681 if accept_token
== 27 then
1682 var token
= new TKwthen.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1683 push_back
(accept_length
)
1688 if accept_token
== 28 then
1689 var token
= new TKwelse.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1690 push_back
(accept_length
)
1695 if accept_token
== 29 then
1696 var token
= new TKwwhile.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1697 push_back
(accept_length
)
1702 if accept_token
== 30 then
1703 var token
= new TKwfor.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1704 push_back
(accept_length
)
1709 if accept_token
== 31 then
1710 var token
= new TKwin.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1711 push_back
(accept_length
)
1716 if accept_token
== 32 then
1717 var token
= new TKwand.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1718 push_back
(accept_length
)
1723 if accept_token
== 33 then
1724 var token
= new TKwor.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1725 push_back
(accept_length
)
1730 if accept_token
== 34 then
1731 var token
= new TKwnot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1732 push_back
(accept_length
)
1737 if accept_token
== 35 then
1738 var token
= new TKwreturn.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1739 push_back
(accept_length
)
1744 if accept_token
== 36 then
1745 var token
= new TKwcontinue.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1746 push_back
(accept_length
)
1751 if accept_token
== 37 then
1752 var token
= new TKwbreak.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1753 push_back
(accept_length
)
1758 if accept_token
== 38 then
1759 var token
= new TKwabort.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1760 push_back
(accept_length
)
1765 if accept_token
== 39 then
1766 var token
= new TKwassert.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1767 push_back
(accept_length
)
1772 if accept_token
== 40 then
1773 var token
= new TKwnew.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1774 push_back
(accept_length
)
1779 if accept_token
== 41 then
1780 var token
= new TKwisa.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1781 push_back
(accept_length
)
1786 if accept_token
== 42 then
1787 var token
= new TKwonce.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1788 push_back
(accept_length
)
1793 if accept_token
== 43 then
1794 var token
= new TKwsuper.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1795 push_back
(accept_length
)
1800 if accept_token
== 44 then
1801 var token
= new TKwself.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1802 push_back
(accept_length
)
1807 if accept_token
== 45 then
1808 var token
= new TKwtrue.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1809 push_back
(accept_length
)
1814 if accept_token
== 46 then
1815 var token
= new TKwfalse.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1816 push_back
(accept_length
)
1821 if accept_token
== 47 then
1822 var token
= new TKwnull.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1823 push_back
(accept_length
)
1828 if accept_token
== 48 then
1829 var token
= new TKwas.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1830 push_back
(accept_length
)
1835 if accept_token
== 49 then
1836 var token
= new TKwwith.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1837 push_back
(accept_length
)
1842 if accept_token
== 50 then
1843 var token
= new TKwnullable.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1844 push_back
(accept_length
)
1849 if accept_token
== 51 then
1850 var token
= new TKwisset.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1851 push_back
(accept_length
)
1856 if accept_token
== 52 then
1857 var token
= new TOpar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1858 push_back
(accept_length
)
1863 if accept_token
== 53 then
1864 var token
= new TCpar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1865 push_back
(accept_length
)
1870 if accept_token
== 54 then
1871 var token
= new TObra.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1872 push_back
(accept_length
)
1877 if accept_token
== 55 then
1878 var token
= new TCbra.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1879 push_back
(accept_length
)
1884 if accept_token
== 56 then
1885 var token
= new TComma.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1886 push_back
(accept_length
)
1891 if accept_token
== 57 then
1892 var token
= new TColumn.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1893 push_back
(accept_length
)
1898 if accept_token
== 58 then
1899 var token
= new TQuad.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1900 push_back
(accept_length
)
1905 if accept_token
== 59 then
1906 var token
= new TAssign.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1907 push_back
(accept_length
)
1912 if accept_token
== 60 then
1913 var token
= new TPluseq.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1914 push_back
(accept_length
)
1919 if accept_token
== 61 then
1920 var token
= new TMinuseq.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1921 push_back
(accept_length
)
1926 if accept_token
== 62 then
1927 var token
= new TDotdotdot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1928 push_back
(accept_length
)
1933 if accept_token
== 63 then
1934 var token
= new TDotdot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1935 push_back
(accept_length
)
1940 if accept_token
== 64 then
1941 var token
= new TDot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1942 push_back
(accept_length
)
1947 if accept_token
== 65 then
1948 var token
= new TPlus.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1949 push_back
(accept_length
)
1954 if accept_token
== 66 then
1955 var token
= new TMinus.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1956 push_back
(accept_length
)
1961 if accept_token
== 67 then
1962 var token
= new TStar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1963 push_back
(accept_length
)
1968 if accept_token
== 68 then
1969 var token
= new TSlash.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1970 push_back
(accept_length
)
1975 if accept_token
== 69 then
1976 var token
= new TPercent.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1977 push_back
(accept_length
)
1982 if accept_token
== 70 then
1983 var token
= new TEq.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1984 push_back
(accept_length
)
1989 if accept_token
== 71 then
1990 var token
= new TNe.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1991 push_back
(accept_length
)
1996 if accept_token
== 72 then
1997 var token
= new TLt.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1998 push_back
(accept_length
)
2003 if accept_token
== 73 then
2004 var token
= new TLe.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
2005 push_back
(accept_length
)
2010 if accept_token
== 74 then
2011 var token
= new TGt.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
2012 push_back
(accept_length
)
2017 if accept_token
== 75 then
2018 var token
= new TGe.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
2019 push_back
(accept_length
)
2024 if accept_token
== 76 then
2025 var token
= new TStarship.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
2026 push_back
(accept_length
)
2031 if accept_token
== 77 then
2032 var token_text
= _text
.substring
(0, accept_length
)
2033 var token
= new TClassid.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2034 push_back
(accept_length
)
2039 if accept_token
== 78 then
2040 var token_text
= _text
.substring
(0, accept_length
)
2041 var token
= new TId.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2042 push_back
(accept_length
)
2047 if accept_token
== 79 then
2048 var token_text
= _text
.substring
(0, accept_length
)
2049 var token
= new TAttrid.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2050 push_back
(accept_length
)
2055 if accept_token
== 80 then
2056 var token_text
= _text
.substring
(0, accept_length
)
2057 var token
= new TNumber.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2058 push_back
(accept_length
)
2063 if accept_token
== 81 then
2064 var token_text
= _text
.substring
(0, accept_length
)
2065 var token
= new TFloat.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2066 push_back
(accept_length
)
2071 if accept_token
== 82 then
2072 var token_text
= _text
.substring
(0, accept_length
)
2073 var token
= new TChar.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2074 push_back
(accept_length
)
2079 if accept_token
== 83 then
2080 var token_text
= _text
.substring
(0, accept_length
)
2081 var token
= new TString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2082 push_back
(accept_length
)
2087 if accept_token
== 84 then
2088 var token_text
= _text
.substring
(0, accept_length
)
2089 var token
= new TStartString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2090 push_back
(accept_length
)
2095 if accept_token
== 85 then
2096 var token_text
= _text
.substring
(0, accept_length
)
2097 var token
= new TMidString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2098 push_back
(accept_length
)
2103 if accept_token
== 86 then
2104 var token_text
= _text
.substring
(0, accept_length
)
2105 var token
= new TEndString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2106 push_back
(accept_length
)
2112 if _text
.length
> 0 then
2113 var token
= new PError.init_error
(_filename
, start_line
+ 1, start_pos
+ 1, "Unknown token: {_text}")
2116 var token
= new EOF(_filename
, start_line
+ 1, start_pos
+ 1)
2125 # Read the next character.
2126 # The character is read from the stream of from the pushback buffer.
2127 private fun get_char
: Int
2135 var sp
= _stream_pos
2137 var res
= _stream_buf
[_stream_pos
]
2138 _stream_pos
= sp
- 1
2141 result
= _stream
.read_char
2144 if result
== -1 then
2151 # Unread some characters.
2152 # Unread characters are stored in the pushback buffer.
2153 private fun push_back
(accept_length
: Int)
2155 var length
= _text
.length
2157 while i
>= accept_length
do
2159 _stream_pos
= _stream_pos
+ 1
2160 _stream_buf
[_stream_pos
] = _text
[i
]
2165 var _goto_table
: Array[Array[Array[Array[Int]]]]
2166 private fun build_goto_table
2168 _goto_table
= once
[
3376 private fun nil_array
: Array[Array[Int]]
3378 return once
new Array[Array[Int]]
3381 var _accept_table
: Array[Array[Int]]
3382 private fun build_accept_table
do
3383 _accept_table
= once
[
3385 -1 , 0 , 1 , 1 , 0 , -1 , -1 , -1 , 69 , -1 , 52 , 53 , 67 , 65 , 56 , 66 , 64 , 68 , 80 , 57 , 72 , 59 , 74 , 77 , 54 , 55 , -1 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , -1 , 1 , 71 , -1 , 83 , -1 , 84 , -1 , 2 , 2 , -1 , 82 , 60 , 61 , 63 , 81 , -1 , 58 , 73 , 70 , 75 , 77 , 77 , 77 , 77 , 79 , 78 , 78 , 78 , 78 , 78 , 78 , 48 , 78 , 78 , 78 , 78 , 17 , 78 , 78 , 78 , 78 , 78 , 78 , 26 , 78 , 31 , 16 , 78 , 78 , 78 , 78 , 78 , 33 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , -1 , 86 , -1 , 85 , -1 , 2 , 62 , 76 , 79 , 79 , 79 , 79 , 78 , 78 , 32 , 78 , 78 , 78 , 78 , 78 , 78 , 10 , 78 , 78 , 30 , 11 , 78 , 78 , 78 , 41 , 78 , 78 , 40 , 34 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 78 , 20 , 78 , 78 , 78 , -1 , 78 , 78 , 78 , 13 , 78 , 78 , 78 , 28 , 78 , 78 , 78 , 14 , 78 , 78 , 78 , 11 , 47 , 42 , 78 , 78 , 78 , 78 , 78 , 78 , 44 , 78 , 78 , 27 , 45 , 12 , 78 , 78 , 49 , 78 , 38 , 78 , 78 , 37 , 5 , 78 , 78 , 46 , 78 , 78 , 78 , 51 , 78 , 78 , 78 , 78 , 78 , 15 , 78 , 78 , 43 , 78 , 29 , 78 , 78 , 39 , 78 , 22 , 4 , 78 , 21 , 78 , 78 , 78 , 78 , 78 , 78 , 35 , 78 , 78 , 78 , 78 , 78 , 78 , 25 , 78 , 3 , 24 , 78 , 78 , 9 , 78 , 78 , 6 , 36 , 78 , 50 , 78 , 18 , 78 , 19 , 7 , 23 , 8