View Issue Details

IDProjectCategoryView StatusLast Update
0032664FPCFCLpublic2017-12-29 10:35
ReporterMichael FuchsAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.1.1Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0032664: fcl-passrc: Add endline information to TPasElement
DescriptionAt the moment fcl-passrc does not save information of the endline in a TPasElement.

The attached patch uses TPasTreeContainer.FinishScope to fill a new field "SourceEndLinenumber" with this information.

See also the discussion "[fpc-pascal] fcl-passrc: in which line a TPasElement ends?" on the mailing list.
TagsNo tags attached.
Fixed in Revision37850
FPCOldBugId
FPCTarget
Attached Files
  • endlinenumber.diff (1,616 bytes)
    Index: packages/fcl-passrc/src/pastree.pp
    ===================================================================
    --- packages/fcl-passrc/src/pastree.pp	(Revision 37557)
    +++ packages/fcl-passrc/src/pastree.pp	(Arbeitskopie)
    @@ -136,6 +136,7 @@
       public
         SourceFilename: string;
         SourceLinenumber: Integer;
    +    SourceEndLinenumber: Integer;
         Visibility: TPasMemberVisibility;
       public
         constructor Create(const AName: string; AParent: TPasElement); virtual;
    Index: packages/fcl-passrc/src/pparser.pp
    ===================================================================
    --- packages/fcl-passrc/src/pparser.pp	(Revision 37557)
    +++ packages/fcl-passrc/src/pparser.pp	(Arbeitskopie)
    @@ -447,7 +447,7 @@
     function ParseSource(AEngine: TPasTreeContainer;
                          const FPCCommandLine, OSTarget, CPUTarget: String;
                          Options : TParseSourceOptions): TPasModule;
    -                     
    +
     Function IsHintToken(T : String; Out AHint : TPasMemberHint) : boolean;
     Function IsProcModifier(S : String; Out PM : TProcedureModifier) : Boolean;
     Function IsCallingConvention(S : String; out CC : TCallingConvention) : Boolean;
    @@ -755,7 +755,7 @@
       El: TPasElement);
     begin
       if ScopeType=stModule then ;
    -  if El=nil then ;
    +  if El=nil then else El.SourceEndLinenumber := CurrentParser.CurSourcePos.Row;
     end;
     
     function TPasTreeContainer.FindModule(const AName: String): TPasModule;
    @@ -2116,7 +2116,7 @@
     
       Result:=Last;
       func:=Last;
    -  
    +
       if Last.Kind<>pekSet then NextToken;
       if not (Last.Kind in [pekNumber,pekString,pekSet,pekIdent,pekSelf,pekNil]) then
         exit;
    
    endlinenumber.diff (1,616 bytes)

Activities

Michael Fuchs

2017-11-08 16:52

reporter  

endlinenumber.diff (1,616 bytes)
Index: packages/fcl-passrc/src/pastree.pp
===================================================================
--- packages/fcl-passrc/src/pastree.pp	(Revision 37557)
+++ packages/fcl-passrc/src/pastree.pp	(Arbeitskopie)
@@ -136,6 +136,7 @@
   public
     SourceFilename: string;
     SourceLinenumber: Integer;
+    SourceEndLinenumber: Integer;
     Visibility: TPasMemberVisibility;
   public
     constructor Create(const AName: string; AParent: TPasElement); virtual;
Index: packages/fcl-passrc/src/pparser.pp
===================================================================
--- packages/fcl-passrc/src/pparser.pp	(Revision 37557)
+++ packages/fcl-passrc/src/pparser.pp	(Arbeitskopie)
@@ -447,7 +447,7 @@
 function ParseSource(AEngine: TPasTreeContainer;
                      const FPCCommandLine, OSTarget, CPUTarget: String;
                      Options : TParseSourceOptions): TPasModule;
-                     
+
 Function IsHintToken(T : String; Out AHint : TPasMemberHint) : boolean;
 Function IsProcModifier(S : String; Out PM : TProcedureModifier) : Boolean;
 Function IsCallingConvention(S : String; out CC : TCallingConvention) : Boolean;
@@ -755,7 +755,7 @@
   El: TPasElement);
 begin
   if ScopeType=stModule then ;
-  if El=nil then ;
+  if El=nil then else El.SourceEndLinenumber := CurrentParser.CurSourcePos.Row;
 end;
 
 function TPasTreeContainer.FindModule(const AName: String): TPasModule;
@@ -2116,7 +2116,7 @@
 
   Result:=Last;
   func:=Last;
-  
+
   if Last.Kind<>pekSet then NextToken;
   if not (Last.Kind in [pekNumber,pekString,pekSet,pekIdent,pekSelf,pekNil]) then
     exit;
endlinenumber.diff (1,616 bytes)

Michael Van Canneyt

2017-12-29 10:35

administrator   ~0105092

Applied patch, thank you !

Issue History

Date Modified Username Field Change
2017-11-08 16:52 Michael Fuchs New Issue
2017-11-08 16:52 Michael Fuchs File Added: endlinenumber.diff
2017-11-08 17:16 Michael Van Canneyt Assigned To => Michael Van Canneyt
2017-11-08 17:16 Michael Van Canneyt Status new => assigned
2017-12-29 10:35 Michael Van Canneyt Fixed in Revision => 37850
2017-12-29 10:35 Michael Van Canneyt Note Added: 0105092
2017-12-29 10:35 Michael Van Canneyt Status assigned => resolved
2017-12-29 10:35 Michael Van Canneyt Fixed in Version => 3.1.1
2017-12-29 10:35 Michael Van Canneyt Resolution open => fixed
2017-12-29 10:35 Michael Van Canneyt Target Version => 3.2.0