mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 16:56:03 +02:00
jcf2: update to r683
git-svn-id: trunk@16990 -
This commit is contained in:
parent
5904434cd1
commit
d7aa0f69fd
@ -197,7 +197,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
GetRegSettings.InputDir := ExtractFilePath(psFileName);
|
GetRegSettings.InputDir := ExtractFilePath(psFileName);
|
||||||
mInput.Text := JclStrings.FileToString(psFileName);
|
mInput.Text := string(JclStrings.FileToString(psFileName));
|
||||||
sb1.Panels[1].Text := psFileName;
|
sb1.Panels[1].Text := psFileName;
|
||||||
AddCheckMRU(psFileName);
|
AddCheckMRU(psFileName);
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ implementation
|
|||||||
uses
|
uses
|
||||||
{ delphi }
|
{ delphi }
|
||||||
SysUtils, Forms,
|
SysUtils, Forms,
|
||||||
{ jcl }
|
{ jcf }
|
||||||
JcfUtils,
|
JcfUtils,
|
||||||
JcfUnicode;
|
JcfUnicode;
|
||||||
|
|
||||||
@ -4794,17 +4794,20 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
while not (fcTokenList.FirstTokenType in [ttSemicolon, ttReturn,
|
while not (fcTokenList.FirstTokenType in [ttSemicolon, ttReturn, ttComment, ttEnd]) do
|
||||||
ttComment, ttEnd]) do
|
|
||||||
begin
|
begin
|
||||||
if fcTokenList.FirstSolidTokenType = ttComma then
|
if fcTokenList.FirstSolidTokenType = ttComma then
|
||||||
|
begin
|
||||||
Recognise(ttComma);
|
Recognise(ttComma);
|
||||||
|
end;
|
||||||
RecogniseAsmParam;
|
RecogniseAsmParam;
|
||||||
|
|
||||||
RecogniseWhiteSpace;
|
RecogniseWhiteSpace;
|
||||||
|
|
||||||
if fcTokenList.FirstSolidTokenType = ttEnd then
|
if fcTokenList.FirstSolidTokenType = ttEnd then
|
||||||
|
begin
|
||||||
Break;
|
Break;
|
||||||
|
end;
|
||||||
|
|
||||||
if fcTokenList.FirstSolidTokenType = ttSemiColon then
|
if fcTokenList.FirstSolidTokenType = ttSemiColon then
|
||||||
begin
|
begin
|
||||||
@ -4930,7 +4933,7 @@ var
|
|||||||
lc, lcNext: TSourceToken;
|
lc, lcNext: TSourceToken;
|
||||||
lbHasLabel: boolean;
|
lbHasLabel: boolean;
|
||||||
begin
|
begin
|
||||||
{ um.
|
{ um. No formal grammar for these
|
||||||
|
|
||||||
AsmParam
|
AsmParam
|
||||||
-> Ident
|
-> Ident
|
||||||
@ -5007,6 +5010,7 @@ end;
|
|||||||
procedure TBuildParseTree.RecogniseAsmFactor;
|
procedure TBuildParseTree.RecogniseAsmFactor;
|
||||||
var
|
var
|
||||||
lcNext: TSourceToken;
|
lcNext: TSourceToken;
|
||||||
|
lcLastChar: WideChar;
|
||||||
begin
|
begin
|
||||||
if fcTokenList.FirstSolidTokenType = ttNot then
|
if fcTokenList.FirstSolidTokenType = ttNot then
|
||||||
Recognise(ttNot);
|
Recognise(ttNot);
|
||||||
@ -5033,13 +5037,20 @@ begin
|
|||||||
Recognise(ttNumber);
|
Recognise(ttNumber);
|
||||||
|
|
||||||
// numbers in Asm blocks can be suffixed with 'h' for hex
|
// numbers in Asm blocks can be suffixed with 'h' for hex
|
||||||
|
// there could be unanounced hex digits before the 'h'
|
||||||
lcNext := fcTokenList.FirstSolidToken;
|
lcNext := fcTokenList.FirstSolidToken;
|
||||||
if (lcNext.TokenType = ttIdentifier) and (lcNext.SourceCode = 'h') then
|
if (lcNext.TokenType = ttIdentifier) then
|
||||||
|
begin
|
||||||
|
lcLastChar := lcNext.SourceCode[Length(lcNext.SourceCode)];
|
||||||
|
|
||||||
|
if (lcLastChar = 'h') then
|
||||||
begin
|
begin
|
||||||
Recognise(ttIdentifier);
|
Recognise(ttIdentifier);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
ttQuotedLiteralString:
|
ttQuotedLiteralString:
|
||||||
Recognise(ttQuotedLiteralString);
|
Recognise(ttQuotedLiteralString);
|
||||||
ttTrue:
|
ttTrue:
|
||||||
|
@ -62,6 +62,7 @@ type
|
|||||||
function DescribePosition: string;
|
function DescribePosition: string;
|
||||||
|
|
||||||
function IsSolid: boolean;
|
function IsSolid: boolean;
|
||||||
|
function SourceLine: string;
|
||||||
|
|
||||||
function HasChildNode(const peTokens: TTokenTypeSet): boolean; override;
|
function HasChildNode(const peTokens: TTokenTypeSet): boolean; override;
|
||||||
function HasChildNode(const peTokens: TTokenTypeSet;
|
function HasChildNode(const peTokens: TTokenTypeSet;
|
||||||
@ -243,6 +244,29 @@ begin
|
|||||||
Result := 0;
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSourceToken.SourceLine: string;
|
||||||
|
var
|
||||||
|
lcLineToken: TSourceToken;
|
||||||
|
begin
|
||||||
|
|
||||||
|
// find the start of the line
|
||||||
|
lcLineToken := self;
|
||||||
|
|
||||||
|
while (lcLineToken <> nil) and (lcLineToken.TokenType <> ttReturn) do
|
||||||
|
begin
|
||||||
|
lcLineToken := lcLineToken.PriorToken;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// walk to the end of the line
|
||||||
|
Result := '';
|
||||||
|
repeat
|
||||||
|
Result := Result + lcLineToken.SourceCode;
|
||||||
|
lcLineToken := lcLineToken.NextToken;
|
||||||
|
|
||||||
|
until (lcLineToken = nil) or (lcLineToken.TokenType = ttReturn);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
function TSourceToken.FirstSolidLeaf: TParseTreeNode;
|
function TSourceToken.FirstSolidLeaf: TParseTreeNode;
|
||||||
begin
|
begin
|
||||||
if IsSolid then
|
if IsSolid then
|
||||||
|
@ -1036,7 +1036,7 @@ begin
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
liItemLen := Length(PreProcessorSymbolData[leLoop]);
|
liItemLen := Length(PreProcessorSymbolData[leLoop]);
|
||||||
if AnsiSameText(JcfUtils.StrLeft(psSourceCode, liItemLen), PreProcessorSymbolData[leLoop]) and
|
if AnsiSameText(StrLeft(psSourceCode, liItemLen), PreProcessorSymbolData[leLoop]) and
|
||||||
( not WideCharIsAlpha(psSourceCode[liItemLen + 1])) then
|
( not WideCharIsAlpha(psSourceCode[liItemLen + 1])) then
|
||||||
begin
|
begin
|
||||||
peSymbolType := leLoop;
|
peSymbolType := leLoop;
|
||||||
@ -1047,12 +1047,12 @@ begin
|
|||||||
if peSymbolType = ppNone then
|
if peSymbolType = ppNone then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
psText := JcfUtils.StrRestOf(psSourceCode, Length(PreProcessorSymbolData[peSymbolType]) + 1);
|
psText := StrRestOf(psSourceCode, Length(PreProcessorSymbolData[peSymbolType]) + 1);
|
||||||
|
|
||||||
if psText <> '' then
|
if psText <> '' then
|
||||||
begin
|
begin
|
||||||
if JcfUtils.StrRight(psText, 1) = '}' then
|
if StrRight(psText, 1) = '}' then
|
||||||
psText := JcfUtils.StrChopRight(psText, 1);
|
psText := StrChopRight(psText, 1);
|
||||||
|
|
||||||
psText := Trim(psText);
|
psText := Trim(psText);
|
||||||
end;
|
end;
|
||||||
|
@ -135,9 +135,8 @@ implementation
|
|||||||
uses
|
uses
|
||||||
{ delphi }
|
{ delphi }
|
||||||
SysUtils, Dialogs,
|
SysUtils, Dialogs,
|
||||||
{ jcf }
|
|
||||||
JcfUtils,
|
|
||||||
{ local }
|
{ local }
|
||||||
|
JcfUtils,
|
||||||
JCFSetBase,
|
JCFSetBase,
|
||||||
JcfRegistrySettings;
|
JcfRegistrySettings;
|
||||||
|
|
||||||
@ -233,7 +232,7 @@ begin
|
|||||||
// debug ShowMessage('Reading settings from file ' + lsSettingsFileName);
|
// debug ShowMessage('Reading settings from file ' + lsSettingsFileName);
|
||||||
|
|
||||||
// now we know the file exists - try get settings from it
|
// now we know the file exists - try get settings from it
|
||||||
lsText := JcfUtils.FileToString(psFileName);
|
lsText := string(FileToString(psFileName));
|
||||||
lcFile := TSettingsInputString.Create(lsText);
|
lcFile := TSettingsInputString.Create(lsText);
|
||||||
try
|
try
|
||||||
FromStream(lcFile);
|
FromStream(lcFile);
|
||||||
|
@ -156,10 +156,8 @@ implementation
|
|||||||
uses
|
uses
|
||||||
{ delphi }
|
{ delphi }
|
||||||
SysUtils,
|
SysUtils,
|
||||||
{ jcl }
|
|
||||||
JcfUtils,
|
|
||||||
{ local}
|
{ local}
|
||||||
JcfMiscFunctions;
|
JcfUtils, JcfMiscFunctions;
|
||||||
|
|
||||||
const
|
const
|
||||||
XML_HEADER = '<?xml version="1.0" ?>' + AnsiLineBreak;
|
XML_HEADER = '<?xml version="1.0" ?>' + AnsiLineBreak;
|
||||||
@ -241,12 +239,11 @@ end;
|
|||||||
// internal used to implement all writes
|
// internal used to implement all writes
|
||||||
procedure TSettingsStreamOutput.WriteText(const psText: string);
|
procedure TSettingsStreamOutput.WriteText(const psText: string);
|
||||||
var
|
var
|
||||||
lp: pchar;
|
lp: PAnsiChar;
|
||||||
begin
|
begin
|
||||||
Assert(fcStream <> nil);
|
Assert(fcStream <> nil);
|
||||||
lp := pchar(psText);
|
lp := PAnsiChar(AnsiString(psText));
|
||||||
//fcStream.WriteBuffer(lp^, Length(psText)); // Changed for Delphi 2009 support
|
fcStream.WriteBuffer(lp^, Length(psText));
|
||||||
fcStream.WriteBuffer(lp^, Length(psText) * SizeOf(Char));
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSettingsStreamOutput.WriteXMLHeader;
|
procedure TSettingsStreamOutput.WriteXMLHeader;
|
||||||
@ -256,14 +253,14 @@ end;
|
|||||||
|
|
||||||
procedure TSettingsStreamOutput.OpenSection(const psName: string);
|
procedure TSettingsStreamOutput.OpenSection(const psName: string);
|
||||||
begin
|
begin
|
||||||
WriteText(JcfUtils.StrRepeat(' ', fiOpenSections) + '<' + psName + '>' + AnsiLineBreak);
|
WriteText(StrRepeat(' ', fiOpenSections) + '<' + psName + '>' + AnsiLineBreak);
|
||||||
Inc(fiOpenSections);
|
Inc(fiOpenSections);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSettingsStreamOutput.CloseSection(const psName: string);
|
procedure TSettingsStreamOutput.CloseSection(const psName: string);
|
||||||
begin
|
begin
|
||||||
Dec(fiOpenSections);
|
Dec(fiOpenSections);
|
||||||
WriteText(JcfUtils.StrRepeat(' ', fiOpenSections) + '</' + psName + '>' + AnsiLineBreak);
|
WriteText(StrRepeat(' ', fiOpenSections) + '</' + psName + '>' + AnsiLineBreak);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -272,7 +269,7 @@ var
|
|||||||
lsTemp: string;
|
lsTemp: string;
|
||||||
begin
|
begin
|
||||||
Assert(fcStream <> nil);
|
Assert(fcStream <> nil);
|
||||||
lsTemp := JcfUtils.StrRepeat(' ', fiOpenSections + 1) + '<' + psTagName + '> ' +
|
lsTemp := StrRepeat(' ', fiOpenSections + 1) + '<' + psTagName + '> ' +
|
||||||
psValue + ' </' + psTagName + '>' + AnsiLineBreak;
|
psValue + ' </' + psTagName + '>' + AnsiLineBreak;
|
||||||
WriteText(lsTemp);
|
WriteText(lsTemp);
|
||||||
end;
|
end;
|
||||||
@ -295,11 +292,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSettingsStreamOutput.Write(const psTagName: string; const pcValue: TStrings);
|
procedure TSettingsStreamOutput.Write(const psTagName: string; const pcValue: TStrings);
|
||||||
var
|
|
||||||
ls: string;
|
|
||||||
begin
|
begin
|
||||||
ls := pcValue.CommaText;
|
Write(psTagName, pcValue.CommaText);
|
||||||
Write(psTagName, ls);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{-----------------------------------------------------------------------------
|
{-----------------------------------------------------------------------------
|
||||||
@ -385,8 +379,8 @@ begin
|
|||||||
lsStart := '<' + psTag + '>';
|
lsStart := '<' + psTag + '>';
|
||||||
lsEnd := '</' + psTag + '>';
|
lsEnd := '</' + psTag + '>';
|
||||||
|
|
||||||
liStart := JcfUtils.StrFind(lsStart, fsText, 1);
|
liStart := StrFind(lsStart, fsText, 1);
|
||||||
liEnd := JcfUtils.StrFind(lsEnd, fsText, 1);
|
liEnd := StrFind(lsEnd, fsText, 1);
|
||||||
|
|
||||||
if (liStart > 0) and (liEnd > liStart) then
|
if (liStart > 0) and (liEnd > liStart) then
|
||||||
begin
|
begin
|
||||||
|
@ -295,9 +295,7 @@ object fmRegistrySettings: TfmRegistrySettings
|
|||||||
Top = 9
|
Top = 9
|
||||||
Width = 92
|
Width = 92
|
||||||
Height = 38
|
Height = 38
|
||||||
DoubleBuffered = True
|
|
||||||
Kind = bkOK
|
Kind = bkOK
|
||||||
ParentDoubleBuffered = False
|
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnClick = btnOKClick
|
OnClick = btnOKClick
|
||||||
end
|
end
|
||||||
@ -306,9 +304,7 @@ object fmRegistrySettings: TfmRegistrySettings
|
|||||||
Top = 9
|
Top = 9
|
||||||
Width = 92
|
Width = 92
|
||||||
Height = 38
|
Height = 38
|
||||||
DoubleBuffered = True
|
|
||||||
Kind = bkCancel
|
Kind = bkCancel
|
||||||
ParentDoubleBuffered = False
|
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
OnClick = btnCancelClick
|
OnClick = btnCancelClick
|
||||||
end
|
end
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
This directory contains a copy of r676 jcf2 svn tree: https://jedicodeformat.svn.sourceforge.net/svnroot/jedicodeformat/trunk/CodeFormat/Jcf2
|
This directory contains a modified copy of r683 jcf2 svn tree: https://jedicodeformat.svn.sourceforge.net/svnroot/jedicodeformat/trunk/CodeFormat/Jcf2
|
||||||
Currently it is not useful for lazarus but we will do step by step adaptation of code to fully integrate jcf2 into Lazarus IDE.
|
|
||||||
|
Only command line utility works currently.
|
Loading…
Reference in New Issue
Block a user