develooper Front page | perl.perl5.porters | Postings from April 2016

Re: [perl #127993] Version control conflict markers

Thread Previous | Thread Next
Kent Fredric
April 26, 2016 09:01
Re: [perl #127993] Version control conflict markers
Message ID:
On 26 April 2016 at 19:04, Ed Avis <> wrote:
> Sometimes Perl code will appear to compile when there are git conflict
> markers like <<<<<<< in the file.  Or sometimes it gives an error but
> one that doesn't make it clear what the problem really is.
> I suggest adding explict detection of <<<<<<< ======= >>>>>>> as
> tokens and making them give an immediate error which stops parsing.
> As usual, this would not catch 100% of all such errors (the conflict
> markers might be inside a here-document, and so on) but it would
> be a great help nonetheless.
> For C and C++ programs, the latest gcc now reports
>    test.c:3:1: error: version control conflict marker in file
> It would be great for perl's error reporting to be as good as C.

A CPAN Grep says there's not a lot of risk for a mistake here, a
non-anchored result turns up a few entries, mostly, other code
checking for conflict markers.


An Anchored CPAN Grep returns no results, suggesting its probably safe:


Obviously, C has the Luxury that it doesn't have heredocs.

But fortunately for us,


Is parsed as

<<"" <<"" <<""



So there's no risk of it being some weird heredoc side-effect either,
and we deprecated <<"" already :D  ( See attached )

The only thing I'd want to make sure of is how we handled embedded git
conflict markers /inside string literals/ are handled right, because
you never know, there's probably some legitimate usecase for embedding
a conflict inside a heredoc. ( See attached )



Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About