-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ada: bad structure's detection #2382
Comments
Partially close universal-ctags#2382. https://www.adaic.org/resources/add_content/standards/05rm/html/RM-8-3-1.html#S0178 Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Thank you. I introduced code for skipping "overriding" and "not overriding". See #2383 . I don't know Ada. So I need your help. |
Yes, that's right, and that's also how we define standard tasks and task type in specification (.ads). task Tasche_T is
entry Coucou
(Parameters : Parameters_Type);
end Tasche_T; Task type : task type Tasche_T is
entry Coucou
(Parameters : Parameters_Type);
end Tasche_T; |
Partially close universal-ctags#2382. https://www.adaic.org/resources/add_content/standards/05rm/html/RM-8-3-1.html#S0178 Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Partially close universal-ctags#2382. https://www.adaic.org/resources/add_content/standards/05rm/html/RM-8-3-1.html#S0178 Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Partially close universal-ctags#2382. https://www.adaic.org/resources/add_content/standards/05rm/html/RM-8-3-1.html#S0178 Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Partially close universal-ctags#2382. https://www.adaic.org/resources/add_content/standards/05rm/html/RM-8-3-1.html#S0178 Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Partially close universal-ctags#2382. https://www.adaic.org/resources/add_content/standards/05rm/html/RM-8-3-1.html#S0178 Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Coucou is captured well. However, the change is too specialized for the target input. |
Need more code examples ? |
Currently, the examples are enough. Thank you for the offering. |
Close universal-ctags#2382 Signed-off-by: Masatake YAMATO <yamato@redhat.com>
See #2401. Now Coucou is captured well. I would like to extend our units test cases for Ada. Could you help me? The examples you showed:
and
I would like to get them as full ads files acceptable by a compiler. I guess what you showed is code fragments. What I know is only C. So I would like to explain what I want in C. Not acceptable:
Acceptable:
|
A one file exemple, in with Ada.Text_IO;
procedure Client is
---------------------------------------------------------------------------
-- Define the tasks
task Ma_Tasche is
entry Accepter
(Continuer : Boolean);
end Ma_Tasche;
task Mon_Autre_Tasche;
-- Define body of the tasks
task body Ma_Tasche is
Var_Continuer : Boolean := False;
begin
Boucle_Principale :
loop
accept Accepter
(Continuer : Boolean)
do
Var_Continuer := Continuer;
end Accepter;
end loop Boucle_Principale;
end Ma_Tasche;
task body Mon_Autre_Tasche is
begin
null;
end Mon_Autre_Tasche;
---------------------------------------------------------------------------
begin
Ada.Text_IO.Put_Line ("Tasks won't stop, kill it with CTRL-C");
Ma_Tasche.Accepter (Continuer => True);
end Client; You need FSF gcc-ada version or GNAT on the Adacore's website.
|
I'm going to add a multi-file version soon. |
The multi file version: In a file named project Client is
for Main use ("client.adb");
for Source_Dirs use ("src/**");
for Object_Dir use "obj/";
for Exec_Dir use "bin/";
for Create_Missing_Dirs use "True";
package Compiler is
for Default_Switches ("Ada") use ("-O0", "-Wall");
end Compiler;
end Client; In a file named with Ada.Text_IO;
with Mes_Tasches_P;
procedure Client is
begin
Ada.Text_IO.Put_Line ("Tasks won't stop, kill it with CTRL-C");
Mes_Tasches_P.Ma_Tasche.Accepter (Continuer => True);
end Client; In a file named package Mes_Tasches_P is
task Ma_Tasche is
entry Accepter
(Continuer : Boolean);
end Ma_Tasche;
task Mon_Autre_Tasche;
end Mes_Tasches_P; In a file named package body Mes_Tasches_P is
task body Ma_Tasche is
Var_Continuer : Boolean := False;
begin
Boucle_Principale :
loop
accept Accepter
(Continuer : Boolean)
do
Var_Continuer := Continuer;
end Accepter;
end loop Boucle_Principale;
end Ma_Tasche;
task body Mon_Autre_Tasche is
begin
null;
end Mon_Autre_Tasche;
end Mes_Tasches_P; Result of the command .
├── client.gpr
└── src
├── mes_tasches_p.adb
├── mes_tasches_p.ads
└── client.adb Compile it with |
I forgot the task type,task type with discriminant, protected, protected type, protected type with discriminant. File package Mes_Tasches_P is
task Ma_Tasche is
entry Accepter
(Continuer : Boolean);
end Ma_Tasche;
task Mon_Autre_Tasche;
task type Tasche_Type_1_T;
Une_Tasche : Tasche_Type_1_T;
task type Tasche_Type_2_T is
entry Start;
entry Lire
(Donnee : out Integer);
end Tasche_Type_2_T;
-- Task type with discriminant.
task type Tasche_Type_3_T
-- We could have any number of arguments in discriminant
-- Work exactly like argument in procedure/function/entry/accept
(Taille : Integer)
is
entry Start;
end Tasche_Type_3_T;
-- protected objects.
protected Objet_Protege is
entry Demarrer;
procedure Faire;
function Tester return Boolean;
private
Variable : Boolean := True;
end Objet_Protege;
protected type Type_Protege is
entry Demarrer;
procedure Faire;
function Tester return Boolean;
private
Variable : Boolean := True;
end Type_Protege;
protected type Discriminant_Protege
(Priorite : Natural)
is
entry Demarrer;
procedure Faire;
function Tester return Boolean;
private
Variable : Boolean := True;
end Discriminant_Protege;
end Mes_Tasches_P; File package body Mes_Tasches_P is
---------------------------------------------------------------------------
task body Ma_Tasche is
Var_Continuer : Boolean := False;
begin
Boucle_Principale :
loop
accept Accepter
(Continuer : Boolean)
do
Var_Continuer := Continuer;
end Accepter;
end loop Boucle_Principale;
end Ma_Tasche;
---------------------------------------------------------------------------
---------------------------------------------------------------------------
task body Mon_Autre_Tasche is
begin
null;
end Mon_Autre_Tasche;
---------------------------------------------------------------------------
Une_Autre_Tasche_1 : Tasche_Type_1_T;
---------------------------------------------------------------------------
task body Tasche_Type_1_T is
begin
null;
end Tasche_Type_1_T;
---------------------------------------------------------------------------
---------------------------------------------------------------------------
task body Tasche_Type_2_T is
begin
null;
end Tasche_Type_2_T;
---------------------------------------------------------------------------
---------------------------------------------------------------------------
task body Tasche_Type_3_T is
begin
null;
end Tasche_Type_3_T;
---------------------------------------------------------------------------
Une_Autre_Tasche_2 : Tasche_Type_2_T;
Une_Autre_Tasche_3 : Tasche_Type_3_T (Taille => 5);
---------------------------------------------------------------------------
protected body Objet_Protege is
entry Demarrer
when Variable
is
begin
null;
end Demarrer;
procedure Faire is
begin
null;
end Faire;
function Tester
return Boolean
is
begin
return Variable;
end Tester;
end Objet_Protege;
---------------------------------------------------------------------------
---------------------------------------------------------------------------
protected body Type_Protege is
entry Demarrer
when Variable
is
begin
null;
end Demarrer;
procedure Faire is
begin
null;
end Faire;
function Tester
return Boolean
is
begin
return Variable;
end Tester;
end Type_Protege;
---------------------------------------------------------------------------
---------------------------------------------------------------------------
protected body Discriminant_Protege is
entry Demarrer
when Variable
is
begin
null;
end Demarrer;
procedure Faire is
begin
null;
end Faire;
function Tester
return Boolean
is
begin
return Variable;
end Tester;
end Discriminant_Protege;
---------------------------------------------------------------------------
end Mes_Tasches_P; No change in |
Thank you. It is successfully built. |
Heavily based on the comment in universal-ctags#2382 submitted by @JulienPivard.
The test case is integrated. Thank you very much. I have one more request. Now, you are here. So I would like you to help me verify the expected output.
During working on this pull request, I have studied Ada a bit. So I understand what we should tag mostly. However, there is one I cannot decide whether it should be tagged or not. See the line 32:
Do you think we should tag |
Line 32 I didn't realize you have so few exemples, do you want me to write some more? |
Oh, I'm very sorry. u-ctags captures Node at line 32:
I misread the output.
|
After adding --kinds-Ada=*, ctags captures Node at line 32. |
Heavily based on the comment in universal-ctags#2382 submitted by @JulienPivard.
I merged the change for fixing this issue. |
The name of the parser: Universal ctags installed with Homebrew
The command line you used to run ctags:
The content of input file:
The tags output you are not satisfied with:
overriding
,procedure
are not variable's name, there are keywords.Inutile
is a name of a subprogram.(This
is an argument of subprogram.entry
Coucou
's signature is not seeThe tags output you expect:
The corresponding body :
The command line you used to run ctags:
The content of input file:
The tags output you are not satisfied with:
The tags output you expect:
The version of ctags:
How do you get ctags binary:
Homebrew with default settings.
The text was updated successfully, but these errors were encountered: