-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'topic/1045' into 'master'
Un-revert "Implement the is_keyword property." See merge request eng/libadalang/libadalang!1484
- Loading branch information
Showing
7 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
procedure Test is | ||
protected type A is | ||
I : Float := 0.1; | ||
end A; | ||
|
||
type A is synchronized interface; | ||
|
||
overriding function Bar is null; | ||
|
||
I : access Float := A.I'Access; | ||
B : Boolean := (for some I in 1 .. 10 => I mod 2 = 0); | ||
begin | ||
null; | ||
end Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'protected' is a keyword in Ada 2012 but not in Ada 83 | ||
'synchronized' is a keyword in Ada 2012 but not in Ada 83 | ||
'interface' is a keyword in Ada 2012 but not in Ada 83 | ||
'overriding' is a keyword in Ada 2012 but not in Ada 83 | ||
'some' is a keyword in Ada 2012 but not in Ada 83 | ||
Unknown Ada version ada_2013 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import libadalang as lal | ||
|
||
|
||
ctx = lal.AnalysisContext() | ||
u = ctx.get_from_file("test.adb") | ||
|
||
for token in u.iter_tokens(): | ||
is_83_token = u.root.p_is_keyword(token, "ada_83") | ||
is_12_token = u.root.p_is_keyword(token, "ada_2012") | ||
if is_12_token and not is_83_token: | ||
print(f"'{token.text}' is a keyword in Ada 2012 but not in Ada 83") | ||
|
||
# Try checking a token with an invalid Ada version | ||
try: | ||
u.root.p_is_keyword(u.first_token, "ada_2013") | ||
except Exception as e: | ||
print(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
driver: python | ||
input_sources: [test.adb] |