Sign in Join

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

Mailing lists / fpc-devel / 2012-02

MakeSkel problem with operators?

8 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

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

Hans-Peter Diettrich

In an attempt to check the yet undocumented FCL units for use with FPDoc and MakeSkel, I got an error in the created skeleton for gmp: <element name="operator <(MPFloat, MPFloat): Boolean">

The "<" and ">" chars in operator names should be escaped in the XML files.

Is this easy to fix, or should I dig a bit deeper into the MakeSkel code?

Hint: FPDoc Editor escapes these characters already :-)

DoDi

Reply by email

Unknown author
to Hans-Peter Diettrich
Hans-Peter Diettrich wrote 5 lines
In an attempt to check the yet undocumented FCL units for use with FPDoc and MakeSkel, I got an error in the created skeleton for gmp: <element name="operator <(MPFloat, MPFloat): Boolean"> The "<" and ">" chars in operator names should be escaped in the XML files.

Last time this was remarked on, there was discussion whether < and > need to be escaped inside attribute values. I never got around to checking the XML specs.

In each case it's easily fixable.

Michael.

Reply by email

Hans-Peter Diettrich
to Hans-Peter Diettrich: In an attempt to check the yet undocumented FCL units for use with FPDoc and MakeSkel, I…
Hint: FPDoc Editor escapes these characters already :-)

But it doesn't insert an space after "operator":
<element name="operator&lt;(MPInteger;MPInteger):boolean">

This might result in problems with finding operators (untested), when operators generated by MakeSkel have an space added.

       <element name="operator :=(valuint): MPRational.op">

DoDi

Reply by email

Mattias Gaertner
to Unknown author: Last time this was remarked on, there was discussion whether < and > need to be escaped…
Show quoted text 9 lines
On Mon, 20 Feb 2012, Hans-Peter Diettrich wrote: > In an attempt to check the yet undocumented FCL units for use with FPDoc and > MakeSkel, I got an error in the created skeleton for gmp: > <element name="operator <(MPFloat, MPFloat): Boolean"> > > The "<" and ">" chars in operator names should be escaped in the XML files.

Must: <&"
Can: >'

Show quoted text 5 lines
Last time this was remarked on, there was discussion whether < and > need to be escaped inside attribute values. I never got around to checking the XML specs. In each case it's easily fixable.

Mattias

Reply by email

Sven Barth
to Unknown author: Last time this was remarked on, there was discussion whether < and > need to be escaped…

Am 20.02.2012 14:00, schrieb

Show quoted text 15 lines
On Mon, 20 Feb 2012, Hans-Peter Diettrich wrote: > In an attempt to check the yet undocumented FCL units for use with > FPDoc and MakeSkel, I got an error in the created skeleton for gmp: > <element name="operator <(MPFloat, MPFloat): Boolean"> > > The "<" and ">" chars in operator names should be escaped in the XML > files. Last time this was remarked on, there was discussion whether < and > need to be escaped inside attribute values. I never got around to checking the XML specs.

If I understand this correctly:
http://www.w3.org/TR/2008/REC-xml-20081126/#NT-AttValue

Then "&", "<" and """ need to be escaped inside attribute values.

Regards,
Sven

Reply by email

Mattias Gaertner
to Hans-Peter Diettrich: But it doesn't insert an space after "operator": <element…
Show quoted text 6 lines
Hans-Peter Diettrich schrieb: > Hint: FPDoc Editor escapes these characters already :-) But it doesn't insert an space after "operator": <element name="operator&lt;(MPInteger;MPInteger):boolean">

The space is not required in Free Pascal.

This might result in problems with finding operators (untested),

Please test.

when operators generated by MakeSkel have an space added. <element name="operator :=(valuint): MPRational.op">

Mattias

Reply by email

Hans-Peter Diettrich
to Unknown author: Last time this was remarked on, there was discussion whether < and > need to be escaped…
Show quoted text 11 lines
> In an attempt to check the yet undocumented FCL units for use with > FPDoc and MakeSkel, I got an error in the created skeleton for gmp: > <element name="operator <(MPFloat, MPFloat): Boolean"> > > The "<" and ">" chars in operator names should be escaped in the XML > files. Last time this was remarked on, there was discussion whether < and > need to be escaped inside attribute values. I never got around to checking the XML specs.

The specs really are a bit weird:
[10] AttValue ::= '"' ([^<&"] | Reference)* '"' |? "'" ([^<&'] | Reference)* "'"

This means that "<" is not allowed inside an attribute value, while ">" seems to be allowed. An "&" has to be escaped because it is used as the escape character in a CharRef ("&#nn;") or EntityRef (e.g. "&lt;").

In each case it's easily fixable.

At least a writer has to escape "<", this should be fixed ASAP.

I'd escape both "<" and ">" in writing XML attributes, to prevent any possible problems. A reader instead should allow for ">" there, conforming to the specs.

DoDi

Reply by email

Hans-Peter Diettrich
to Mattias Gaertner: On Mon, 20 Feb 2012 14:04:49 +0100 The space is not required in Free Pascal. Please test.…
Show quoted text 15 lines
On Mon, 20 Feb 2012 14:04:49 +0100 Hans-Peter Diettrich wrote: > Hans-Peter Diettrich schrieb: > >> Hint: FPDoc Editor escapes these characters already :-) > But it doesn't insert an space after "operator": > <element name="operator&lt;(MPInteger;MPInteger):boolean"> The space is not required in Free Pascal. > This might result in problems with finding operators (untested), Please test.

The FPDoc Editor does *not* find an operator with an appended space, while above element is found. This is incompatible with MakeSkel.

F1 in the Lazarus IDE doesn't find help on the *use* of any operator, and a "jump to definition" doesn't work as well. This may be, or may not be, a different problem?

DoDi

Reply by email