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)
891 redef meth parser_index
: Int
896 init init_tk
(fname
: String, line
: Int, pos
: Int)
905 redef class TDotdotdot
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)
1010 redef class TPercent
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)
1101 redef meth parser_index
: Int
1106 init init_tk
(fname
: String, line
: Int, pos
: Int)
1115 redef class TStarship
1116 redef meth parser_index
: Int
1121 init init_tk
(fname
: String, line
: Int, pos
: Int)
1130 redef class TClassid
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)
1221 redef meth parser_index
: Int
1226 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1235 redef class TStartString
1236 redef meth parser_index
: Int
1241 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1250 redef class TMidString
1251 redef meth parser_index
: Int
1256 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1265 redef class TEndString
1266 redef meth parser_index
: Int
1271 init init_tk
(text
: String, fname
: String, line
: Int, pos
: Int)
1282 redef meth parser_index
: Int
1287 init(fname
: String, line
: Int, pos
: Int)
1297 readable writable attr _message
: String
1299 init init_error
(fname
: String, line
: Int, pos
: Int, message
: String)
1301 init(fname
, line
, pos
)
1307 # The lexer extract NIT tokens from an input stream.
1308 # It is better user with the Parser
1313 # Lexer current state
1314 attr _state
: Int = 0
1316 # Name of the stream (as given to tokens)
1317 readable attr _filename
: String
1319 # Input stream where character are read
1320 attr _stream
: IStream
1322 # Pushback buffer to store unread character
1323 attr _stream_buf
: Buffer
1325 # Number of character stored in the pushback buffer
1326 attr _stream_pos
: Int
1328 # Current line number in the input stream
1331 # Current column in the input stream
1334 # Was the last character a cariage-return?
1335 attr _cr
: Bool = false
1337 # If the end of stream?
1338 attr _eof
: Bool = false
1340 # Current working text read from the input stream
1343 # Constante state values
1344 private meth state_initial
: Int do return 0 end
1346 # Create a new lexer for a stream (and a name)
1347 init(stream
: IStream, fname
: String)
1353 _stream_buf
= new Buffer
1358 # Give the next token (but do not consume it)
1361 while _token
== null do
1367 # Give and consume the next token
1371 while result
== null do
1378 # Get a token, or null if it is discarded
1379 private meth get_token
: Token
1383 var start_pos
= _pos
1384 var start_line
= _line
1386 var accept_state
= -1
1387 var accept_token
= -1
1388 var accept_length
= -1
1390 var accept_line
= -1
1392 var goto_table
= _goto_table
[_state
]
1393 var accept
= _accept_table
[_state
]
1407 else if c
== 13 then
1418 var first_loop
= true # aka until
1419 while dfa_state
< -1 or first_loop
do
1420 var old_state
= dfa_state
1421 if dfa_state
< -1 then
1422 old_state
= -2 - dfa_state
1427 var tmp1
= goto_table
[old_state
]
1429 var high
= tmp1
.length
- 1
1431 while low
<= high
do
1432 var middle
= (low
+ high
) / 2
1433 var tmp2
= tmp1
[middle
]
1437 else if c
> tmp2
[1] then
1441 low
= high
+ 1 # aka break
1444 first_loop
= false # aka until
1450 if dfa_state
>= 0 then
1451 if accept
[dfa_state
] != -1 then
1452 accept_state
= dfa_state
1453 accept_token
= accept
[dfa_state
]
1454 accept_length
= _text
.length
1459 if accept_state
!= -1 then
1460 if accept_token
== 0 then
1461 push_back
(accept_length
)
1466 if accept_token
== 1 then
1467 var token_text
= _text
.substring
(0, accept_length
)
1468 var token
= new TEol.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1469 push_back
(accept_length
)
1474 if accept_token
== 2 then
1475 var token_text
= _text
.substring
(0, accept_length
)
1476 var token
= new TComment.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1477 push_back
(accept_length
)
1482 if accept_token
== 3 then
1483 var token
= new TKwpackage.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1484 push_back
(accept_length
)
1489 if accept_token
== 4 then
1490 var token
= new TKwimport.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1491 push_back
(accept_length
)
1496 if accept_token
== 5 then
1497 var token
= new TKwclass.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1498 push_back
(accept_length
)
1503 if accept_token
== 6 then
1504 var token
= new TKwabstract.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1505 push_back
(accept_length
)
1510 if accept_token
== 7 then
1511 var token
= new TKwinterface.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1512 push_back
(accept_length
)
1517 if accept_token
== 8 then
1518 var token
= new TKwuniversal.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1519 push_back
(accept_length
)
1524 if accept_token
== 9 then
1525 var token
= new TKwspecial.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1526 push_back
(accept_length
)
1531 if accept_token
== 10 then
1532 var token
= new TKwend.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1533 push_back
(accept_length
)
1538 if accept_token
== 11 then
1539 var token
= new TKwmeth.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1540 push_back
(accept_length
)
1545 if accept_token
== 12 then
1546 var token
= new TKwtype.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1547 push_back
(accept_length
)
1552 if accept_token
== 13 then
1553 var token
= new TKwattr.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1554 push_back
(accept_length
)
1559 if accept_token
== 14 then
1560 var token
= new TKwinit.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1561 push_back
(accept_length
)
1566 if accept_token
== 15 then
1567 var token
= new TKwredef.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1568 push_back
(accept_length
)
1573 if accept_token
== 16 then
1574 var token
= new TKwis.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1575 push_back
(accept_length
)
1580 if accept_token
== 17 then
1581 var token
= new TKwdo.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1582 push_back
(accept_length
)
1587 if accept_token
== 18 then
1588 var token
= new TKwreadable.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1589 push_back
(accept_length
)
1594 if accept_token
== 19 then
1595 var token
= new TKwwritable.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1596 push_back
(accept_length
)
1601 if accept_token
== 20 then
1602 var token
= new TKwvar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1603 push_back
(accept_length
)
1608 if accept_token
== 21 then
1609 var token
= new TKwintern.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1610 push_back
(accept_length
)
1615 if accept_token
== 22 then
1616 var token
= new TKwextern.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1617 push_back
(accept_length
)
1622 if accept_token
== 23 then
1623 var token
= new TKwprotected.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1624 push_back
(accept_length
)
1629 if accept_token
== 24 then
1630 var token
= new TKwprivate.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1631 push_back
(accept_length
)
1636 if accept_token
== 25 then
1637 var token
= new TKwintrude.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1638 push_back
(accept_length
)
1643 if accept_token
== 26 then
1644 var token
= new TKwif.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1645 push_back
(accept_length
)
1650 if accept_token
== 27 then
1651 var token
= new TKwthen.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1652 push_back
(accept_length
)
1657 if accept_token
== 28 then
1658 var token
= new TKwelse.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1659 push_back
(accept_length
)
1664 if accept_token
== 29 then
1665 var token
= new TKwwhile.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1666 push_back
(accept_length
)
1671 if accept_token
== 30 then
1672 var token
= new TKwfor.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1673 push_back
(accept_length
)
1678 if accept_token
== 31 then
1679 var token
= new TKwin.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1680 push_back
(accept_length
)
1685 if accept_token
== 32 then
1686 var token
= new TKwand.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1687 push_back
(accept_length
)
1692 if accept_token
== 33 then
1693 var token
= new TKwor.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1694 push_back
(accept_length
)
1699 if accept_token
== 34 then
1700 var token
= new TKwnot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1701 push_back
(accept_length
)
1706 if accept_token
== 35 then
1707 var token
= new TKwreturn.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1708 push_back
(accept_length
)
1713 if accept_token
== 36 then
1714 var token
= new TKwcontinue.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1715 push_back
(accept_length
)
1720 if accept_token
== 37 then
1721 var token
= new TKwbreak.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1722 push_back
(accept_length
)
1727 if accept_token
== 38 then
1728 var token
= new TKwabort.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1729 push_back
(accept_length
)
1734 if accept_token
== 39 then
1735 var token
= new TKwassert.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1736 push_back
(accept_length
)
1741 if accept_token
== 40 then
1742 var token
= new TKwnew.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1743 push_back
(accept_length
)
1748 if accept_token
== 41 then
1749 var token
= new TKwisa.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1750 push_back
(accept_length
)
1755 if accept_token
== 42 then
1756 var token
= new TKwonce.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1757 push_back
(accept_length
)
1762 if accept_token
== 43 then
1763 var token
= new TKwsuper.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1764 push_back
(accept_length
)
1769 if accept_token
== 44 then
1770 var token
= new TKwself.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1771 push_back
(accept_length
)
1776 if accept_token
== 45 then
1777 var token
= new TKwtrue.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1778 push_back
(accept_length
)
1783 if accept_token
== 46 then
1784 var token
= new TKwfalse.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1785 push_back
(accept_length
)
1790 if accept_token
== 47 then
1791 var token
= new TKwnull.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1792 push_back
(accept_length
)
1797 if accept_token
== 48 then
1798 var token
= new TKwas.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1799 push_back
(accept_length
)
1804 if accept_token
== 49 then
1805 var token
= new TKwwith.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1806 push_back
(accept_length
)
1811 if accept_token
== 50 then
1812 var token
= new TOpar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1813 push_back
(accept_length
)
1818 if accept_token
== 51 then
1819 var token
= new TCpar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1820 push_back
(accept_length
)
1825 if accept_token
== 52 then
1826 var token
= new TObra.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1827 push_back
(accept_length
)
1832 if accept_token
== 53 then
1833 var token
= new TCbra.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1834 push_back
(accept_length
)
1839 if accept_token
== 54 then
1840 var token
= new TComma.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1841 push_back
(accept_length
)
1846 if accept_token
== 55 then
1847 var token
= new TColumn.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1848 push_back
(accept_length
)
1853 if accept_token
== 56 then
1854 var token
= new TQuad.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1855 push_back
(accept_length
)
1860 if accept_token
== 57 then
1861 var token
= new TAssign.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1862 push_back
(accept_length
)
1867 if accept_token
== 58 then
1868 var token
= new TPluseq.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1869 push_back
(accept_length
)
1874 if accept_token
== 59 then
1875 var token
= new TMinuseq.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1876 push_back
(accept_length
)
1881 if accept_token
== 60 then
1882 var token
= new TDotdotdot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1883 push_back
(accept_length
)
1888 if accept_token
== 61 then
1889 var token
= new TDotdot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1890 push_back
(accept_length
)
1895 if accept_token
== 62 then
1896 var token
= new TDot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1897 push_back
(accept_length
)
1902 if accept_token
== 63 then
1903 var token
= new TPlus.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1904 push_back
(accept_length
)
1909 if accept_token
== 64 then
1910 var token
= new TMinus.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1911 push_back
(accept_length
)
1916 if accept_token
== 65 then
1917 var token
= new TStar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1918 push_back
(accept_length
)
1923 if accept_token
== 66 then
1924 var token
= new TSlash.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1925 push_back
(accept_length
)
1930 if accept_token
== 67 then
1931 var token
= new TPercent.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1932 push_back
(accept_length
)
1937 if accept_token
== 68 then
1938 var token
= new TEq.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1939 push_back
(accept_length
)
1944 if accept_token
== 69 then
1945 var token
= new TNe.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1946 push_back
(accept_length
)
1951 if accept_token
== 70 then
1952 var token
= new TLt.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1953 push_back
(accept_length
)
1958 if accept_token
== 71 then
1959 var token
= new TLe.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1960 push_back
(accept_length
)
1965 if accept_token
== 72 then
1966 var token
= new TGt.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1967 push_back
(accept_length
)
1972 if accept_token
== 73 then
1973 var token
= new TGe.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1974 push_back
(accept_length
)
1979 if accept_token
== 74 then
1980 var token
= new TStarship.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1981 push_back
(accept_length
)
1986 if accept_token
== 75 then
1987 var token_text
= _text
.substring
(0, accept_length
)
1988 var token
= new TClassid.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1989 push_back
(accept_length
)
1994 if accept_token
== 76 then
1995 var token_text
= _text
.substring
(0, accept_length
)
1996 var token
= new TId.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1997 push_back
(accept_length
)
2002 if accept_token
== 77 then
2003 var token_text
= _text
.substring
(0, accept_length
)
2004 var token
= new TAttrid.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2005 push_back
(accept_length
)
2010 if accept_token
== 78 then
2011 var token_text
= _text
.substring
(0, accept_length
)
2012 var token
= new TNumber.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2013 push_back
(accept_length
)
2018 if accept_token
== 79 then
2019 var token_text
= _text
.substring
(0, accept_length
)
2020 var token
= new TFloat.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2021 push_back
(accept_length
)
2026 if accept_token
== 80 then
2027 var token_text
= _text
.substring
(0, accept_length
)
2028 var token
= new TChar.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2029 push_back
(accept_length
)
2034 if accept_token
== 81 then
2035 var token_text
= _text
.substring
(0, accept_length
)
2036 var token
= new TString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2037 push_back
(accept_length
)
2042 if accept_token
== 82 then
2043 var token_text
= _text
.substring
(0, accept_length
)
2044 var token
= new TStartString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2045 push_back
(accept_length
)
2050 if accept_token
== 83 then
2051 var token_text
= _text
.substring
(0, accept_length
)
2052 var token
= new TMidString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2053 push_back
(accept_length
)
2058 if accept_token
== 84 then
2059 var token_text
= _text
.substring
(0, accept_length
)
2060 var token
= new TEndString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2061 push_back
(accept_length
)
2067 if _text
.length
> 0 then
2068 var token
= new PError.init_error
(_filename
, start_line
+ 1, start_pos
+ 1, "Unknown token: {_text}")
2071 var token
= new EOF(_filename
, start_line
+ 1, start_pos
+ 1)
2080 # Read the next character.
2081 # The character is read from the stream of from the pushback buffer.
2082 private meth get_char
: Int
2090 var sp
= _stream_pos
2092 var res
= _stream_buf
[_stream_pos
]
2093 _stream_pos
= sp
- 1
2096 result
= _stream
.read_char
2099 if result
== -1 then
2106 # Unread some characters.
2107 # Unread characters are stored in the pushback buffer.
2108 private meth push_back
(accept_length
: Int)
2110 var length
= _text
.length
2112 while i
>= accept_length
do
2114 _stream_pos
= _stream_pos
+ 1
2115 _stream_buf
[_stream_pos
] = _text
[i
]
2120 attr _goto_table
: Array[Array[Array[Array[Int]]]]
2121 private meth build_goto_table
2123 _goto_table
= once
[
3286 private meth nil_array
: Array[Array[Int]]
3288 return once
new Array[Array[Int]]
3291 attr _accept_table
: Array[Array[Int]]
3292 private meth build_accept_table
do
3293 _accept_table
= once
[
3295 -1 , 0 , 1 , 1 , 0 , -1 , -1 , -1 , 67 , -1 , 50 , 51 , 65 , 63 , 54 , 64 , 62 , 66 , 78 , 55 , 70 , 57 , 72 , 75 , 52 , 53 , -1 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , -1 , 1 , 69 , -1 , 81 , -1 , 82 , -1 , 2 , 2 , -1 , 80 , 58 , 59 , 61 , 79 , -1 , 56 , 71 , 68 , 73 , 75 , 75 , 75 , 75 , 77 , 76 , 76 , 76 , 76 , 76 , 76 , 48 , 76 , 76 , 76 , 76 , 17 , 76 , 76 , 76 , 76 , 76 , 26 , 76 , 31 , 16 , 76 , 76 , 76 , 76 , 76 , 33 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , -1 , 84 , -1 , 83 , -1 , 2 , 60 , 74 , 77 , 77 , 77 , 77 , 76 , 76 , 32 , 76 , 76 , 76 , 76 , 76 , 76 , 10 , 76 , 76 , 30 , 76 , 76 , 76 , 41 , 76 , 40 , 34 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 20 , 76 , 76 , 76 , -1 , 76 , 76 , 76 , 13 , 76 , 76 , 76 , 28 , 76 , 76 , 76 , 14 , 76 , 76 , 11 , 47 , 42 , 76 , 76 , 76 , 76 , 76 , 76 , 44 , 76 , 76 , 27 , 45 , 12 , 76 , 76 , 49 , 76 , 38 , 76 , 76 , 37 , 5 , 76 , 76 , 46 , 76 , 76 , 76 , 76 , 76 , 76 , 76 , 15 , 76 , 76 , 43 , 76 , 29 , 76 , 76 , 39 , 76 , 22 , 4 , 76 , 21 , 76 , 76 , 76 , 76 , 76 , 35 , 76 , 76 , 76 , 76 , 76 , 76 , 25 , 3 , 24 , 76 , 76 , 9 , 76 , 76 , 6 , 36 , 76 , 76 , 18 , 76 , 19 , 7 , 23 , 8