Commit 97aee949 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #1136 from h2so5/syntax-error-for-incomplete-variable

Add syntax error for incomplete instance/class variables
parents 5de9a8cc 73311192
...@@ -4812,7 +4812,16 @@ parser_yylex(parser_state *p) ...@@ -4812,7 +4812,16 @@ parser_yylex(parser_state *p)
tokadd(p, '@'); tokadd(p, '@');
c = nextc(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) { if (p->bidx == 1) {
yyerror_i(p, "`@%c' is not allowed as an instance variable name", c); yyerror_i(p, "`@%c' is not allowed as an instance variable name", c);
} }
......
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