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

Re: [perl #127993] Version control conflict markers

Thread Previous | Thread Next
From:
demerphq
Date:
April 27, 2016 17:50
Subject:
Re: [perl #127993] Version control conflict markers
Message ID:
CANgJU+WCzB2eXeJxSGAuiLB2ar9AUFqtyGc30C+mVVpLFhX+aA@mail.gmail.com
On 27 April 2016 at 02:53, Father Chrysostomos via RT
<perlbug-followup@perl.org> wrote:
> On Tue Apr 26 02:01:25 2016, kentfredric@gmail.com wrote:
>> 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.
>>
>> <{5,90}.{0,500}={5,90}
>>
>> http://grep.cpan.me/?q=%3C{5%2C90}.{0%2C500}%3D{5%2C90}
>>
>> An Anchored CPAN Grep returns no results, suggesting its probably safe:
>>
>>
>> ^<{5,90}.{0,500}^={5,90}
>>
>> http://grep.cpan.me/?q=^%3C{5%2C90}.{0%2C500}^%3D{5%2C90}
>>
>> Obviously, C has the Luxury that it doesn't have heredocs.
>>
>> But fortunately for us,
>>
>>  <<<<<<
>>
>> Is parsed as
>>
>> <<"" <<"" <<""
>
> Actually <<"" << <<"".  That’s a bitshift in the middle.
>
>>
>> Not
>>
>> <<"<<<<"
>>
>> So there's no risk of it being some weird heredoc side-effect either,
>> and we deprecated <<"" already :D  ( See attached hereconflict.pl )
>>
>> 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 hereconflict2.pl )
>
> The best thing would be to handle this in yyerror, just the way we do ‘(Missing semicolon?)’.  That way, it would never have false positives.

Just thought someone should mention we can also check that the token
*starts a line* (or follows a newline or the start of the file,
whatever), so that

 my $x= <<<<<<
foo

bar

continues to work just fine.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About