Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-12

Unhelpful error message

10 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

I've just had a slight problem compiling Lazarus where FPC was reporting this:

main.pp(5001,1) Fatal: Syntax error, "BEGIN" expected but "shl" found

The reason was that I'd not spotted that Subversion had inserted a like like

<<<<< Mine:

preceding a function. Is this something that the compiler could detect and warn about?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Henry Vermaak
to Mark Morgan Lloyd

On Dec 2, 2012 11:47 AM, "Mark Morgan Lloyd" <

wrote: I've just had a slight problem compiling Lazarus where FPC was reporting

this:

main.pp(5001,1) Fatal: Syntax error, "BEGIN" expected but "shl" found

<< is shl in c. I guess fpc accepts this syntax, too?

Henry

Reply by email

Mattias Gaertner
to Mark Morgan Lloyd: I've just had a slight problem compiling Lazarus where FPC was reporting this:…
Show quoted text 11 lines
I've just had a slight problem compiling Lazarus where FPC was reporting this: main.pp(5001,1) Fatal: Syntax error, "BEGIN" expected but "shl" found The reason was that I'd not spotted that Subversion had inserted a like like <<<<< Mine: preceding a function. Is this something that the compiler could detect and warn about?

It seems it just did?
What error message do you expect?

Mattias

Reply by email

Mark Morgan Lloyd
to Mattias Gaertner
Mattias Gaertner wrote 17 lines
On Sun, 02 Dec 2012 11:46:54 +0000 Mark Morgan Lloyd wrote: > I've just had a slight problem compiling Lazarus where FPC was reporting > this: > > main.pp(5001,1) Fatal: Syntax error, "BEGIN" expected but "shl" found > > The reason was that I'd not spotted that Subversion had inserted a like like > > <<<<< Mine: > > preceding a function. Is this something that the compiler could detect > and warn about? It seems it just did? What error message do you expect?

Something that recognises that a message like <<<<<<< .mine originates from the project's chosen VCS, and that <<<<<<< is distinct from shl.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Sven Barth
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 23 lines
Mattias Gaertner wrote: > On Sun, 02 Dec 2012 11:46:54 +0000 > Mark Morgan Lloyd wrote: > >> I've just had a slight problem compiling Lazarus where FPC was >> reporting this: >> >> main.pp(5001,1) Fatal: Syntax error, "BEGIN" expected but "shl" found >> >> The reason was that I'd not spotted that Subversion had inserted a >> like like >> >> <<<<< Mine: >> >> preceding a function. Is this something that the compiler could >> detect and warn about? > > It seems it just did? > What error message do you expect? Something that recognises that a message like <<<<<<< .mine originates from the project's chosen VCS, and that <<<<<<< is distinct from shl.

This is the same as the discussion about whether FPC could support "#" at the first line for shebanging for instantfpc. In short: in will not happen. It's your own responsibility to keep versioned files conflict free and yes, I had this problem myself already as well.

Regards,
Sven

Reply by email

Sven Barth
to Henry Vermaak: On Dec 2, 2012 11:47 AM, "Mark Morgan Lloyd" < this: << is shl in c. I guess fpc accepts…
Henry Vermaak wrote 12 lines
On Dec 2, 2012 11:47 AM, "Mark Morgan Lloyd" < > wrote: > > I've just had a slight problem compiling Lazarus where FPC was reporting this: > > main.pp(5001,1) Fatal: Syntax error, "BEGIN" expected but "shl" found > << is shl in c. I guess fpc accepts this syntax, too?

Yes, "<<" and ">>" are converted in scanner stage to "shl" and "shr" which will give me headaches once I want to support nested specializations (basically the same problem that C++ had):

TTest<TTest<TObject>> // !!!

Regards,
Sven

Reply by email

Alexander Klenin
to Sven Barth
Sven Barth wrote 7 lines
On 02.12.2012 13:11, Henry Vermaak wrote: Yes, "<<" and ">>" are converted in scanner stage to "shl" and "shr" which will give me headaches once I want to support nested specializations (basically the same problem that C++ had): TTest<TTest<TObject>> // !!!

Ouch. I suggest to turn it off by default, with a new modeswitch to turn back on if required.

Reply by email

Sven Barth
to Alexander Klenin
Alexander Klenin wrote 10 lines
On Sun, Dec 2, 2012 at 6:21 PM, Sven Barth wrote: > On 02.12.2012 13:11, Henry Vermaak wrote: > Yes, "<<" and ">>" are converted in scanner stage to "shl" and "shr" which > will give me headaches once I want to support nested specializations > (basically the same problem that C++ had): > > TTest<TTest<TObject>> // !!! > Ouch. I suggest to turn it off by default, with a new modeswitch to turn back on if required.

This problem will be tackled once I'm working on nested specializations ;)

Regards,
Sven

Reply by email

Hans-Peter Diettrich
to Mark Morgan Lloyd: Something that recognises that a message like <<<<<<< .mine originates from the…
> What error message do you expect? Something that recognises that a message like <<<<<<< .mine originates from the project's chosen VCS, and that <<<<<<< is distinct from shl.

+1

A concatenation of the *binary* "<" or "<<" operators, into "<<<<...", doesn't make sense (syntactically), so that the scanner could generate an appropriate error token (or message). Just as in handling "." .. "..." tokens, where more than 3 consecutive dots also are definite syntax errors. AFAIR a check for an fourth dot is not performed by the scanner, and seems not required because the resulting parser error message is sufficient. But a check for a third "<" definitely should be added to the scanner, so that a more specific error message can be issued.

DoDi

Reply by email

Henry Vermaak
to Hans-Peter Diettrich
Hans-Peter Diettrich wrote
message is sufficient. But a check for a third "<" definitely should be added to the scanner, so that a more specific error message can be issued.

Not worth the effort, in my opinion. I understood the error message immediately.

Henry

Reply by email