mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parse.y: curtail scanning
* parse.y (parser_yyerror): curtail scanning range, not to exceed the max margin. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2027ad600b
commit
07e7981d42
1 changed files with 5 additions and 2 deletions
7
parse.y
7
parse.y
|
@ -5255,18 +5255,21 @@ parser_yyerror(struct parser_params *parser, const char *msg)
|
|||
const char *p, *pe;
|
||||
const char *pre = "", *post = "";
|
||||
const char *code = "", *caret = "", *newline = "";
|
||||
const char *lim;
|
||||
char *buf;
|
||||
long len;
|
||||
int i;
|
||||
|
||||
p = lex_p;
|
||||
while (lex_pbeg < p) {
|
||||
lim = p - lex_pbeg > max_line_margin ? p - max_line_margin : lex_pbeg;
|
||||
while (lim < p) {
|
||||
if (*(p-1) == '\n') break;
|
||||
p--;
|
||||
}
|
||||
|
||||
pe = lex_p;
|
||||
while (pe < lex_pend) {
|
||||
lim = lex_pend - pe > max_line_margin ? pe + max_line_margin : lex_pend;
|
||||
while (pe < lim) {
|
||||
if (*pe == '\n') break;
|
||||
pe++;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue