mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 01:55:54 +02:00
laz2_xmlread: added flag xrfAllowSpecialCharsInComments
git-svn-id: trunk@47211 -
This commit is contained in:
parent
a52a3c922c
commit
47c65faeef
@ -36,6 +36,7 @@ type
|
|||||||
TXMLReaderFlag = (
|
TXMLReaderFlag = (
|
||||||
xrfAllowLowerThanInAttributeValue,
|
xrfAllowLowerThanInAttributeValue,
|
||||||
xrfAllowSpecialCharsInAttributeValue,
|
xrfAllowSpecialCharsInAttributeValue,
|
||||||
|
xrfAllowSpecialCharsInComments,
|
||||||
xrfPreserveWhiteSpace
|
xrfPreserveWhiteSpace
|
||||||
);
|
);
|
||||||
TXMLReaderFlags = set of TXMLReaderFlag;
|
TXMLReaderFlags = set of TXMLReaderFlag;
|
||||||
@ -408,7 +409,8 @@ type
|
|||||||
procedure StandaloneError(LineOffs: Integer = 0);
|
procedure StandaloneError(LineOffs: Integer = 0);
|
||||||
procedure CallErrorHandler(E: EXMLReadError);
|
procedure CallErrorHandler(E: EXMLReadError);
|
||||||
function FindOrCreateElDef: TDOMElementDef;
|
function FindOrCreateElDef: TDOMElementDef;
|
||||||
function SkipUntilSeq(const Delim: TSetOfChar; c1: DOMChar; c2: DOMChar = #0): Boolean;
|
function SkipUntilSeq(const Delim: TSetOfChar; c1: DOMChar; c2: DOMChar = #0;
|
||||||
|
AllowSpecialChars: boolean = false): Boolean;
|
||||||
procedure CheckMaxChars;
|
procedure CheckMaxChars;
|
||||||
protected
|
protected
|
||||||
FCursor: TDOMNode_WithChildren;
|
FCursor: TDOMNode_WithChildren;
|
||||||
@ -1439,7 +1441,8 @@ begin
|
|||||||
DoError(esFatal, Format(descr, args), LineOffs);
|
DoError(esFatal, Format(descr, args), LineOffs);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TXMLReader.ValidationError(const Msg: string; const Args: array of const; LineOffs: Integer);
|
procedure TXMLReader.ValidationError(const Msg: string;
|
||||||
|
const args: array of const; LineOffs: Integer);
|
||||||
begin
|
begin
|
||||||
FDocNotValid := True;
|
FDocNotValid := True;
|
||||||
if FValidate then
|
if FValidate then
|
||||||
@ -1556,7 +1559,7 @@ begin
|
|||||||
FatalError('Expected whitespace');
|
FatalError('Expected whitespace');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TXMLReader.SkipS(Required: Boolean): Boolean;
|
function TXMLReader.SkipS(required: Boolean): Boolean;
|
||||||
var
|
var
|
||||||
p: DOMPChar;
|
p: DOMPChar;
|
||||||
begin
|
begin
|
||||||
@ -2287,7 +2290,8 @@ begin
|
|||||||
Normalize(ToFill, Normalized);
|
Normalize(ToFill, Normalized);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TXMLReader.SkipUntilSeq(const Delim: TSetOfChar; c1: DOMChar; c2: DOMChar = #0): Boolean;
|
function TXMLReader.SkipUntilSeq(const Delim: TSetOfChar; c1: DOMChar;
|
||||||
|
c2: DOMChar; AllowSpecialChars: boolean): Boolean;
|
||||||
var
|
var
|
||||||
wc: DOMChar;
|
wc: DOMChar;
|
||||||
begin
|
begin
|
||||||
@ -2295,7 +2299,7 @@ begin
|
|||||||
FValue.Length := 0;
|
FValue.Length := 0;
|
||||||
StoreLocation(FTokenStart);
|
StoreLocation(FTokenStart);
|
||||||
repeat
|
repeat
|
||||||
wc := FSource.SkipUntil(FValue, Delim);
|
wc := FSource.SkipUntil(FValue, Delim, nil, AllowSpecialChars);
|
||||||
if wc <> #0 then
|
if wc <> #0 then
|
||||||
begin
|
begin
|
||||||
FSource.NextChar;
|
FSource.NextChar;
|
||||||
@ -2315,9 +2319,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TXMLReader.ParseComment; // [15]
|
procedure TXMLReader.ParseComment; // [15]
|
||||||
|
var
|
||||||
|
AllowSpecialChars: Boolean;
|
||||||
begin
|
begin
|
||||||
ExpectString('--');
|
ExpectString('--');
|
||||||
if SkipUntilSeq([#0, '-'], '-') then
|
AllowSpecialChars := xrfAllowSpecialCharsInComments in FFlags;
|
||||||
|
if SkipUntilSeq([#0, '-'], '-', #0, AllowSpecialChars) then
|
||||||
begin
|
begin
|
||||||
ExpectChar('>');
|
ExpectChar('>');
|
||||||
DoComment(FValue.Buffer, FValue.Length);
|
DoComment(FValue.Buffer, FValue.Length);
|
||||||
|
Loading…
Reference in New Issue
Block a user