Git commit 240f8ffd4c7a7ff4415dcb2d86e9d56624160b7c by Alexander Dymo. Committed on 03/07/2012 at 15:11. Pushed by dymo into branch 'gsoc'. Ruby lexer: increase the buffer size for heredoc strings and expressions in= terpolated into strings. That buffer is currently quite large (will hold approx 2k of unicode string= s). The real fix would be buffers that get increased in size dynamically (reall= oc) similarly to how original ruby parser does. M +9 -5 parser/parser.y http://commits.kde.org/kdev-ruby/240f8ffd4c7a7ff4415dcb2d86e9d56624160b7c diff --git a/parser/parser.y b/parser/parser.y index bb6a5c0..c846c37 100644 --- a/parser/parser.y +++ b/parser/parser.y @@ -34,8 +34,12 @@ #include "parser.h" = #define STACK_SIZE 128 -#define BSIZE STACK_SIZE - +/* buffer size for heredocs and code blocks inside strings + let's say it has place for about 2k lines of utf8-encoded + code for now */ +#define STRING_BSIZE 320000 +/* buffer size for other tokens that are not strings */ +#define TOK_BSIZE 128 = /* Flags used by the lexer */ struct flags_t { @@ -1697,7 +1701,7 @@ static int push_string_var(struct parser_t * p, int *= curs, char ** ch, int oax) int diff =3D *curs - p->cursor - oax + 2; struct pos_t tp =3D { p->line, p->line, p->column + diff, -1, 0 }; int possible_error =3D *curs + 1; - char buffer[BSIZE]; + char buffer[STRING_BSIZE]; char * ptr =3D buffer; int step =3D 0; /* How many bytes the actual utf8 character has */ int ax =3D 0; /* Used to properly update the column when utf8 chars appe= ar */ @@ -1731,7 +1735,7 @@ static int push_string_var(struct parser_t * p, int *= curs, char ** ch, int oax) = static int parse_heredoc(struct parser_t * p, char * c, int * curs) { - char buffer[BSIZE], aux[BSIZE]; + char buffer[STRING_BSIZE], aux[STRING_BSIZE]; unsigned char quote_seen =3D 0, term =3D ' '; unsigned char dash_seen =3D 0; int i, l =3D 0, spaces =3D 0; @@ -2162,7 +2166,7 @@ static int parse_re_options(struct parser_t *p, char = *c, int curs) static int parser_yylex(struct parser_t * parser) { int t =3D token_invalid; - char buffer[BSIZE]; + char buffer[TOK_BSIZE]; char * c; int curs, len; unsigned char space_seen =3D 0;