summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mrbgems/mruby-compiler/core/parse.y7
1 files changed, 4 insertions, 3 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y
index ca4c90770..7838b6dfb 100644
--- a/mrbgems/mruby-compiler/core/parse.y
+++ b/mrbgems/mruby-compiler/core/parse.y
@@ -5712,11 +5712,12 @@ parser_yylex(parser_state *p)
if (!identchar(c)) {
char buf[36];
const char s[] = "Invalid char in expression: 0x";
+ const char hexdigits[] = "0123456789ABCDEF";
strcpy(buf, s);
- buf[sizeof(s)] = (c & 0xff00) >> 8;
- buf[sizeof(s)+1] = (c & 0xff);
- buf[sizeof(s)+2] = 0;
+ buf[sizeof(s)-1] = hexdigits[(c & 0xf0) >> 4];
+ buf[sizeof(s)] = hexdigits[(c & 0x0f)];
+ buf[sizeof(s)+1] = 0;
yyerror(p, buf);
goto retry;
}