mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Add `__ENCODING__' support.
`__ENCODING__' returns the current encoding name (string), unlike CRuby that returns the encoding object.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user