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
(text
: String, 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_text
= _text
.substring
(0, accept_length
)
1540 var token
= new TKwmeth.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1541 push_back
(accept_length
)
1546 if accept_token
== 12 then
1547 var token
= new TKwtype.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1548 push_back
(accept_length
)
1553 if accept_token
== 13 then
1554 var token
= new TKwattr.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1555 push_back
(accept_length
)
1560 if accept_token
== 14 then
1561 var token
= new TKwinit.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1562 push_back
(accept_length
)
1567 if accept_token
== 15 then
1568 var token
= new TKwredef.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1569 push_back
(accept_length
)
1574 if accept_token
== 16 then
1575 var token
= new TKwis.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1576 push_back
(accept_length
)
1581 if accept_token
== 17 then
1582 var token
= new TKwdo.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1583 push_back
(accept_length
)
1588 if accept_token
== 18 then
1589 var token
= new TKwreadable.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1590 push_back
(accept_length
)
1595 if accept_token
== 19 then
1596 var token
= new TKwwritable.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1597 push_back
(accept_length
)
1602 if accept_token
== 20 then
1603 var token
= new TKwvar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1604 push_back
(accept_length
)
1609 if accept_token
== 21 then
1610 var token
= new TKwintern.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1611 push_back
(accept_length
)
1616 if accept_token
== 22 then
1617 var token
= new TKwextern.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1618 push_back
(accept_length
)
1623 if accept_token
== 23 then
1624 var token
= new TKwprotected.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1625 push_back
(accept_length
)
1630 if accept_token
== 24 then
1631 var token
= new TKwprivate.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1632 push_back
(accept_length
)
1637 if accept_token
== 25 then
1638 var token
= new TKwintrude.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1639 push_back
(accept_length
)
1644 if accept_token
== 26 then
1645 var token
= new TKwif.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1646 push_back
(accept_length
)
1651 if accept_token
== 27 then
1652 var token
= new TKwthen.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1653 push_back
(accept_length
)
1658 if accept_token
== 28 then
1659 var token
= new TKwelse.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1660 push_back
(accept_length
)
1665 if accept_token
== 29 then
1666 var token
= new TKwwhile.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1667 push_back
(accept_length
)
1672 if accept_token
== 30 then
1673 var token
= new TKwfor.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1674 push_back
(accept_length
)
1679 if accept_token
== 31 then
1680 var token
= new TKwin.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1681 push_back
(accept_length
)
1686 if accept_token
== 32 then
1687 var token
= new TKwand.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1688 push_back
(accept_length
)
1693 if accept_token
== 33 then
1694 var token
= new TKwor.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1695 push_back
(accept_length
)
1700 if accept_token
== 34 then
1701 var token
= new TKwnot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1702 push_back
(accept_length
)
1707 if accept_token
== 35 then
1708 var token
= new TKwreturn.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1709 push_back
(accept_length
)
1714 if accept_token
== 36 then
1715 var token
= new TKwcontinue.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1716 push_back
(accept_length
)
1721 if accept_token
== 37 then
1722 var token
= new TKwbreak.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1723 push_back
(accept_length
)
1728 if accept_token
== 38 then
1729 var token
= new TKwabort.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1730 push_back
(accept_length
)
1735 if accept_token
== 39 then
1736 var token
= new TKwassert.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1737 push_back
(accept_length
)
1742 if accept_token
== 40 then
1743 var token
= new TKwnew.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1744 push_back
(accept_length
)
1749 if accept_token
== 41 then
1750 var token
= new TKwisa.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1751 push_back
(accept_length
)
1756 if accept_token
== 42 then
1757 var token
= new TKwonce.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1758 push_back
(accept_length
)
1763 if accept_token
== 43 then
1764 var token
= new TKwsuper.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1765 push_back
(accept_length
)
1770 if accept_token
== 44 then
1771 var token
= new TKwself.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1772 push_back
(accept_length
)
1777 if accept_token
== 45 then
1778 var token
= new TKwtrue.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1779 push_back
(accept_length
)
1784 if accept_token
== 46 then
1785 var token
= new TKwfalse.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1786 push_back
(accept_length
)
1791 if accept_token
== 47 then
1792 var token
= new TKwnull.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1793 push_back
(accept_length
)
1798 if accept_token
== 48 then
1799 var token
= new TKwas.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1800 push_back
(accept_length
)
1805 if accept_token
== 49 then
1806 var token
= new TKwwith.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1807 push_back
(accept_length
)
1812 if accept_token
== 50 then
1813 var token
= new TOpar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1814 push_back
(accept_length
)
1819 if accept_token
== 51 then
1820 var token
= new TCpar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1821 push_back
(accept_length
)
1826 if accept_token
== 52 then
1827 var token
= new TObra.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1828 push_back
(accept_length
)
1833 if accept_token
== 53 then
1834 var token
= new TCbra.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1835 push_back
(accept_length
)
1840 if accept_token
== 54 then
1841 var token
= new TComma.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1842 push_back
(accept_length
)
1847 if accept_token
== 55 then
1848 var token
= new TColumn.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1849 push_back
(accept_length
)
1854 if accept_token
== 56 then
1855 var token
= new TQuad.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1856 push_back
(accept_length
)
1861 if accept_token
== 57 then
1862 var token
= new TAssign.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1863 push_back
(accept_length
)
1868 if accept_token
== 58 then
1869 var token
= new TPluseq.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1870 push_back
(accept_length
)
1875 if accept_token
== 59 then
1876 var token
= new TMinuseq.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1877 push_back
(accept_length
)
1882 if accept_token
== 60 then
1883 var token
= new TDotdotdot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1884 push_back
(accept_length
)
1889 if accept_token
== 61 then
1890 var token
= new TDotdot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1891 push_back
(accept_length
)
1896 if accept_token
== 62 then
1897 var token
= new TDot.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1898 push_back
(accept_length
)
1903 if accept_token
== 63 then
1904 var token
= new TPlus.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1905 push_back
(accept_length
)
1910 if accept_token
== 64 then
1911 var token
= new TMinus.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1912 push_back
(accept_length
)
1917 if accept_token
== 65 then
1918 var token
= new TStar.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1919 push_back
(accept_length
)
1924 if accept_token
== 66 then
1925 var token
= new TSlash.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1926 push_back
(accept_length
)
1931 if accept_token
== 67 then
1932 var token
= new TPercent.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1933 push_back
(accept_length
)
1938 if accept_token
== 68 then
1939 var token
= new TEq.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1940 push_back
(accept_length
)
1945 if accept_token
== 69 then
1946 var token
= new TNe.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1947 push_back
(accept_length
)
1952 if accept_token
== 70 then
1953 var token
= new TLt.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1954 push_back
(accept_length
)
1959 if accept_token
== 71 then
1960 var token
= new TLe.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1961 push_back
(accept_length
)
1966 if accept_token
== 72 then
1967 var token
= new TGt.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1968 push_back
(accept_length
)
1973 if accept_token
== 73 then
1974 var token
= new TGe.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1975 push_back
(accept_length
)
1980 if accept_token
== 74 then
1981 var token
= new TStarship.init_tk
(_filename
, start_line
+ 1, start_pos
+ 1)
1982 push_back
(accept_length
)
1987 if accept_token
== 75 then
1988 var token_text
= _text
.substring
(0, accept_length
)
1989 var token
= new TClassid.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1990 push_back
(accept_length
)
1995 if accept_token
== 76 then
1996 var token_text
= _text
.substring
(0, accept_length
)
1997 var token
= new TId.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
1998 push_back
(accept_length
)
2003 if accept_token
== 77 then
2004 var token_text
= _text
.substring
(0, accept_length
)
2005 var token
= new TAttrid.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2006 push_back
(accept_length
)
2011 if accept_token
== 78 then
2012 var token_text
= _text
.substring
(0, accept_length
)
2013 var token
= new TNumber.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2014 push_back
(accept_length
)
2019 if accept_token
== 79 then
2020 var token_text
= _text
.substring
(0, accept_length
)
2021 var token
= new TFloat.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2022 push_back
(accept_length
)
2027 if accept_token
== 80 then
2028 var token_text
= _text
.substring
(0, accept_length
)
2029 var token
= new TChar.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2030 push_back
(accept_length
)
2035 if accept_token
== 81 then
2036 var token_text
= _text
.substring
(0, accept_length
)
2037 var token
= new TString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2038 push_back
(accept_length
)
2043 if accept_token
== 82 then
2044 var token_text
= _text
.substring
(0, accept_length
)
2045 var token
= new TStartString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2046 push_back
(accept_length
)
2051 if accept_token
== 83 then
2052 var token_text
= _text
.substring
(0, accept_length
)
2053 var token
= new TMidString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2054 push_back
(accept_length
)
2059 if accept_token
== 84 then
2060 var token_text
= _text
.substring
(0, accept_length
)
2061 var token
= new TEndString.init_tk
(token_text
, _filename
, start_line
+ 1, start_pos
+ 1)
2062 push_back
(accept_length
)
2068 if _text
.length
> 0 then
2069 var token
= new PError.init_error
(_filename
, start_line
+ 1, start_pos
+ 1, "Unknown token: {_text}")
2072 var token
= new EOF(_filename
, start_line
+ 1, start_pos
+ 1)
2081 # Read the next character.
2082 # The character is read from the stream of from the pushback buffer.
2083 private meth get_char
: Int
2091 var sp
= _stream_pos
2093 var res
= _stream_buf
[_stream_pos
]
2094 _stream_pos
= sp
- 1
2097 result
= _stream
.read_char
2100 if result
== -1 then
2107 # Unread some characters.
2108 # Unread characters are stored in the pushback buffer.
2109 private meth push_back
(accept_length
: Int)
2111 var length
= _text
.length
2113 while i
>= accept_length
do
2115 _stream_pos
= _stream_pos
+ 1
2116 _stream_buf
[_stream_pos
] = _text
[i
]
2121 attr _goto_table
: Array[Array[Array[Array[Int]]]]
2122 private meth build_goto_table
2124 _goto_table
= once
[
3297 private meth nil_array
: Array[Array[Int]]
3299 return once
new Array[Array[Int]]
3302 attr _accept_table
: Array[Array[Int]]
3303 private meth build_accept_table
do
3304 _accept_table
= once
[
3306 -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 , 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 , 11 , 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