Add `__ENCODING__' support.

`__ENCODING__' returns the current encoding name (string), unlike
CRuby that returns the encoding object.
parent f1fa5bf1
......@@ -2968,6 +2968,15 @@ var_ref : variable
snprintf(buf, sizeof(buf), "%d", p->lineno);
$$ = new_int(p, buf, 10);
}
| keyword__ENCODING__
{
#ifdef MRB_UTF8_STRING
const char *enc = "UTF-8";
#else
const char *enc = "ASCII-8BIT";
#endif
$$ = new_str(p, enc, strlen(enc));
}
;
backref : tNTH_REF
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment