summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-04-04 21:22:19 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2013-04-04 21:22:19 -0700
commit97aee949c5931541b0d89963df6da1bcea4023c3 (patch)
treed701cde0540ad6da32fa7a3f52fd62ad1fd5af7e
parent5de9a8cc50052db105ea8ba06d64b95cb1b57db1 (diff)
parent7331119265b06164db3efa76626020f36ebcaa53 (diff)
downloadmruby-97aee949c5931541b0d89963df6da1bcea4023c3.tar.gz
mruby-97aee949c5931541b0d89963df6da1bcea4023c3.zip
Merge pull request #1136 from h2so5/syntax-error-for-incomplete-variable
Add syntax error for incomplete instance/class variables
-rw-r--r--src/parse.y11
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);
}