diff --git a/internal/parse.h b/internal/parse.h index 8e04664ae8a..3fca06d059a 100644 --- a/internal/parse.h +++ b/internal/parse.h @@ -39,7 +39,7 @@ typedef struct rb_strterm_literal_struct { typedef struct rb_strterm_heredoc_struct { rb_parser_string_t *lastline; /* the string of line that contains `<<"END"` */ - long offset; /* the column of END in `<<"END"` */ + rb_len_t offset; /* the column of END in `<<"END"` */ int sourceline; /* lineno of the line that contains `<<"END"` */ unsigned length; /* the length of END in `<<"END"` */ uint8_t quote; diff --git a/parse.y b/parse.y index b2bbd55209d..8cf1511a164 100644 --- a/parse.y +++ b/parse.y @@ -8686,7 +8686,7 @@ heredoc_identifier(struct parser_params *p) * term_len is length of `<<"END"` except `END`, * in this case term_len is 4 (<, <, " and "). */ - long len, offset = p->lex.pcur - p->lex.pbeg; + rb_len_t len, offset = p->lex.pcur - p->lex.pbeg; int c = nextc(p), term, func = 0, quote = 0; enum yytokentype token = tSTRING_BEG; int indent = 0; @@ -8743,7 +8743,7 @@ heredoc_identifier(struct parser_params *p) } len = p->lex.pcur - (p->lex.pbeg + offset) - quote; - if ((unsigned long)len >= HERETERM_LENGTH_MAX) + if ((rb_ulen_t)len >= HERETERM_LENGTH_MAX) yyerror0("too long here document identifier"); dispatch_scan_event(p, tHEREDOC_BEG); lex_goto_eol(p);