ext/yylex.c in cast-0.2.1 vs ext/yylex.c in cast-0.3.0
- old
+ new
@@ -1,12 +1,13 @@
-/* Generated by re2c 0.13.5 on Wed Dec 19 08:36:43 2012 */
+/* Generated by re2c 0.14.3 on Sun Mar 20 23:58:53 2016 */
#line 1 "ext/yylex.re"
/* -*- mode: c -*- */
/* Given to re2c to generate the lexer `yylex'.
*
* Based on c.re in the exmaples distributed with re2c.
*/
+#include <stdio.h>
#include <string.h>
#include "cast.h"
/*
* -------------------------------------------------------------------
@@ -31,10 +32,11 @@
set_func(IntLiteral, suffix);
new_func(FloatLiteral);
set_func(FloatLiteral, format);
set_func(FloatLiteral, val);
+set_func(FloatLiteral, exponent);
set_func(FloatLiteral, suffix);
new_func(CharLiteral);
set_func(CharLiteral, prefix);
set_func(CharLiteral, val);
@@ -75,18 +77,18 @@
/* `token' is assumed to be a two element array, which is filled in.
*/
void yylex(VALUE self, cast_Parser *p) {
char *cursor = p->cur;
- char *cp;
+ char *cp, *ep;
VALUE value;
std:
p->tok = cursor;
- #line 94 "ext/yylex.re"
+ #line 96 "ext/yylex.re"
-#line 88 "<stdout>"
+#line 90 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
if ((YYLIMIT - YYCURSOR) < 11) YYFILL(11);
@@ -196,13 +198,13 @@
case '/': goto yy430;
case '=': goto yy428;
default: goto yy3;
}
yy3:
-#line 254 "ext/yylex.re"
+#line 270 "ext/yylex.re"
{ RET(cast_sym_DIV); }
-#line 204 "<stdout>"
+#line 206 "<stdout>"
yy4:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch (yych) {
case '"': goto yy131;
@@ -271,21 +273,21 @@
case 'z': goto yy233;
case 'u': goto yy424;
default: goto yy5;
}
yy5:
-#line 137 "ext/yylex.re"
+#line 139 "ext/yylex.re"
{
value = rb_str_new(p->tok, cursor - p->tok);
if (rb_funcall2(rb_funcall2(self, rb_intern("type_names"), 0, NULL),
rb_intern("include?"), 1, &value) == Qtrue) {
RETVALUE(cast_sym_TYPENAME);
} else {
RETVALUE(cast_sym_ID);
}
}
-#line 287 "<stdout>"
+#line 289 "<stdout>"
yy6:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch (yych) {
case '"': goto yy131;
@@ -1444,20 +1446,20 @@
case 'x': goto yy187;
case 'l': goto yy169;
default: goto yy23;
}
yy23:
-#line 166 "ext/yylex.re"
+#line 168 "ext/yylex.re"
{
value = cast_new_IntLiteral_at(p->lineno);
cast_IntLiteral_set_format(value, ID2SYM(rb_intern("dec")));
cast_IntLiteral_set_val(value, LONG2NUM(strtol(p->tok, (char **)&cp, 10)));
if (cp < cursor)
cast_IntLiteral_set_suffix(value, rb_str_new(cp, cursor - cp));
RETVALUE(cast_sym_ICON);
}
-#line 1459 "<stdout>"
+#line 1461 "<stdout>"
yy24:
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
goto yy165;
yy25:
@@ -1476,27 +1478,27 @@
case '8':
case '9': goto yy153;
default: goto yy26;
}
yy26:
-#line 247 "ext/yylex.re"
+#line 263 "ext/yylex.re"
{ RET(cast_sym_DOT); }
-#line 1484 "<stdout>"
+#line 1486 "<stdout>"
yy27:
yyaccept = 3;
yych = *(YYMARKER = ++YYCURSOR);
switch (yych) {
case '\'': goto yy28;
default: goto yy143;
}
yy28:
-#line 282 "ext/yylex.re"
+#line 298 "ext/yylex.re"
{
rb_raise(cast_eParseError, "%ld: unexpected character: %c (ASCII %d)\n", p->lineno, *p->tok, (int)*p->tok);
goto std;
}
-#line 1498 "<stdout>"
+#line 1500 "<stdout>"
yy29:
yyaccept = 3;
yych = *(YYMARKER = ++YYCURSOR);
goto yy132;
yy30:
@@ -1505,206 +1507,206 @@
case '=': goto yy125;
case '>': goto yy127;
default: goto yy31;
}
yy31:
-#line 257 "ext/yylex.re"
+#line 273 "ext/yylex.re"
{ RET(cast_sym_GT); }
-#line 1513 "<stdout>"
+#line 1515 "<stdout>"
yy32:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '%': goto yy115;
case ':': goto yy117;
case '<': goto yy121;
case '=': goto yy119;
default: goto yy33;
}
yy33:
-#line 256 "ext/yylex.re"
+#line 272 "ext/yylex.re"
{ RET(cast_sym_LT); }
-#line 1526 "<stdout>"
+#line 1528 "<stdout>"
yy34:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '+': goto yy111;
case '=': goto yy113;
default: goto yy35;
}
yy35:
-#line 252 "ext/yylex.re"
+#line 268 "ext/yylex.re"
{ RET(cast_sym_ADD); }
-#line 1537 "<stdout>"
+#line 1539 "<stdout>"
yy36:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '-': goto yy107;
case '=': goto yy109;
case '>': goto yy105;
default: goto yy37;
}
yy37:
-#line 251 "ext/yylex.re"
+#line 267 "ext/yylex.re"
{ RET(cast_sym_SUB); }
-#line 1549 "<stdout>"
+#line 1551 "<stdout>"
yy38:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '=': goto yy103;
default: goto yy39;
}
yy39:
-#line 253 "ext/yylex.re"
+#line 269 "ext/yylex.re"
{ RET(cast_sym_MUL); }
-#line 1559 "<stdout>"
+#line 1561 "<stdout>"
yy40:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '=': goto yy101;
case '>': goto yy99;
default: goto yy41;
}
yy41:
-#line 255 "ext/yylex.re"
+#line 271 "ext/yylex.re"
{ RET(cast_sym_MOD); }
-#line 1570 "<stdout>"
+#line 1572 "<stdout>"
yy42:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '&': goto yy95;
case '=': goto yy97;
default: goto yy43;
}
yy43:
-#line 248 "ext/yylex.re"
+#line 264 "ext/yylex.re"
{ RET(cast_sym_AND); }
-#line 1581 "<stdout>"
+#line 1583 "<stdout>"
yy44:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '=': goto yy93;
default: goto yy45;
}
yy45:
-#line 258 "ext/yylex.re"
+#line 274 "ext/yylex.re"
{ RET(cast_sym_XOR); }
-#line 1591 "<stdout>"
+#line 1593 "<stdout>"
yy46:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '=': goto yy91;
case '|': goto yy89;
default: goto yy47;
}
yy47:
-#line 259 "ext/yylex.re"
+#line 275 "ext/yylex.re"
{ RET(cast_sym_OR); }
-#line 1602 "<stdout>"
+#line 1604 "<stdout>"
yy48:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '=': goto yy87;
default: goto yy49;
}
yy49:
-#line 242 "ext/yylex.re"
+#line 258 "ext/yylex.re"
{ RET(cast_sym_EQ); }
-#line 1612 "<stdout>"
+#line 1614 "<stdout>"
yy50:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '=': goto yy85;
default: goto yy51;
}
yy51:
-#line 249 "ext/yylex.re"
+#line 265 "ext/yylex.re"
{ RET(cast_sym_BANG); }
-#line 1622 "<stdout>"
+#line 1624 "<stdout>"
yy52:
++YYCURSOR;
-#line 237 "ext/yylex.re"
+#line 253 "ext/yylex.re"
{ RET(cast_sym_SEMICOLON); }
-#line 1627 "<stdout>"
+#line 1629 "<stdout>"
yy54:
++YYCURSOR;
-#line 238 "ext/yylex.re"
+#line 254 "ext/yylex.re"
{ RET(cast_sym_LBRACE); }
-#line 1632 "<stdout>"
+#line 1634 "<stdout>"
yy56:
++YYCURSOR;
-#line 239 "ext/yylex.re"
+#line 255 "ext/yylex.re"
{ RET(cast_sym_RBRACE); }
-#line 1637 "<stdout>"
+#line 1639 "<stdout>"
yy58:
++YYCURSOR;
-#line 240 "ext/yylex.re"
+#line 256 "ext/yylex.re"
{ RET(cast_sym_COMMA); }
-#line 1642 "<stdout>"
+#line 1644 "<stdout>"
yy60:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '>': goto yy83;
default: goto yy61;
}
yy61:
-#line 241 "ext/yylex.re"
+#line 257 "ext/yylex.re"
{ RET(cast_sym_COLON); }
-#line 1652 "<stdout>"
+#line 1654 "<stdout>"
yy62:
++YYCURSOR;
-#line 243 "ext/yylex.re"
+#line 259 "ext/yylex.re"
{ RET(cast_sym_LPAREN); }
-#line 1657 "<stdout>"
+#line 1659 "<stdout>"
yy64:
++YYCURSOR;
-#line 244 "ext/yylex.re"
+#line 260 "ext/yylex.re"
{ RET(cast_sym_RPAREN); }
-#line 1662 "<stdout>"
+#line 1664 "<stdout>"
yy66:
++YYCURSOR;
-#line 245 "ext/yylex.re"
+#line 261 "ext/yylex.re"
{ RET(cast_sym_LBRACKET); }
-#line 1667 "<stdout>"
+#line 1669 "<stdout>"
yy68:
++YYCURSOR;
-#line 246 "ext/yylex.re"
+#line 262 "ext/yylex.re"
{ RET(cast_sym_RBRACKET); }
-#line 1672 "<stdout>"
+#line 1674 "<stdout>"
yy70:
++YYCURSOR;
-#line 250 "ext/yylex.re"
+#line 266 "ext/yylex.re"
{ RET(cast_sym_NOT); }
-#line 1677 "<stdout>"
+#line 1679 "<stdout>"
yy72:
++YYCURSOR;
-#line 260 "ext/yylex.re"
+#line 276 "ext/yylex.re"
{ RET(cast_sym_QUESTION); }
-#line 1682 "<stdout>"
+#line 1684 "<stdout>"
yy74:
++YYCURSOR;
yych = *YYCURSOR;
goto yy82;
yy75:
-#line 267 "ext/yylex.re"
+#line 283 "ext/yylex.re"
{ goto std; }
-#line 1690 "<stdout>"
+#line 1692 "<stdout>"
yy76:
++YYCURSOR;
-#line 270 "ext/yylex.re"
+#line 286 "ext/yylex.re"
{
if(cursor == p->eof) RET(Qnil);
goto std;
}
-#line 1698 "<stdout>"
+#line 1700 "<stdout>"
yy78:
++YYCURSOR;
-#line 276 "ext/yylex.re"
+#line 292 "ext/yylex.re"
{
p->pos = cursor; ++p->lineno;
goto std;
}
-#line 1706 "<stdout>"
+#line 1708 "<stdout>"
yy80:
yych = *++YYCURSOR;
goto yy28;
yy81:
++YYCURSOR;
@@ -1718,138 +1720,138 @@
case ' ': goto yy81;
default: goto yy75;
}
yy83:
++YYCURSOR;
-#line 264 "ext/yylex.re"
+#line 280 "ext/yylex.re"
{ RET(cast_sym_RBRACKET); }
-#line 1726 "<stdout>"
+#line 1728 "<stdout>"
yy85:
++YYCURSOR;
-#line 236 "ext/yylex.re"
+#line 252 "ext/yylex.re"
{ RET(cast_sym_NEQ); }
-#line 1731 "<stdout>"
+#line 1733 "<stdout>"
yy87:
++YYCURSOR;
-#line 235 "ext/yylex.re"
+#line 251 "ext/yylex.re"
{ RET(cast_sym_EQEQ); }
-#line 1736 "<stdout>"
+#line 1738 "<stdout>"
yy89:
++YYCURSOR;
-#line 232 "ext/yylex.re"
+#line 248 "ext/yylex.re"
{ RET(cast_sym_OROR); }
-#line 1741 "<stdout>"
+#line 1743 "<stdout>"
yy91:
++YYCURSOR;
-#line 225 "ext/yylex.re"
+#line 241 "ext/yylex.re"
{ RET(cast_sym_OREQ); }
-#line 1746 "<stdout>"
+#line 1748 "<stdout>"
yy93:
++YYCURSOR;
-#line 224 "ext/yylex.re"
+#line 240 "ext/yylex.re"
{ RET(cast_sym_XOREQ); }
-#line 1751 "<stdout>"
+#line 1753 "<stdout>"
yy95:
++YYCURSOR;
-#line 231 "ext/yylex.re"
+#line 247 "ext/yylex.re"
{ RET(cast_sym_ANDAND); }
-#line 1756 "<stdout>"
+#line 1758 "<stdout>"
yy97:
++YYCURSOR;
-#line 223 "ext/yylex.re"
+#line 239 "ext/yylex.re"
{ RET(cast_sym_ANDEQ); }
-#line 1761 "<stdout>"
+#line 1763 "<stdout>"
yy99:
++YYCURSOR;
-#line 265 "ext/yylex.re"
+#line 281 "ext/yylex.re"
{ RET(cast_sym_RBRACE); }
-#line 1766 "<stdout>"
+#line 1768 "<stdout>"
yy101:
++YYCURSOR;
-#line 222 "ext/yylex.re"
+#line 238 "ext/yylex.re"
{ RET(cast_sym_MODEQ); }
-#line 1771 "<stdout>"
+#line 1773 "<stdout>"
yy103:
++YYCURSOR;
-#line 220 "ext/yylex.re"
+#line 236 "ext/yylex.re"
{ RET(cast_sym_MULEQ); }
-#line 1776 "<stdout>"
+#line 1778 "<stdout>"
yy105:
++YYCURSOR;
-#line 230 "ext/yylex.re"
+#line 246 "ext/yylex.re"
{ RET(cast_sym_ARROW); }
-#line 1781 "<stdout>"
+#line 1783 "<stdout>"
yy107:
++YYCURSOR;
-#line 229 "ext/yylex.re"
+#line 245 "ext/yylex.re"
{ RET(cast_sym_DEC); }
-#line 1786 "<stdout>"
+#line 1788 "<stdout>"
yy109:
++YYCURSOR;
-#line 219 "ext/yylex.re"
+#line 235 "ext/yylex.re"
{ RET(cast_sym_SUBEQ); }
-#line 1791 "<stdout>"
+#line 1793 "<stdout>"
yy111:
++YYCURSOR;
-#line 228 "ext/yylex.re"
+#line 244 "ext/yylex.re"
{ RET(cast_sym_INC); }
-#line 1796 "<stdout>"
+#line 1798 "<stdout>"
yy113:
++YYCURSOR;
-#line 218 "ext/yylex.re"
+#line 234 "ext/yylex.re"
{ RET(cast_sym_ADDEQ); }
-#line 1801 "<stdout>"
+#line 1803 "<stdout>"
yy115:
++YYCURSOR;
-#line 263 "ext/yylex.re"
+#line 279 "ext/yylex.re"
{ RET(cast_sym_LBRACE); }
-#line 1806 "<stdout>"
+#line 1808 "<stdout>"
yy117:
++YYCURSOR;
-#line 262 "ext/yylex.re"
+#line 278 "ext/yylex.re"
{ RET(cast_sym_LBRACKET); }
-#line 1811 "<stdout>"
+#line 1813 "<stdout>"
yy119:
++YYCURSOR;
-#line 233 "ext/yylex.re"
+#line 249 "ext/yylex.re"
{ RET(cast_sym_LEQ); }
-#line 1816 "<stdout>"
+#line 1818 "<stdout>"
yy121:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '=': goto yy123;
default: goto yy122;
}
yy122:
-#line 227 "ext/yylex.re"
+#line 243 "ext/yylex.re"
{ RET(cast_sym_LSHIFT); }
-#line 1826 "<stdout>"
+#line 1828 "<stdout>"
yy123:
++YYCURSOR;
-#line 217 "ext/yylex.re"
+#line 233 "ext/yylex.re"
{ RET(cast_sym_LSHIFTEQ); }
-#line 1831 "<stdout>"
+#line 1833 "<stdout>"
yy125:
++YYCURSOR;
-#line 234 "ext/yylex.re"
+#line 250 "ext/yylex.re"
{ RET(cast_sym_GEQ); }
-#line 1836 "<stdout>"
+#line 1838 "<stdout>"
yy127:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '=': goto yy129;
default: goto yy128;
}
yy128:
-#line 226 "ext/yylex.re"
+#line 242 "ext/yylex.re"
{ RET(cast_sym_RSHIFT); }
-#line 1846 "<stdout>"
+#line 1848 "<stdout>"
yy129:
++YYCURSOR;
-#line 216 "ext/yylex.re"
+#line 232 "ext/yylex.re"
{ RET(cast_sym_RSHIFTEQ); }
-#line 1851 "<stdout>"
+#line 1853 "<stdout>"
yy131:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
yy132:
@@ -1892,16 +1894,15 @@
case 1: goto yy23;
case 2: goto yy26;
case 3: goto yy28;
case 4: goto yy155;
case 5: goto yy190;
- case 6: goto yy200;
- case 7: goto yy204;
+ default: goto yy200;
}
yy135:
++YYCURSOR;
-#line 203 "ext/yylex.re"
+#line 219 "ext/yylex.re"
{
value = cast_new_StringLiteral_at(p->lineno);
if (p->tok[0] == '"') {
cp = p->tok;
} else {
@@ -1909,11 +1910,11 @@
cp = p->tok + 1;
}
cast_StringLiteral_set_val(value, rb_str_new(cp + 1, cursor - cp - 2));
RETVALUE(cast_sym_SCON);
}
-#line 1915 "<stdout>"
+#line 1916 "<stdout>"
yy137:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch (yych) {
@@ -2112,11 +2113,11 @@
case '\\': goto yy144;
default: goto yy142;
}
yy149:
++YYCURSOR;
-#line 192 "ext/yylex.re"
+#line 208 "ext/yylex.re"
{
value = cast_new_CharLiteral_at(p->lineno);
if (p->tok[0] == '\'') {
cp = p->tok;
} else {
@@ -2124,11 +2125,11 @@
cp = p->tok + 1;
}
cast_CharLiteral_set_val(value, rb_str_new(cp + 1, cursor - cp - 2));
RETVALUE(cast_sym_CCON);
}
-#line 2130 "<stdout>"
+#line 2131 "<stdout>"
yy151:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch (yych) {
@@ -2165,20 +2166,27 @@
case 'f':
case 'l': goto yy157;
default: goto yy155;
}
yy155:
-#line 175 "ext/yylex.re"
+#line 177 "ext/yylex.re"
{
value = cast_new_FloatLiteral_at(p->lineno);
cast_FloatLiteral_set_format(value, ID2SYM(rb_intern("dec")));
cast_FloatLiteral_set_val(value, rb_float_new(strtod(p->tok, (char **)&cp)));
if (cp < cursor)
- cast_FloatLiteral_set_suffix(value, rb_str_new(cp, cursor - cp));
+ cast_FloatLiteral_set_suffix(value, rb_str_new(cp, cursor - cp));
+
+ ep = (char *)memchr(p->tok, 'e', cp - p->tok);
+ if (!ep)
+ ep = (char *)memchr(p->tok, 'E', cp - p->tok);
+ if (ep)
+ cast_FloatLiteral_set_exponent(value, LONG2NUM(strtod(ep + 1, NULL)));
+
RETVALUE(cast_sym_FCON);
}
-#line 2180 "<stdout>"
+#line 2188 "<stdout>"
yy156:
yych = *++YYCURSOR;
switch (yych) {
case '+':
case '-': goto yy158;
@@ -2233,13 +2241,13 @@
case 'l': goto yy157;
default: goto yy155;
}
yy161:
++YYCURSOR;
-#line 215 "ext/yylex.re"
+#line 231 "ext/yylex.re"
{ RET(cast_sym_ELLIPSIS); }
-#line 2241 "<stdout>"
+#line 2249 "<stdout>"
yy163:
yyaccept = 4;
yych = *(YYMARKER = ++YYCURSOR);
switch (yych) {
case 'E':
@@ -2553,11 +2561,11 @@
case 'u': goto yy191;
case 'l': goto yy193;
default: goto yy190;
}
yy190:
-#line 155 "ext/yylex.re"
+#line 157 "ext/yylex.re"
{
value = cast_new_IntLiteral_at(p->lineno);
cast_IntLiteral_set_format(value, ID2SYM(rb_intern("oct")));
cast_IntLiteral_set_val(value, LONG2NUM(strtol(p->tok, (char **)&cp, 8)));
if (cp < cursor) {
@@ -2565,11 +2573,11 @@
rb_raise(cast_eParseError, "bad octal digit: %c", cp[0]);
cast_IntLiteral_set_suffix(value, rb_str_new(cp, cursor - cp));
}
RETVALUE(cast_sym_ICON);
}
-#line 2571 "<stdout>"
+#line 2579 "<stdout>"
yy191:
yych = *++YYCURSOR;
switch (yych) {
case 'L': goto yy196;
case 'l': goto yy197;
@@ -2649,52 +2657,32 @@
case 'u': goto yy212;
case 'l': goto yy214;
default: goto yy200;
}
yy200:
-#line 147 "ext/yylex.re"
+#line 149 "ext/yylex.re"
{
value = cast_new_IntLiteral_at(p->lineno);
cast_IntLiteral_set_format(value, ID2SYM(rb_intern("hex")));
cast_IntLiteral_set_val(value, LONG2NUM(strtol(p->tok, (char **)&cp, 16)));
if (cp < cursor)
cast_IntLiteral_set_suffix(value, rb_str_new(cp, cursor - cp));
RETVALUE(cast_sym_ICON);
}
-#line 2664 "<stdout>"
+#line 2672 "<stdout>"
yy201:
yych = *++YYCURSOR;
switch (yych) {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f': goto yy202;
- default: goto yy134;
+ case 'P':
+ case 'p': goto yy134;
+ default: goto yy203;
}
yy202:
- yyaccept = 7;
- YYMARKER = ++YYCURSOR;
+ ++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
+yy203:
switch (yych) {
case '0':
case '1':
case '2':
case '3':
@@ -2714,63 +2702,47 @@
case 'b':
case 'c':
case 'd':
case 'e':
case 'f': goto yy202;
- case 'L':
- case 'l': goto yy206;
case 'P':
- case 'p': goto yy205;
- default: goto yy204;
+ case 'p': goto yy204;
+ default: goto yy134;
}
yy204:
-#line 183 "ext/yylex.re"
- {
- value = cast_new_FloatLiteral_at(p->lineno);
- cast_FloatLiteral_set_format(value, ID2SYM(rb_intern("hex")));
- cast_FloatLiteral_set_val(value, rb_float_new(strtod(p->tok, (char **)&cp)));
- if (cp < cursor)
- cast_FloatLiteral_set_suffix(value, rb_str_new(cp, cursor - cp));
- RETVALUE(cast_sym_FCON);
- }
-#line 2736 "<stdout>"
-yy205:
yych = *++YYCURSOR;
switch (yych) {
case '+':
- case '-': goto yy207;
+ case '-': goto yy205;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
- case '9': goto yy208;
+ case '9': goto yy206;
default: goto yy134;
}
-yy206:
+yy205:
yych = *++YYCURSOR;
- goto yy204;
-yy207:
- yych = *++YYCURSOR;
switch (yych) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
- case '9': goto yy208;
+ case '9': goto yy206;
default: goto yy134;
}
-yy208:
+yy206:
++YYCURSOR;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch (yych) {
case '0':
@@ -2780,20 +2752,40 @@
case '4':
case '5':
case '6':
case '7':
case '8':
- case '9': goto yy208;
+ case '9': goto yy206;
case 'F':
case 'L':
case 'f':
- case 'l': goto yy206;
- default: goto yy204;
+ case 'l': goto yy209;
+ default: goto yy208;
}
+yy208:
+#line 192 "ext/yylex.re"
+ {
+ value = cast_new_FloatLiteral_at(p->lineno);
+ cast_FloatLiteral_set_format(value, ID2SYM(rb_intern("hex")));
+ cast_FloatLiteral_set_val(value, rb_float_new(strtod(p->tok, (char **)&cp)));
+ if (cp < cursor)
+ cast_FloatLiteral_set_suffix(value, rb_str_new(cp, cursor - cp));
+
+ ep = (char *)memchr(p->tok, 'p', cp - p->tok);
+ if (!ep)
+ ep = (char *)memchr(p->tok, 'P', cp - p->tok);
+ if (ep)
+ cast_FloatLiteral_set_exponent(value, LONG2NUM(strtod(ep + 1, NULL)));
+
+ RETVALUE(cast_sym_FCON);
+ }
+#line 2782 "<stdout>"
+yy209:
+ yych = *++YYCURSOR;
+ goto yy208;
yy210:
- yyaccept = 7;
- yych = *(YYMARKER = ++YYCURSOR);
+ yych = *++YYCURSOR;
switch (yych) {
case 'P':
case 'p': goto yy224;
default: goto yy223;
}
@@ -2890,16 +2882,15 @@
case '8':
case '9': goto yy220;
case 'F':
case 'L':
case 'f':
- case 'l': goto yy206;
- default: goto yy204;
+ case 'l': goto yy209;
+ default: goto yy208;
}
yy222:
- yyaccept = 7;
- YYMARKER = ++YYCURSOR;
+ ++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
yych = *YYCURSOR;
yy223:
switch (yych) {
case '0':
@@ -2922,15 +2913,13 @@
case 'b':
case 'c':
case 'd':
case 'e':
case 'f': goto yy222;
- case 'L':
- case 'l': goto yy206;
case 'P':
case 'p': goto yy228;
- default: goto yy204;
+ default: goto yy134;
}
yy224:
yych = *++YYCURSOR;
switch (yych) {
case '+':
@@ -2978,12 +2967,12 @@
case '8':
case '9': goto yy226;
case 'F':
case 'L':
case 'f':
- case 'l': goto yy206;
- default: goto yy204;
+ case 'l': goto yy209;
+ default: goto yy208;
}
yy228:
yych = *++YYCURSOR;
switch (yych) {
case '+':
@@ -3031,12 +3020,12 @@
case '8':
case '9': goto yy230;
case 'F':
case 'L':
case 'f':
- case 'l': goto yy206;
- default: goto yy204;
+ case 'l': goto yy209;
+ default: goto yy208;
}
yy232:
yych = *++YYCURSOR;
switch (yych) {
case '\'': goto yy134;
@@ -3240,13 +3229,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy246;
}
yy246:
-#line 135 "ext/yylex.re"
+#line 137 "ext/yylex.re"
{ RET(cast_sym_IMAGINARY); }
-#line 3248 "<stdout>"
+#line 3237 "<stdout>"
yy247:
yych = *++YYCURSOR;
switch (yych) {
case 'm': goto yy248;
default: goto yy234;
@@ -3342,13 +3331,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy253;
}
yy253:
-#line 134 "ext/yylex.re"
+#line 136 "ext/yylex.re"
{ RET(cast_sym_COMPLEX); }
-#line 3350 "<stdout>"
+#line 3339 "<stdout>"
yy254:
yych = *++YYCURSOR;
switch (yych) {
case 'o': goto yy255;
default: goto yy234;
@@ -3426,13 +3415,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy257;
}
yy257:
-#line 133 "ext/yylex.re"
+#line 135 "ext/yylex.re"
{ RET(cast_sym_BOOL); }
-#line 3434 "<stdout>"
+#line 3423 "<stdout>"
yy258:
yych = *++YYCURSOR;
switch (yych) {
case 'i': goto yy259;
default: goto yy234;
@@ -3516,13 +3505,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy262;
}
yy262:
-#line 130 "ext/yylex.re"
+#line 132 "ext/yylex.re"
{ RET(cast_sym_WHILE); }
-#line 3524 "<stdout>"
+#line 3513 "<stdout>"
yy263:
yych = *++YYCURSOR;
switch (yych) {
case 'i': goto yy264;
case 'l': goto yy265;
@@ -3631,13 +3620,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy271;
}
yy271:
-#line 129 "ext/yylex.re"
+#line 131 "ext/yylex.re"
{ RET(cast_sym_VOLATILE); }
-#line 3639 "<stdout>"
+#line 3628 "<stdout>"
yy272:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '0':
case '1':
@@ -3703,13 +3692,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy273;
}
yy273:
-#line 128 "ext/yylex.re"
+#line 130 "ext/yylex.re"
{ RET(cast_sym_VOID); }
-#line 3711 "<stdout>"
+#line 3700 "<stdout>"
yy274:
yych = *++YYCURSOR;
switch (yych) {
case 'i': goto yy275;
case 's': goto yy276;
@@ -3818,13 +3807,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy282;
}
yy282:
-#line 127 "ext/yylex.re"
+#line 129 "ext/yylex.re"
{ RET(cast_sym_UNSIGNED); }
-#line 3826 "<stdout>"
+#line 3815 "<stdout>"
yy283:
yych = *++YYCURSOR;
switch (yych) {
case 'n': goto yy284;
default: goto yy234;
@@ -3896,13 +3885,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy285;
}
yy285:
-#line 126 "ext/yylex.re"
+#line 128 "ext/yylex.re"
{ RET(cast_sym_UNION); }
-#line 3904 "<stdout>"
+#line 3893 "<stdout>"
yy286:
yych = *++YYCURSOR;
switch (yych) {
case 'p': goto yy287;
default: goto yy234;
@@ -3998,13 +3987,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy292;
}
yy292:
-#line 125 "ext/yylex.re"
+#line 127 "ext/yylex.re"
{ RET(cast_sym_TYPEDEF); }
-#line 4006 "<stdout>"
+#line 3995 "<stdout>"
yy293:
yych = *++YYCURSOR;
switch (yych) {
case 'o': goto yy322;
default: goto yy234;
@@ -4114,13 +4103,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy301;
}
yy301:
-#line 124 "ext/yylex.re"
+#line 126 "ext/yylex.re"
{ RET(cast_sym_SWITCH); }
-#line 4122 "<stdout>"
+#line 4111 "<stdout>"
yy302:
yych = *++YYCURSOR;
switch (yych) {
case 't': goto yy308;
default: goto yy234;
@@ -4210,13 +4199,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy307;
}
yy307:
-#line 123 "ext/yylex.re"
+#line 125 "ext/yylex.re"
{ RET(cast_sym_STRUCT); }
-#line 4218 "<stdout>"
+#line 4207 "<stdout>"
yy308:
yych = *++YYCURSOR;
switch (yych) {
case 'i': goto yy309;
default: goto yy234;
@@ -4294,13 +4283,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy311;
}
yy311:
-#line 122 "ext/yylex.re"
+#line 124 "ext/yylex.re"
{ RET(cast_sym_STATIC); }
-#line 4302 "<stdout>"
+#line 4291 "<stdout>"
yy312:
yych = *++YYCURSOR;
switch (yych) {
case 'n': goto yy318;
default: goto yy234;
@@ -4390,13 +4379,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy317;
}
yy317:
-#line 121 "ext/yylex.re"
+#line 123 "ext/yylex.re"
{ RET(cast_sym_SIZEOF); }
-#line 4398 "<stdout>"
+#line 4387 "<stdout>"
yy318:
yych = *++YYCURSOR;
switch (yych) {
case 'e': goto yy319;
default: goto yy234;
@@ -4474,13 +4463,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy321;
}
yy321:
-#line 120 "ext/yylex.re"
+#line 122 "ext/yylex.re"
{ RET(cast_sym_SIGNED); }
-#line 4482 "<stdout>"
+#line 4471 "<stdout>"
yy322:
yych = *++YYCURSOR;
switch (yych) {
case 'r': goto yy323;
default: goto yy234;
@@ -4558,13 +4547,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy325;
}
yy325:
-#line 119 "ext/yylex.re"
+#line 121 "ext/yylex.re"
{ RET(cast_sym_SHORT); }
-#line 4566 "<stdout>"
+#line 4555 "<stdout>"
yy326:
yych = *++YYCURSOR;
switch (yych) {
case 'g': goto yy327;
case 's': goto yy329;
@@ -4680,13 +4669,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy335;
}
yy335:
-#line 132 "ext/yylex.re"
+#line 134 "ext/yylex.re"
{ RET(cast_sym_RESTRICT); }
-#line 4688 "<stdout>"
+#line 4677 "<stdout>"
yy336:
yych = *++YYCURSOR;
switch (yych) {
case 'r': goto yy337;
default: goto yy234;
@@ -4764,13 +4753,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy339;
}
yy339:
-#line 118 "ext/yylex.re"
+#line 120 "ext/yylex.re"
{ RET(cast_sym_RETURN); }
-#line 4772 "<stdout>"
+#line 4761 "<stdout>"
yy340:
yych = *++YYCURSOR;
switch (yych) {
case 's': goto yy341;
default: goto yy234;
@@ -4860,13 +4849,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy345;
}
yy345:
-#line 117 "ext/yylex.re"
+#line 119 "ext/yylex.re"
{ RET(cast_sym_REGISTER); }
-#line 4868 "<stdout>"
+#line 4857 "<stdout>"
yy346:
yych = *++YYCURSOR;
switch (yych) {
case 'n': goto yy347;
default: goto yy234;
@@ -4944,13 +4933,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy349;
}
yy349:
-#line 116 "ext/yylex.re"
+#line 118 "ext/yylex.re"
{ RET(cast_sym_LONG); }
-#line 4952 "<stdout>"
+#line 4941 "<stdout>"
yy350:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '0':
case '1':
@@ -5016,13 +5005,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy351;
}
yy351:
-#line 114 "ext/yylex.re"
+#line 116 "ext/yylex.re"
{ RET(cast_sym_IF); }
-#line 5024 "<stdout>"
+#line 5013 "<stdout>"
yy352:
yych = *++YYCURSOR;
switch (yych) {
case 'l': goto yy355;
case 't': goto yy353;
@@ -5095,13 +5084,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy354;
}
yy354:
-#line 115 "ext/yylex.re"
+#line 117 "ext/yylex.re"
{ RET(cast_sym_INT); }
-#line 5103 "<stdout>"
+#line 5092 "<stdout>"
yy355:
yych = *++YYCURSOR;
switch (yych) {
case 'i': goto yy356;
default: goto yy234;
@@ -5185,13 +5174,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy359;
}
yy359:
-#line 131 "ext/yylex.re"
+#line 133 "ext/yylex.re"
{ RET(cast_sym_INLINE); }
-#line 5193 "<stdout>"
+#line 5182 "<stdout>"
yy360:
yych = *++YYCURSOR;
switch (yych) {
case 't': goto yy361;
default: goto yy234;
@@ -5269,13 +5258,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy363;
}
yy363:
-#line 113 "ext/yylex.re"
+#line 115 "ext/yylex.re"
{ RET(cast_sym_GOTO); }
-#line 5277 "<stdout>"
+#line 5266 "<stdout>"
yy364:
yych = *++YYCURSOR;
switch (yych) {
case 'o': goto yy368;
default: goto yy234;
@@ -5353,13 +5342,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy367;
}
yy367:
-#line 112 "ext/yylex.re"
+#line 114 "ext/yylex.re"
{ RET(cast_sym_FOR); }
-#line 5361 "<stdout>"
+#line 5350 "<stdout>"
yy368:
yych = *++YYCURSOR;
switch (yych) {
case 'a': goto yy369;
default: goto yy234;
@@ -5437,13 +5426,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy371;
}
yy371:
-#line 111 "ext/yylex.re"
+#line 113 "ext/yylex.re"
{ RET(cast_sym_FLOAT); }
-#line 5445 "<stdout>"
+#line 5434 "<stdout>"
yy372:
yych = *++YYCURSOR;
switch (yych) {
case 's': goto yy383;
default: goto yy234;
@@ -5545,13 +5534,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy379;
}
yy379:
-#line 110 "ext/yylex.re"
+#line 112 "ext/yylex.re"
{ RET(cast_sym_EXTERN); }
-#line 5553 "<stdout>"
+#line 5542 "<stdout>"
yy380:
yych = *++YYCURSOR;
switch (yych) {
case 'm': goto yy381;
default: goto yy234;
@@ -5623,13 +5612,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy382;
}
yy382:
-#line 109 "ext/yylex.re"
+#line 111 "ext/yylex.re"
{ RET(cast_sym_ENUM); }
-#line 5631 "<stdout>"
+#line 5620 "<stdout>"
yy383:
yych = *++YYCURSOR;
switch (yych) {
case 'e': goto yy384;
default: goto yy234;
@@ -5701,13 +5690,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy385;
}
yy385:
-#line 108 "ext/yylex.re"
+#line 110 "ext/yylex.re"
{ RET(cast_sym_ELSE); }
-#line 5709 "<stdout>"
+#line 5698 "<stdout>"
yy386:
yych = *++YYCURSOR;
switch (yych) {
case 'f': goto yy394;
default: goto yy234;
@@ -5779,13 +5768,13 @@
case 'z': goto yy233;
case 'u': goto yy389;
default: goto yy388;
}
yy388:
-#line 106 "ext/yylex.re"
+#line 108 "ext/yylex.re"
{ RET(cast_sym_DO); }
-#line 5787 "<stdout>"
+#line 5776 "<stdout>"
yy389:
yych = *++YYCURSOR;
switch (yych) {
case 'b': goto yy390;
default: goto yy234;
@@ -5869,13 +5858,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy393;
}
yy393:
-#line 107 "ext/yylex.re"
+#line 109 "ext/yylex.re"
{ RET(cast_sym_DOUBLE); }
-#line 5877 "<stdout>"
+#line 5866 "<stdout>"
yy394:
yych = *++YYCURSOR;
switch (yych) {
case 'a': goto yy395;
default: goto yy234;
@@ -5965,13 +5954,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy399;
}
yy399:
-#line 105 "ext/yylex.re"
+#line 107 "ext/yylex.re"
{ RET(cast_sym_DEFAULT); }
-#line 5973 "<stdout>"
+#line 5962 "<stdout>"
yy400:
yych = *++YYCURSOR;
switch (yych) {
case 's': goto yy416;
default: goto yy234;
@@ -6092,13 +6081,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy410;
}
yy410:
-#line 104 "ext/yylex.re"
+#line 106 "ext/yylex.re"
{ RET(cast_sym_CONTINUE); }
-#line 6100 "<stdout>"
+#line 6089 "<stdout>"
yy411:
++YYCURSOR;
switch ((yych = *YYCURSOR)) {
case '0':
case '1':
@@ -6164,13 +6153,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy412;
}
yy412:
-#line 103 "ext/yylex.re"
+#line 105 "ext/yylex.re"
{ RET(cast_sym_CONST); }
-#line 6172 "<stdout>"
+#line 6161 "<stdout>"
yy413:
yych = *++YYCURSOR;
switch (yych) {
case 'r': goto yy414;
default: goto yy234;
@@ -6242,13 +6231,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy415;
}
yy415:
-#line 102 "ext/yylex.re"
+#line 104 "ext/yylex.re"
{ RET(cast_sym_CHAR); }
-#line 6250 "<stdout>"
+#line 6239 "<stdout>"
yy416:
yych = *++YYCURSOR;
switch (yych) {
case 'e': goto yy417;
default: goto yy234;
@@ -6320,13 +6309,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy418;
}
yy418:
-#line 101 "ext/yylex.re"
+#line 103 "ext/yylex.re"
{ RET(cast_sym_CASE); }
-#line 6328 "<stdout>"
+#line 6317 "<stdout>"
yy419:
yych = *++YYCURSOR;
switch (yych) {
case 'e': goto yy420;
default: goto yy234;
@@ -6410,13 +6399,13 @@
case 'y':
case 'z': goto yy233;
default: goto yy423;
}
yy423:
-#line 100 "ext/yylex.re"
+#line 102 "ext/yylex.re"
{ RET(cast_sym_BREAK); }
-#line 6418 "<stdout>"
+#line 6407 "<stdout>"
yy424:
yych = *++YYCURSOR;
switch (yych) {
case 't': goto yy425;
default: goto yy234;
@@ -6494,35 +6483,35 @@
case 'y':
case 'z': goto yy233;
default: goto yy427;
}
yy427:
-#line 99 "ext/yylex.re"
+#line 101 "ext/yylex.re"
{ RET(cast_sym_AUTO); }
-#line 6502 "<stdout>"
+#line 6491 "<stdout>"
yy428:
++YYCURSOR;
-#line 221 "ext/yylex.re"
+#line 237 "ext/yylex.re"
{ RET(cast_sym_DIVEQ); }
-#line 6507 "<stdout>"
+#line 6496 "<stdout>"
yy430:
++YYCURSOR;
-#line 97 "ext/yylex.re"
+#line 99 "ext/yylex.re"
{ goto comment2; }
-#line 6512 "<stdout>"
+#line 6501 "<stdout>"
yy432:
++YYCURSOR;
-#line 96 "ext/yylex.re"
+#line 98 "ext/yylex.re"
{ goto comment; }
-#line 6517 "<stdout>"
+#line 6506 "<stdout>"
}
-#line 286 "ext/yylex.re"
+#line 302 "ext/yylex.re"
comment:
-#line 6524 "<stdout>"
+#line 6513 "<stdout>"
{
YYCTYPE yych;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch (yych) {
@@ -6536,46 +6525,46 @@
switch ((yych = *YYCURSOR)) {
case '/': goto yy443;
default: goto yy437;
}
yy437:
-#line 305 "ext/yylex.re"
+#line 321 "ext/yylex.re"
{ goto comment; }
-#line 6544 "<stdout>"
+#line 6533 "<stdout>"
yy438:
++YYCURSOR;
-#line 292 "ext/yylex.re"
+#line 308 "ext/yylex.re"
{
p->tok = p->pos = cursor; ++p->lineno;
goto comment;
}
-#line 6552 "<stdout>"
+#line 6541 "<stdout>"
yy440:
++YYCURSOR;
-#line 298 "ext/yylex.re"
+#line 314 "ext/yylex.re"
{
if (cursor == p->eof)
rb_raise(cast_eParseError,
"%ld: unclosed multiline comment",
p->lineno);
}
-#line 6562 "<stdout>"
+#line 6551 "<stdout>"
yy442:
yych = *++YYCURSOR;
goto yy437;
yy443:
++YYCURSOR;
-#line 290 "ext/yylex.re"
+#line 306 "ext/yylex.re"
{ goto std; }
-#line 6570 "<stdout>"
+#line 6559 "<stdout>"
}
-#line 306 "ext/yylex.re"
+#line 322 "ext/yylex.re"
comment2:
-#line 6577 "<stdout>"
+#line 6566 "<stdout>"
{
YYCTYPE yych;
if (YYLIMIT <= YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
switch (yych) {
@@ -6583,28 +6572,28 @@
case '\n': goto yy447;
default: goto yy451;
}
yy447:
++YYCURSOR;
-#line 311 "ext/yylex.re"
+#line 327 "ext/yylex.re"
{
p->tok = p->pos = cursor; ++p->lineno;
goto std;
}
-#line 6594 "<stdout>"
+#line 6583 "<stdout>"
yy449:
++YYCURSOR;
-#line 317 "ext/yylex.re"
+#line 333 "ext/yylex.re"
{
if (cursor == p->eof) RET(Qnil);
goto std;
}
-#line 6602 "<stdout>"
+#line 6591 "<stdout>"
yy451:
++YYCURSOR;
-#line 322 "ext/yylex.re"
+#line 338 "ext/yylex.re"
{ goto comment2; }
-#line 6607 "<stdout>"
+#line 6596 "<stdout>"
}
-#line 323 "ext/yylex.re"
+#line 339 "ext/yylex.re"
}