mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 16:40:28 +02:00
fcl-css: fixed parsing --var
This commit is contained in:
parent
6128dcc735
commit
f81d455094
@ -2391,7 +2391,13 @@ var
|
|||||||
inc(p);
|
inc(p);
|
||||||
SkipIdentifier;
|
SkipIdentifier;
|
||||||
end;
|
end;
|
||||||
'a'..'z','A'..'Z':
|
'-':
|
||||||
|
begin
|
||||||
|
inc(p);
|
||||||
|
if (p^ in ['a'..'z','A'..'Z','_','-']) then
|
||||||
|
SkipIdentifier;
|
||||||
|
end;
|
||||||
|
'a'..'z','A'..'Z','_':
|
||||||
if (p^='v') and (p[1]='a') and (p[2]='r') and (p[3]='(') then
|
if (p^='v') and (p[1]='a') and (p[2]='r') and (p[3]='(') then
|
||||||
begin
|
begin
|
||||||
// var() found
|
// var() found
|
||||||
|
@ -435,7 +435,7 @@ type
|
|||||||
public
|
public
|
||||||
// attribute functions
|
// attribute functions
|
||||||
AttrFunctions: TCSSStringArray;
|
AttrFunctions: TCSSStringArray;
|
||||||
afVar: TCSSNumericalID;
|
const afVar = CSSAttrFuncVar;
|
||||||
function AddAttrFunction(const aName: TCSSString): TCSSNumericalID; overload;
|
function AddAttrFunction(const aName: TCSSString): TCSSNumericalID; overload;
|
||||||
function IndexOfAttrFunction(const aName: TCSSString): TCSSNumericalID; overload;
|
function IndexOfAttrFunction(const aName: TCSSString): TCSSNumericalID; overload;
|
||||||
property AttrFunctionCount: TCSSNumericalID read FAttrFunctionCount;
|
property AttrFunctionCount: TCSSNumericalID read FAttrFunctionCount;
|
||||||
@ -556,7 +556,7 @@ type
|
|||||||
function IsLengthOrPercentage(const ResValue: TCSSResCompValue; AllowNegative: boolean): boolean; overload;
|
function IsLengthOrPercentage(const ResValue: TCSSResCompValue; AllowNegative: boolean): boolean; overload;
|
||||||
function IsSymbol(Token: TCSSToken): boolean; overload;
|
function IsSymbol(Token: TCSSToken): boolean; overload;
|
||||||
function GetCompString: TCSSString; overload;
|
function GetCompString: TCSSString; overload;
|
||||||
function GetCompString(const aValue: string; const ResValue: TCSSResCompValue; EndP: PCSSChar): TCSSString; overload;
|
function GetCompString(const aValue: string; const ResValue: TCSSResCompValue): TCSSString; overload;
|
||||||
// low level functions to parse attribute components
|
// low level functions to parse attribute components
|
||||||
function ReadComp(var aComp: TCSSResCompValue): boolean; // true if parsing attribute can continue
|
function ReadComp(var aComp: TCSSResCompValue): boolean; // true if parsing attribute can continue
|
||||||
function ReadNumber(var aComp: TCSSResCompValue): boolean;
|
function ReadNumber(var aComp: TCSSResCompValue): boolean;
|
||||||
@ -1701,6 +1701,16 @@ begin
|
|||||||
SetSymbol(ctkDIV);
|
SetSymbol(ctkDIV);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
':':
|
||||||
|
begin
|
||||||
|
SetSymbol(ctkCOLON);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
';':
|
||||||
|
begin
|
||||||
|
SetSymbol(ctkSEMICOLON);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
'a'..'z','A'..'Z':
|
'a'..'z','A'..'Z':
|
||||||
if ReadIdentifier(aComp) then exit;
|
if ReadIdentifier(aComp) then exit;
|
||||||
'#':
|
'#':
|
||||||
@ -1971,18 +1981,18 @@ begin
|
|||||||
SetString(Result,StartP,CurComp.EndP-StartP);
|
SetString(Result,StartP,CurComp.EndP-StartP);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCSSBaseResolver.GetCompString(const aValue: string; const ResValue: TCSSResCompValue;
|
function TCSSBaseResolver.GetCompString(const aValue: string; const ResValue: TCSSResCompValue
|
||||||
EndP: PCSSChar): TCSSString;
|
): TCSSString;
|
||||||
var
|
var
|
||||||
Start: PCSSChar;
|
Start: PCSSChar;
|
||||||
begin
|
begin
|
||||||
if ResValue.Kind=rvkKeyword then
|
if ResValue.Kind=rvkKeyword then
|
||||||
exit(CSSRegistry.Keywords[ResValue.KeywordID]);
|
exit(CSSRegistry.Keywords[ResValue.KeywordID]);
|
||||||
Start:=ResValue.StartP;
|
Start:=ResValue.StartP;
|
||||||
if (Start=PCSSChar(aValue)) and (EndP-Start = length(aValue)) then
|
if (Start=PCSSChar(aValue)) and (ResValue.EndP-Start = length(aValue)) then
|
||||||
Result:=aValue
|
Result:=aValue
|
||||||
else
|
else
|
||||||
SetString(Result,Start,EndP-Start);
|
SetString(Result,Start,ResValue.EndP-Start);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCSSBaseResolver.SkipToEndOfAttribute(var p: PCSSChar);
|
procedure TCSSBaseResolver.SkipToEndOfAttribute(var p: PCSSChar);
|
||||||
|
Loading…
Reference in New Issue
Block a user