diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-30 02:00:14 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-30 02:00:14 +0000 |
| commit | c0839de0841d5ddad6a5961a83f7d1d80c036c3a (patch) | |
| tree | ffdd622a377e137ce4d94ace8c5195ec03f80827 /parse.y | |
| parent | 2f50b390b3acdd9c6a0a9b14694d917bd3f718d9 (diff) | |
| download | ruby-c0839de0841d5ddad6a5961a83f7d1d80c036c3a.tar.gz ruby-c0839de0841d5ddad6a5961a83f7d1d80c036c3a.tar.xz ruby-c0839de0841d5ddad6a5961a83f7d1d80c036c3a.zip | |
* parse.y (parser_yylex): suppress an extra error message after
numeric literal without digits. based on a patch from ujihisa .
in [ruby-dev:39811]. [ruby-dev:39798]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
| -rw-r--r-- | parse.y | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -6902,6 +6902,7 @@ parser_yylex(struct parser_params *parser) c = nextc(); } if (c == '0') { +#define no_digits() do {yyerror("numeric literal without digits"); return 0;} while (0) int start = toklen(); c = nextc(); if (c == 'x' || c == 'X') { @@ -6922,7 +6923,7 @@ parser_yylex(struct parser_params *parser) pushback(c); tokfix(); if (toklen() == start) { - yyerror("numeric literal without digits"); + no_digits(); } else if (nondigit) goto trailing_uc; set_yylval_literal(rb_cstr_to_inum(tok(), 16, FALSE)); @@ -6946,7 +6947,7 @@ parser_yylex(struct parser_params *parser) pushback(c); tokfix(); if (toklen() == start) { - yyerror("numeric literal without digits"); + no_digits(); } else if (nondigit) goto trailing_uc; set_yylval_literal(rb_cstr_to_inum(tok(), 2, FALSE)); @@ -6970,7 +6971,7 @@ parser_yylex(struct parser_params *parser) pushback(c); tokfix(); if (toklen() == start) { - yyerror("numeric literal without digits"); + no_digits(); } else if (nondigit) goto trailing_uc; set_yylval_literal(rb_cstr_to_inum(tok(), 10, FALSE)); @@ -6984,7 +6985,7 @@ parser_yylex(struct parser_params *parser) /* prefixed octal */ c = nextc(); if (c == -1 || c == '_' || !ISDIGIT(c)) { - yyerror("numeric literal without digits"); + no_digits(); } } if (c >= '0' && c <= '7') { |
