Skip to content

Commit

Permalink
Ada: skip overriding indicator introduced in Ada 2005
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
masatake committed Dec 18, 2019
1 parent e216bb4 commit b5deb99
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 0 deletions.
1 change: 1 addition & 0 deletions Units/parser-ada.r/ada-overriding.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--sort=no
Empty file.
36 changes: 36 additions & 0 deletions Units/parser-ada.r/ada-overriding.d/input-2.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
-- Taken from #2382 submitted by @JulienPivard
with Ada.Text_IO;

package body Carte_P.Tasche_P
with Spark_Mode => Off
is

---------------------------------------------------------------------------
task body Tasche_T is
-- Les déclarations qui vont bien.
begin
accept Coucou do
null;
end Coucou;

Ada.Text_IO.Put_Line (Item => "Wesh gros je suis une tâche");

-- accept Inutile do
-- null;
-- end Inutile;
abort Tasche_T;
end Tasche_T;
---------------------------------------------------------------------------

---------------------------------------------------------------------------
overriding
procedure Inutile
(This : in out Tasche_T)
is
begin
null;
end Inutile;
---------------------------------------------------------------------------

end Carte_P.Tasche_P;

40 changes: 40 additions & 0 deletions Units/parser-ada.r/ada-overriding.d/input.ada
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-- Taken from #2382 submitted by @JulienPivard
-- @summary
-- Implémentation par une tâche.
-- @description
-- Implémentation par une tache de la classe synchronisé.
-- @group Version tâche
package Carte_P.Tasche_P
with
Pure => False,
Preelaborate => False,
Elaborate_Body => True,
Spark_Mode => Off
is

---------------------------------------------------------------------------
task type Tasche_T is new Carte_T with
-- Implémentation par une tâche de l'interface Carte_T.

-----------------------------------
overriding
entry Coucou;
-- Implémentation par un accept.

-----------------------------------
-- overriding
-- entry Inutile;
-- Implémentation par un accept.
-- @param This
-- La carte.
end Tasche_T;
---------------------------------------------------------------------------

overriding
procedure Inutile
(This : in out Tasche_T);
-- Implémentation par une procédure.
-- @param This
-- La carte.

end Carte_P.Tasche_P;
17 changes: 17 additions & 0 deletions parsers/ada.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ typedef enum eAdaKeywords
ADA_KEYWORD_LOOP,
ADA_KEYWORD_NEW,
ADA_KEYWORD_OR,
ADA_KEYWORD_OVERRIDING, /* Ada 2005 */
ADA_KEYWORD_PACKAGE,
ADA_KEYWORD_PRAGMA,
ADA_KEYWORD_PRIVATE,
Expand Down Expand Up @@ -271,6 +272,7 @@ static const char *AdaKeywords[] =
"loop",
"new",
"or",
"overriding",
"package",
"pragma",
"private",
Expand Down Expand Up @@ -1515,6 +1517,11 @@ static adaTokenInfo *adaParse(adaParseMode mode, adaTokenInfo *parent)
skipPast(";");
}
} /* else if(adaKeywordCmp(ADA_KEYWORD_SEPARATE)) */
else if (adaKeywordCmp(ADA_KEYWORD_OVERRIDING))
{
/* Do nothing, just ignore this keyword. */
;
}
else
{
/* otherwise, nothing was found so just skip until the end of this
Expand Down Expand Up @@ -1605,6 +1612,11 @@ static adaTokenInfo *adaParse(adaParseMode mode, adaTokenInfo *parent)
/* skip to the end of this formal type declaration */
skipPast(";");
} /* else if(adaKeywordCmp(ADA_KEYWORD_WITH)) */
else if (adaKeywordCmp(ADA_KEYWORD_OVERRIDING))
{
/* Do nothing, just ignore this keyword. */
;
}
else
{
/* otherwise, nothing was found so just skip until the end of this
Expand Down Expand Up @@ -1723,6 +1735,11 @@ static adaTokenInfo *adaParse(adaParseMode mode, adaTokenInfo *parent)

skipWhiteSpace();
}
else if (adaKeywordCmp(ADA_KEYWORD_OVERRIDING))
{
/* Do nothing, just ignore this keyword. */
;
}
else
{
/* if nothing else matched this is probably a variable, constant
Expand Down

0 comments on commit b5deb99

Please sign in to comment.