# New Ticket Created by "Lee Duhem" # Please include the string: [perl #41165] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41165 >
Current parrot(in fact, lexical analyzer of PIR) don't play well with CRLE in Here Docs on Unix-like box such as Linux, you will get syntax error when feed parrot DOS fileformat(i.e. use CRLF line terminators) source(include Here Docs, of course) on Linux. And this is the *real* reason of bug [perl #41158] Here Docs in test C<cmp> cause t/op/cmp-nonbranch.t abnormal exit. These attached patches fix this, and I think it's a better fix for [perl #41158]. I have test it on Linux, it just works fine. Can someone test it on Windows? Thanks If you want to test this patch, you need to apply imcc_l.patch first, and then apply root_in.patch (this will refresh compilers/imcc/imclexer.c for you, current config/gen/makefiles/root.in will not do that). Then reconfigure your parrot use option --maintainer (you need working lex, at least), and make. BTW, If you use bison and have "uninitialized value" warning when you reconfigure parrot, you can apply patch in [perl #41163], this fix it. Lee
Index: compilers/imcc/imcc.l =================================================================== --- compilers/imcc/imcc.l (revision 16381) +++ compilers/imcc/imcc.l (working copy) @@ -100,7 +100,7 @@ STRINGCONSTANT {SQ_STRING}|{DQ_STRING} SQ_STRING \'[^'\n]*\' RANKSPEC \[[,]*\] -EOL \r?\n +EOL \r?\n WS [\t\f\r\x1a ] SP [ ] @@ -141,11 +141,15 @@ <heredoc2>{EOL} { /* heredocs have highest priority - * arrange them befor all wildcard state matches + * arrange them before all wildcard state matches */ /* Newline in the heredoc. Realloc and cat on. */ IMCC_INFO(interp)->line++; + if (yytext[yyleng - 2] == '\r') { + yytext[yyleng - 2] = '\n'; + YYCHOP(); + } IMCC_INFO(interp)->heredoc_content = mem_sys_realloc(IMCC_INFO(interp)->heredoc_content, strlen(IMCC_INFO(interp)->heredoc_content) + @@ -154,7 +158,7 @@ strlen(IMCC_INFO(interp)->heredoc_content), yytext); } -<heredoc2>.* { +<heredoc2>[^\r\n]* { /* Are we at the end of the heredoc? */ if (strcmp(IMCC_INFO(interp)->heredoc_end, yytext) == 0) {
Index: config/gen/makefiles/root.in =================================================================== --- config/gen/makefiles/root.in (revision 16381) +++ config/gen/makefiles/root.in (working copy) @@ -1198,6 +1198,8 @@ $(IMCC_O_FILES) : $(IMCC_H_FILES) $(ALL_H_FILES) +$(IMCC_DIR)/main$(O) : $(IMCC_O_FILES) + ############################################################################### # # Documentation targets: