Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332189 - Heredoc (here document) without newline breaks syntax coloring
Summary: Heredoc (here document) without newline breaks syntax coloring
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PHP UI CLA
QA Contact: Ilina Stefanova CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-09 02:03 EST by Christ van Willegen CLA
Modified: 2020-05-14 11:49 EDT (History)
4 users (show)

See Also:


Attachments
Test case showing incorrect syntax coloring (370 bytes, text/php)
2010-12-09 02:05 EST, Christ van Willegen CLA
no flags Details
patch (1.67 KB, patch)
2010-12-13 21:42 EST, xu jiaxi CLA
no flags Details | Diff
patch (4.96 KB, patch)
2011-01-11 05:27 EST, Zhongwei Zhao CLA
no flags Details | Diff
screenshot1 (36.05 KB, image/jpeg)
2011-07-29 08:44 EDT, Kalin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christ van Willegen CLA 2010-12-09 02:03:59 EST
Build Identifier: 20100917-0705

When entering a here document (<<<) without a newline at the end, Eclipse sometimes does not sees the end of the document, failing to correctly color syntax after that.

Reproducible: Always

Steps to Reproduce:
1. Create new PHP file
2. Paste the testcase
3. Observe that the code after the here document is not correctly syntax colored
Comment 1 Christ van Willegen CLA 2010-12-09 02:05:08 EST
Created attachment 184840 [details]
Test case showing incorrect syntax coloring
Comment 2 xu jiaxi CLA 2010-12-13 21:42:50 EST
Created attachment 185104 [details]
patch
Comment 3 Zhongwei Zhao CLA 2011-01-10 02:50:01 EST
committed to head,thanks Xu!
Comment 4 Roy Ganor CLA 2011-01-10 02:57:37 EST
(In reply to comment #3)
> committed to head,thanks Xu!

Just to be sure, is this a valid PHP code? can you run it with the php binary and get no errors when executing it?
 
Thanks!
Comment 5 Zhongwei Zhao CLA 2011-01-10 04:08:46 EST
hi,Roy

I use this php file to test:

<?php

function echoHereDoc($hereDoc)
{
	echo $hereDoc;
}
/**
 * TODO abscsfdds
 * Enter description here ...
 */
function test()
{
	echoHereDoc(<<<EOF
set term png size 1300, 600
set xdata time
set xlabel "$test"
set ylabel "Aantal per minuut"
set timefmt "%Y-%m-%d_%H:%M"
set format x "%H:%M:%S"
set key outside bottom
set output "/var/www/html/arponline/arponline.data/plot.png"
plot
EOF
	);
}
test();

and it print:

set term png size 1300, 600
set xdata time
set xlabel "Test"
set ylabel "Aantal per minuut"
set timefmt "%Y-%m-%d_%H:%M"
set format x "%H:%M:%S"
set key outside bottom
set output "/var/www/html/arponline/arponline.data/plot.png"
plot


so I think it is a valid php code,and I will write test for it and fix the unit test failure:)
Comment 6 Roy Ganor CLA 2011-01-10 09:18:35 EST
Great, so it sounds like an important issue that we need to apply to the branch as well.

Do we have unit tests for this issue?
Comment 7 Zhongwei Zhao CLA 2011-01-10 09:30:24 EST
(In reply to comment #6)
> Great, so it sounds like an important issue that we need to apply to the branch
> as well.
> 
> Do we have unit tests for this issue?

not yet,I will add it tomorrow
Comment 8 Zhongwei Zhao CLA 2011-01-11 05:26:11 EST
there is problem with Xu's patch.for example:
<?
<<<MY_MARKER
Hello world
Bye Bye world
Bla Bla Bla
MY_MARKER;
b<<<MY_MARKER_2
Hello world
Bye Bye world
Bla Bla Bla
MY_MARKER_2;
<<<"MY_MARKER_3"
Hello world
Bye Bye world
Bla Bla Bla
MY_MARKER_3;
Comment 9 Zhongwei Zhao CLA 2011-01-11 05:27:17 EST
Created attachment 186472 [details]
patch

patch and unit test
Comment 10 Kalin CLA 2011-07-29 08:42:55 EDT
Still reproducible using the code in Comment 8
See the attachment.
Comment 11 Kalin CLA 2011-07-29 08:44:53 EDT
Created attachment 200589 [details]
screenshot1
Comment 12 Zhongwei Zhao CLA 2011-08-02 02:52:44 EDT
fixed
Comment 13 Toshihiro Izumi CLA 2011-08-03 05:05:03 EDT
(In reply to comment #11)
> Created attachment 200589 [details]
> screenshot1

Because the last "MY_MARKER_3;" is *not* the end of heredoc(T_END_HEREDOC).
Run the script. You get
Parsing Error: /php/errfile.php line 16 - syntax error, unexpected $end, expecting T_VARIABLE or T_END_HEREDOC or T_DOLLAR_OPEN_CURLY_BRACES or T_CURLY_OPEN
Comment 14 Kalin CLA 2011-08-05 09:07:07 EDT
Ok,thanks Toshihiro!
I'm closing it, since the given example in Comment 8 is not good.