mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-04 13:37:22 +01:00
jcf: more work on operators (r742)
git-svn-id: trunk@17877 -
This commit is contained in:
parent
1b6e58d0b9
commit
9aaa60fc8b
@ -19,7 +19,7 @@ object fmJCFNotepad: TfmJCFNotepad
|
||||
OnKeyUp = FormKeyUp
|
||||
OnResize = FormResize
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 120
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 20
|
||||
object sb1: TStatusBar
|
||||
Left = 0
|
||||
@ -112,10 +112,6 @@ object fmJCFNotepad: TfmJCFNotepad
|
||||
object tsOutput: TTabSheet
|
||||
Caption = 'Output'
|
||||
ImageIndex = 1
|
||||
ExplicitLeft = 0
|
||||
ExplicitTop = 0
|
||||
ExplicitWidth = 0
|
||||
ExplicitHeight = 504
|
||||
object lblMessages: TLabel
|
||||
Left = 15
|
||||
Top = 207
|
||||
|
||||
@ -157,6 +157,7 @@ uses
|
||||
{ jcl }
|
||||
JclStrings,
|
||||
{ local }
|
||||
JcfUnicodeFiles, JcfStringUtils,
|
||||
JCFHelp, fAbout, fRegistrySettings, fAllSettings, JcfFontSetFunctions;
|
||||
|
||||
{$ifdef FPC}
|
||||
@ -189,6 +190,9 @@ begin
|
||||
end;
|
||||
|
||||
procedure TfmJCFNotepad.DoFileOpen(const psFileName: string);
|
||||
var
|
||||
lsFileContents: WideString;
|
||||
leContentType: TFileContentType;
|
||||
begin
|
||||
if psFileName = '' then
|
||||
exit;
|
||||
@ -196,7 +200,13 @@ begin
|
||||
exit;
|
||||
|
||||
GetRegSettings.InputDir := ExtractFilePath(psFileName);
|
||||
mInput.Text := string(FileToString(psFileName));
|
||||
|
||||
ReadTextFile(psFileName, lsFileContents, leContentType);
|
||||
|
||||
// use standard line breaks - temp
|
||||
//lsFileContents := WideStringReplace(lsFileContents, NativeLineFeed, NativeCrLf, [rfReplaceAll]);
|
||||
|
||||
mInput.Text := lsFileContents;
|
||||
sb1.Panels[1].Text := psFileName;
|
||||
AddCheckMRU(psFileName);
|
||||
|
||||
|
||||
@ -770,7 +770,7 @@ begin
|
||||
|
||||
}
|
||||
while fcTokenList.FirstSolidTokenType in [ttConst, ttResourceString,
|
||||
ttType, ttVar, ttThreadVar, ttOpenSquareBracket, ttExports] + ProcedureWords do
|
||||
ttType, ttVar, ttThreadVar, ttOpenSquareBracket, ttExports, ttOperator] + ProcedureWords do
|
||||
RecogniseInterfaceDecl;
|
||||
end;
|
||||
|
||||
@ -997,6 +997,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TBuildParseTree.RecogniseConstSection(const pbNestedInClass: Boolean);
|
||||
var
|
||||
leFirstTokenType: TTokenType;
|
||||
begin
|
||||
{
|
||||
ConstSection -> CONST (ConstantDecl ';')...
|
||||
@ -1012,8 +1014,13 @@ begin
|
||||
// #Trident# If const is nested inside a class, a visibility designator
|
||||
// ("private" for exemple) can be written after.
|
||||
// So, inside a class, no wtReservedWordDirective allowed
|
||||
if pbNestedInClass and (fcTokenList.FirstSolidTokenType in ClassVisibility) then
|
||||
break;
|
||||
leFirstTokenType := fcTokenList.FirstSolidTokenType;
|
||||
if pbNestedInClass and (leFirstTokenType in ClassVisibility) then
|
||||
break;
|
||||
|
||||
// can be followed by an operator decl in Lazarus
|
||||
if leFirstTokenType = ttOperator then
|
||||
break;
|
||||
end;
|
||||
|
||||
PopNode;
|
||||
@ -2254,6 +2261,9 @@ begin
|
||||
PopNode;
|
||||
end;
|
||||
|
||||
{
|
||||
This is a free-pascal style operator
|
||||
}
|
||||
procedure TBuildParseTree.RecogniseOperator(const pbHasBody: boolean);
|
||||
begin
|
||||
PushNode(nFunctionDecl);
|
||||
@ -2286,7 +2296,9 @@ end;
|
||||
|
||||
procedure TBuildParseTree.RecogniseOperatorSymbol;
|
||||
const
|
||||
OperatorTokens: TTokenTypeSet = [ttPlus, ttMinus, ttTimes, ttFloatDiv, ttEquals, ttAssign];
|
||||
OperatorTokens: TTokenTypeSet = [ttPlus, ttMinus, ttTimes, ttFloatDiv,
|
||||
ttEquals, ttGreaterThan, ttLessThan, ttGreaterThanOrEqual, ttLessThanOrEqual,
|
||||
ttAssign];
|
||||
begin
|
||||
Recognise(OperatorTokens);
|
||||
end;
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
This directory contains a copy (sometimes modified) of r741 jcf2 svn tree: https://jedicodeformat.svn.sourceforge.net/svnroot/jedicodeformat/trunk/CodeFormat/Jcf2
|
||||
This directory contains a copy (sometimes modified) of r742 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