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