diff options
| author | h2so5 <[email protected]> | 2013-04-05 11:30:13 +0900 |
|---|---|---|
| committer | h2so5 <[email protected]> | 2013-04-05 11:30:13 +0900 |
| commit | 7331119265b06164db3efa76626020f36ebcaa53 (patch) | |
| tree | c91d0054a04b264e204bf475a6624372a5b8dca3 /src | |
| parent | 492688eecd2e0adbe3cd9338a80eec1d9b6a0b6a (diff) | |
| download | mruby-7331119265b06164db3efa76626020f36ebcaa53.tar.gz mruby-7331119265b06164db3efa76626020f36ebcaa53.zip | |
Add syntax error for incomplete instance/class variables
Diffstat (limited to 'src')
| -rw-r--r-- | src/parse.y | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/parse.y b/src/parse.y index 1c0170ac9..3b69601b1 100644 --- a/src/parse.y +++ b/src/parse.y @@ -4812,7 +4812,16 @@ parser_yylex(parser_state *p) tokadd(p, '@'); c = nextc(p); } - if (c != -1 && isdigit(c)) { + if (c == -1) { + if (p->bidx == 1) { + yyerror(p, "incomplete instance variable syntax"); + } + else { + yyerror(p, "incomplete class variable syntax"); + } + return 0; + } + else if (isdigit(c)) { if (p->bidx == 1) { yyerror_i(p, "`@%c' is not allowed as an instance variable name", c); } |
