Package: libopentoken6-dev
Version: 6.0b-5+b2
File: libopentoken6
Severity: normal

Dear Maintainer,

while processing a bunch of Ada files, the OpenToken Ada Lexer is sometimes ignoring the call to Set_Input_Feeder, and continue to parse the previously opened Ada file.

I read this in OpenToken.Token.Enumerated.Analyzer :
--------------------------------------------------------------------
    --  Reset Analyzer, to start finding tokens. This is appropriate
    --  when the Feeder text has been changed.
--------------------------------------------------------------------
    procedure Reset (Analyzer : in out Instance);

It seems appropriate, but it's not done in the Ada lexer.

For the Java lexer, no problem, as the analyzer instantiation is exposed in the package spec, the user can add a call to Analyzer.Reset just before Analyzer.Set_Text_Feeder.

But, for the Ada lexer, as the analyzer instantiation is hidden in the body, and there no Reset procedure available in the spec, there is no solution on user side.

I suggest to patch Set_Input_Feeder in ada_lexer.adb to do the same thing :

    procedure Set_Input_Feeder (File : in Ada.Text_IO.File_Type) is
    begin
       Ada.Text_IO.Set_Input (File);
       Analyzer.Reset; --> added line
       Analyzer.Set_Text_Feeder (OpenToken.Text_Feeder.Text_IO.Create (Ada.Text_IO.Current_Input));
>    end Set_Input_Feeder;


thanks,

--
-- Lionel

PS : unable to send something with reportbug!



-- System Information:


Debian Release: 9.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8), LANGUAGE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libopentoken6-dev depends on:
ii  gnat           6.1
ii  gnat-6         6.3.0-18
ii  libopentoken9  6.0b-5+b2

libopentoken6-dev recommends no packages.

libopentoken6-dev suggests no packages.

-- no debconf information

Reply via email to