RomanYankovsky / DelphiAST

Abstract syntax tree builder for Delphi
Mozilla Public License 2.0
271 stars 116 forks source link

Possible string mismatch? #296

Closed PeterPanino closed 4 years ago

PeterPanino commented 4 years ago

I have this code line inside a unit:

image

In the syntax tree, this line results as:

<LITERAL line="47" col="35" value="ab&apos;cd" type="string"/>

You can see that the LITERAL value ab&apos;cd is not correct?

PeterPanino commented 4 years ago

You can see that the double single quote from the source is replaced by an APOSTROPHE HTML Entity in the syntax tree! Instead, it should reproduce the exact literal string value from the source code which is the double single quote. The Parser should not INTERPRET or TRANSLATE it!

RomanYankovsky commented 4 years ago

But this is XML. Special symbols have to be encoded. If this is a problem, you may use a tree of TSyntaxNode directly without serializing them to XML.