mirror of https://github.com/Wilfred/difftastic/
Unvendor tree-sitter-ada
parent
43274db8ca
commit
b0e331eb2f
@ -1 +0,0 @@
|
||||
../tree-sitter-ada/queries/highlights.scm
|
||||
@ -0,0 +1,180 @@
|
||||
;; highlight queries.
|
||||
;; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries
|
||||
;; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations
|
||||
;; for a list of recommended @ tags, though not all of them have matching
|
||||
;; highlights in neovim.
|
||||
|
||||
[
|
||||
"abort"
|
||||
"abs"
|
||||
"abstract"
|
||||
"accept"
|
||||
"access"
|
||||
"all"
|
||||
"array"
|
||||
"at"
|
||||
"begin"
|
||||
"declare"
|
||||
"delay"
|
||||
"delta"
|
||||
"digits"
|
||||
"do"
|
||||
"end"
|
||||
"entry"
|
||||
"exit"
|
||||
"generic"
|
||||
"interface"
|
||||
"is"
|
||||
"limited"
|
||||
"null"
|
||||
"of"
|
||||
"others"
|
||||
"out"
|
||||
"pragma"
|
||||
"private"
|
||||
"range"
|
||||
"synchronized"
|
||||
"tagged"
|
||||
"task"
|
||||
"terminate"
|
||||
"until"
|
||||
"when"
|
||||
] @keyword
|
||||
[
|
||||
"aliased"
|
||||
"constant"
|
||||
"renames"
|
||||
] @storageclass
|
||||
[
|
||||
"mod"
|
||||
"new"
|
||||
"protected"
|
||||
"record"
|
||||
"subtype"
|
||||
"type"
|
||||
] @keyword.type
|
||||
[
|
||||
"with"
|
||||
"use"
|
||||
] @include
|
||||
[
|
||||
"body"
|
||||
"function"
|
||||
"overriding"
|
||||
"procedure"
|
||||
"package"
|
||||
"separate"
|
||||
] @keyword.function
|
||||
[
|
||||
"and"
|
||||
"in"
|
||||
"not"
|
||||
"or"
|
||||
"xor"
|
||||
] @keyword.operator
|
||||
[
|
||||
"while"
|
||||
"loop"
|
||||
"for"
|
||||
"parallel"
|
||||
"reverse"
|
||||
"some"
|
||||
] @repeat
|
||||
[
|
||||
"return"
|
||||
] @keyword.return
|
||||
[
|
||||
"case"
|
||||
"if"
|
||||
"else"
|
||||
"then"
|
||||
"elsif"
|
||||
"select"
|
||||
] @conditional
|
||||
[
|
||||
"exception"
|
||||
"raise"
|
||||
] @exception
|
||||
(comment) @comment
|
||||
(comment) @spell ;; spell-check comments
|
||||
(string_literal) @string
|
||||
(string_literal) @spell ;; spell-check strings
|
||||
(character_literal) @string
|
||||
(numeric_literal) @number
|
||||
|
||||
;; Highlight the name of subprograms
|
||||
(procedure_specification name: (_) @function)
|
||||
(function_specification name: (_) @function)
|
||||
(package_declaration name: (_) @function)
|
||||
(package_body name: (_) @function)
|
||||
(generic_instantiation name: (_) @function)
|
||||
(entry_declaration . (identifier) @function)
|
||||
|
||||
;; Some keywords should take different categories depending on the context
|
||||
(use_clause "use" @include "type" @include)
|
||||
(with_clause "private" @include)
|
||||
(with_clause "limited" @include)
|
||||
(use_clause (_) @namespace)
|
||||
(with_clause (_) @namespace)
|
||||
|
||||
(loop_statement "end" @keyword.repeat)
|
||||
(if_statement "end" @conditional)
|
||||
(loop_parameter_specification "in" @keyword.repeat)
|
||||
(loop_parameter_specification "in" @keyword.repeat)
|
||||
(iterator_specification ["in" "of"] @keyword.repeat)
|
||||
(range_attribute_designator "range" @keyword.repeat)
|
||||
|
||||
(raise_statement "with" @exception)
|
||||
|
||||
(gnatprep_declarative_if_statement) @preproc
|
||||
(gnatprep_if_statement) @preproc
|
||||
(gnatprep_identifier) @preproc
|
||||
|
||||
(subprogram_declaration "is" @keyword.function "abstract" @keyword.function)
|
||||
(aspect_specification "with" @keyword.function)
|
||||
|
||||
(full_type_declaration "is" @keyword.type)
|
||||
(subtype_declaration "is" @keyword.type)
|
||||
(record_definition "end" @keyword.type)
|
||||
(full_type_declaration (_ "access" @keyword.type))
|
||||
(array_type_definition "array" @keyword.type "of" @keyword.type)
|
||||
(access_to_object_definition "access" @keyword.type)
|
||||
(access_to_object_definition "access" @keyword.type
|
||||
[
|
||||
(general_access_modifier "constant" @keyword.type)
|
||||
(general_access_modifier "all" @keyword.type)
|
||||
]
|
||||
)
|
||||
(range_constraint "range" @keyword.type)
|
||||
(signed_integer_type_definition "range" @keyword.type)
|
||||
(index_subtype_definition "range" @keyword.type)
|
||||
(record_type_definition "abstract" @keyword.type)
|
||||
(record_type_definition "tagged" @keyword.type)
|
||||
(record_type_definition "limited" @keyword.type)
|
||||
(record_type_definition (record_definition "null" @keyword.type))
|
||||
(private_type_declaration "is" @keyword.type "private" @keyword.type)
|
||||
(private_type_declaration "tagged" @keyword.type)
|
||||
(private_type_declaration "limited" @keyword.type)
|
||||
(task_type_declaration "task" @keyword.type "is" @keyword.type)
|
||||
|
||||
;; Gray the body of expression functions
|
||||
(expression_function_declaration
|
||||
(function_specification)
|
||||
"is"
|
||||
(_) @attribute
|
||||
)
|
||||
(subprogram_declaration (aspect_specification) @attribute)
|
||||
|
||||
;; Highlight full subprogram specifications
|
||||
;(subprogram_body
|
||||
; [
|
||||
; (procedure_specification)
|
||||
; (function_specification)
|
||||
; ] @function.spec
|
||||
;)
|
||||
|
||||
;; Highlight errors in red. This is not very useful in practice, as text will
|
||||
;; be highlighted as user types, and the error could be elsewhere in the code.
|
||||
;; This also requires defining :hi @error guifg=Red for instance.
|
||||
(ERROR) @error
|
||||
|
||||
@ -1 +0,0 @@
|
||||
tree-sitter-ada/src
|
||||
@ -1,9 +0,0 @@
|
||||
binding.gyp
|
||||
bindings/node/binding.cc
|
||||
bindings/node/index.js
|
||||
bindings/rust/build.rs
|
||||
bindings/rust/lib.rs
|
||||
Cargo.lock
|
||||
Cargo.toml
|
||||
log.html
|
||||
node_modules/
|
||||
@ -1,136 +0,0 @@
|
||||
# Tree-Sitter parser for Ada
|
||||
|
||||
The grammar is adapted from the work done by Stephen Leak for the
|
||||
Emacs ada-mode. It was translated (partially for now) to tree-sitter
|
||||
syntax, and slightly changed to reduce some conflicts. Tree-sitter
|
||||
doesn't need a full syntax tree, so we can take some shortcuts in
|
||||
the grammar.
|
||||
|
||||
## Installation
|
||||
|
||||
You will need neovim at least version 8.0 (not tested with earlier version).
|
||||
|
||||
Installation is very manual at this stage, until we can integrate this package
|
||||
inside nvim-treesitter itself. At the moment, assuming you are using lua
|
||||
configuration and Packer for your package management:
|
||||
|
||||
```lua
|
||||
-- file: ~/.config/nvim/init.lua
|
||||
|
||||
-- Merge this with any existing Packer configuration you might already
|
||||
-- have. This loads packer itself, then loads the new `ada.nvim` package.
|
||||
require('packer').startup(function(use)
|
||||
use(require('mytreesitter.nvim'))
|
||||
end)
|
||||
```
|
||||
|
||||
Then create a new file to setup treesitter (or merge with an existing
|
||||
configuration of course).
|
||||
```lua
|
||||
-- file: ~/.config/nvim/mytreesitter.nvim
|
||||
|
||||
return {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
requires = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects'
|
||||
},
|
||||
run=function()
|
||||
require('nvim-treesitter.install').update({ with_sync = true })
|
||||
end,
|
||||
config=function()
|
||||
|
||||
-- Add support for our Ada parser
|
||||
|
||||
local parsers = require "nvim-treesitter.parsers"
|
||||
local parser_config = parsers.get_parser_configs()
|
||||
parser_config.ada = {
|
||||
install_info = {
|
||||
url = "https://github.com/briot/tree-sitter-ada",
|
||||
files = {"src/parser.c"},
|
||||
generate_requires_npm = false,
|
||||
requires_generate_from_grammar = false,
|
||||
},
|
||||
filetype = "ada",
|
||||
}
|
||||
end,
|
||||
}
|
||||
```
|
||||
|
||||
Finally, we need to install the Ada parser with:
|
||||
```vim
|
||||
:PackerSync " to install treesitter itself
|
||||
:TSInstall ada " to install Ada support
|
||||
```
|
||||
|
||||
However, the above part only installs the parser itself (to generate a syntax
|
||||
tree from your source files). We now need to install queries, i.e. pattern
|
||||
matching against that tree to provide various capabilities like syntax
|
||||
highlighting, folding, indentation, smart textobject selection,...
|
||||
|
||||
For this, and until we can merge with nvim-treesitter itself, you will have
|
||||
to clone this github repository, then copy the `queries/` directory to
|
||||
```
|
||||
~/.local/share/nvim/site/pack/packer/start/nvim-treesitter/queries/
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Syntax highlighting
|
||||
|
||||
The above default configuration will replace the default regular
|
||||
expressions-based syntax highlighting in vim. Instead, the highlighting is
|
||||
based on the tree build every time you type something.
|
||||
|
||||
The default highlighting looks pretty much like the one from the standard
|
||||
Ada mode. However, the tree-based approach potentially opens the door for
|
||||
smart highlighting, like "Use a different background color for a subprogram
|
||||
specification", "show constant definitions in blue" or other high-level
|
||||
approaches.
|
||||
|
||||
WIP: document how users can do this in their own configuration files.
|
||||
The current approach is to modify queries/highlights.scm
|
||||
|
||||
Potentially (though it seems to be disabled in neovim at the moment), the
|
||||
highlighting can also get smarter. Going back to the "show constants in
|
||||
blue" example above, the queries/locals.scm file adds a simple approach so
|
||||
that references to those constants can point to the definition, and therefore
|
||||
use the same blue highlighting.
|
||||
|
||||
Because neovim also has support for language servers (LSP), it is likely
|
||||
better to rely on the language server here.
|
||||
|
||||
### Block folding
|
||||
|
||||
If you press <kbd>za</kbd> now, this will toggle the folding of the
|
||||
"current block".
|
||||
This is defined in queries/folds.scm, and currently knows about package
|
||||
specifications, package bodies, subprograms bodies, if statements and loops.
|
||||
Other semantic blocks could be added.
|
||||
|
||||
### Smart Selection
|
||||
|
||||
The file queries/textobjects.scm defines a function textobjects, so that
|
||||
you can now use commands like
|
||||
|
||||
- <kbd>vaf</kbd> (v)isually select (a) (f)unction or subprogram
|
||||
- <kbd>vif</kbd> (v)isually select (i)nside a (f)unction or subprogram
|
||||
- <kbd>vai</kbd> (v)isually select (a) (i)f statement (or loop)
|
||||
- <kbd>vii</kbd> (v)isually select (i)nside an (i)f statement (or loop)
|
||||
|
||||
|
||||
## Development
|
||||
|
||||
Execute the following commands:
|
||||
```bash
|
||||
npm install
|
||||
npm run test
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
The grammar itself is fully described in the file grammar.js.
|
||||
When it processes it, TreeSitter generates src/grammar.json, which can be
|
||||
converted to a EBNF format via https://github.com/mingodad/plgh/blob/main/json2ebnf.js
|
||||
and rendered into a diagram on https://www.bottlecaps.de/rr/ui if you
|
||||
prefer graphical visualization (you can also copy-paste from issue #1 a
|
||||
pre-processed version of grammar.json).
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,28 +0,0 @@
|
||||
{
|
||||
"name": "tree-sitter-ada",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"tree-sitter": "0.20.0",
|
||||
"tree-sitter-cli": "0.20.7"
|
||||
},
|
||||
"scripts": {
|
||||
"generate": "tree-sitter generate",
|
||||
"test": "tree-sitter generate && time tree-sitter test",
|
||||
"testquick": "time tree-sitter test",
|
||||
"update-test": "tree-sitter test --update",
|
||||
"install": "cp queries/*scm ~/.local/share/nvim/site/pack/packer/start/nvim-treesitter/queries/ada; echo 'RUN :TSInstall ada' in nvim"
|
||||
},
|
||||
"main": "bindings/node",
|
||||
"tree-sitter": [
|
||||
{
|
||||
"scope": "source.ada",
|
||||
"file-types": [
|
||||
"adb", "ads"
|
||||
],
|
||||
"highlights": [
|
||||
"queries/highlights.scm"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
;; Support for folding in Ada
|
||||
;; za toggles folding a package, subprogram, if statement or loop
|
||||
|
||||
[
|
||||
(package_declaration)
|
||||
(generic_package_declaration)
|
||||
(package_body)
|
||||
(subprogram_body)
|
||||
(block_statement)
|
||||
(if_statement)
|
||||
(loop_statement)
|
||||
(gnatprep_declarative_if_statement)
|
||||
(gnatprep_if_statement)
|
||||
] @fold
|
||||
@ -1,180 +0,0 @@
|
||||
;; highlight queries.
|
||||
;; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries
|
||||
;; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations
|
||||
;; for a list of recommended @ tags, though not all of them have matching
|
||||
;; highlights in neovim.
|
||||
|
||||
[
|
||||
"abort"
|
||||
"abs"
|
||||
"abstract"
|
||||
"accept"
|
||||
"access"
|
||||
"all"
|
||||
"array"
|
||||
"at"
|
||||
"begin"
|
||||
"declare"
|
||||
"delay"
|
||||
"delta"
|
||||
"digits"
|
||||
"do"
|
||||
"end"
|
||||
"entry"
|
||||
"exit"
|
||||
"generic"
|
||||
"interface"
|
||||
"is"
|
||||
"limited"
|
||||
"null"
|
||||
"of"
|
||||
"others"
|
||||
"out"
|
||||
"pragma"
|
||||
"private"
|
||||
"range"
|
||||
"synchronized"
|
||||
"tagged"
|
||||
"task"
|
||||
"terminate"
|
||||
"until"
|
||||
"when"
|
||||
] @keyword
|
||||
[
|
||||
"aliased"
|
||||
"constant"
|
||||
"renames"
|
||||
] @storageclass
|
||||
[
|
||||
"mod"
|
||||
"new"
|
||||
"protected"
|
||||
"record"
|
||||
"subtype"
|
||||
"type"
|
||||
] @keyword.type
|
||||
[
|
||||
"with"
|
||||
"use"
|
||||
] @include
|
||||
[
|
||||
"body"
|
||||
"function"
|
||||
"overriding"
|
||||
"procedure"
|
||||
"package"
|
||||
"separate"
|
||||
] @keyword.function
|
||||
[
|
||||
"and"
|
||||
"in"
|
||||
"not"
|
||||
"or"
|
||||
"xor"
|
||||
] @keyword.operator
|
||||
[
|
||||
"while"
|
||||
"loop"
|
||||
"for"
|
||||
"parallel"
|
||||
"reverse"
|
||||
"some"
|
||||
] @repeat
|
||||
[
|
||||
"return"
|
||||
] @keyword.return
|
||||
[
|
||||
"case"
|
||||
"if"
|
||||
"else"
|
||||
"then"
|
||||
"elsif"
|
||||
"select"
|
||||
] @conditional
|
||||
[
|
||||
"exception"
|
||||
"raise"
|
||||
] @exception
|
||||
(comment) @comment
|
||||
(comment) @spell ;; spell-check comments
|
||||
(string_literal) @string
|
||||
(string_literal) @spell ;; spell-check strings
|
||||
(character_literal) @string
|
||||
(numeric_literal) @number
|
||||
|
||||
;; Highlight the name of subprograms
|
||||
(procedure_specification name: (_) @function)
|
||||
(function_specification name: (_) @function)
|
||||
(package_declaration name: (_) @function)
|
||||
(package_body name: (_) @function)
|
||||
(generic_instantiation name: (_) @function)
|
||||
(entry_declaration . (identifier) @function)
|
||||
|
||||
;; Some keywords should take different categories depending on the context
|
||||
(use_clause "use" @include "type" @include)
|
||||
(with_clause "private" @include)
|
||||
(with_clause "limited" @include)
|
||||
(use_clause (_) @namespace)
|
||||
(with_clause (_) @namespace)
|
||||
|
||||
(loop_statement "end" @keyword.repeat)
|
||||
(if_statement "end" @conditional)
|
||||
(loop_parameter_specification "in" @keyword.repeat)
|
||||
(loop_parameter_specification "in" @keyword.repeat)
|
||||
(iterator_specification ["in" "of"] @keyword.repeat)
|
||||
(range_attribute_designator "range" @keyword.repeat)
|
||||
|
||||
(raise_statement "with" @exception)
|
||||
|
||||
(gnatprep_declarative_if_statement) @preproc
|
||||
(gnatprep_if_statement) @preproc
|
||||
(gnatprep_identifier) @preproc
|
||||
|
||||
(subprogram_declaration "is" @keyword.function "abstract" @keyword.function)
|
||||
(aspect_specification "with" @keyword.function)
|
||||
|
||||
(full_type_declaration "is" @keyword.type)
|
||||
(subtype_declaration "is" @keyword.type)
|
||||
(record_definition "end" @keyword.type)
|
||||
(full_type_declaration (_ "access" @keyword.type))
|
||||
(array_type_definition "array" @keyword.type "of" @keyword.type)
|
||||
(access_to_object_definition "access" @keyword.type)
|
||||
(access_to_object_definition "access" @keyword.type
|
||||
[
|
||||
(general_access_modifier "constant" @keyword.type)
|
||||
(general_access_modifier "all" @keyword.type)
|
||||
]
|
||||
)
|
||||
(range_constraint "range" @keyword.type)
|
||||
(signed_integer_type_definition "range" @keyword.type)
|
||||
(index_subtype_definition "range" @keyword.type)
|
||||
(record_type_definition "abstract" @keyword.type)
|
||||
(record_type_definition "tagged" @keyword.type)
|
||||
(record_type_definition "limited" @keyword.type)
|
||||
(record_type_definition (record_definition "null" @keyword.type))
|
||||
(private_type_declaration "is" @keyword.type "private" @keyword.type)
|
||||
(private_type_declaration "tagged" @keyword.type)
|
||||
(private_type_declaration "limited" @keyword.type)
|
||||
(task_type_declaration "task" @keyword.type "is" @keyword.type)
|
||||
|
||||
;; Gray the body of expression functions
|
||||
(expression_function_declaration
|
||||
(function_specification)
|
||||
"is"
|
||||
(_) @attribute
|
||||
)
|
||||
(subprogram_declaration (aspect_specification) @attribute)
|
||||
|
||||
;; Highlight full subprogram specifications
|
||||
;(subprogram_body
|
||||
; [
|
||||
; (procedure_specification)
|
||||
; (function_specification)
|
||||
; ] @function.spec
|
||||
;)
|
||||
|
||||
;; Highlight errors in red. This is not very useful in practice, as text will
|
||||
;; be highlighted as user types, and the error could be elsewhere in the code.
|
||||
;; This also requires defining :hi @error guifg=Red for instance.
|
||||
(ERROR) @error
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
;; Better highlighting by referencing to the definition, for variable
|
||||
;; references. However, this is not yet supported by neovim
|
||||
;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
|
||||
|
||||
(compilation) @scope
|
||||
(package_declaration) @scope
|
||||
(package_body) @scope
|
||||
(subprogram_declaration) @scope
|
||||
(subprogram_body) @scope
|
||||
(block_statement) @scope
|
||||
|
||||
(with_clause (identifier) @definition.import)
|
||||
(procedure_specification name: (_) @definition.function)
|
||||
(function_specification name: (_) @definition.function)
|
||||
(package_declaration name: (_) @definition.var)
|
||||
(package_body name: (_) @definition.var)
|
||||
(generic_instantiation . name: (_) @definition.var)
|
||||
(component_declaration . (identifier) @definition.var)
|
||||
(exception_declaration . (identifier) @definition.var)
|
||||
(formal_object_declaration . (identifier) @definition.var)
|
||||
(object_declaration . (identifier) @definition.var)
|
||||
(parameter_specification . (identifier) @definition.var)
|
||||
(full_type_declaration . (identifier) @definition.type)
|
||||
(private_type_declaration . (identifier) @definition.type)
|
||||
(private_extension_declaration . (identifier) @definition.type)
|
||||
(incomplete_type_declaration . (identifier) @definition.type)
|
||||
(protected_type_declaration . (identifier) @definition.type)
|
||||
(formal_complete_type_declaration . (identifier) @definition.type)
|
||||
(formal_incomplete_type_declaration . (identifier) @definition.type)
|
||||
(task_type_declaration . (identifier) @definition.type)
|
||||
(subtype_declaration . (identifier) @definition.type)
|
||||
|
||||
(identifier) @reference
|
||||
@ -1,23 +0,0 @@
|
||||
;; Support for high-level text objects selections.
|
||||
;; For instance:
|
||||
;; vaf (v)isually select (a) (f)unction or subprogram
|
||||
;; vif (v)isually select (i)nside a (f)unction or subprogram
|
||||
;; vai (v)isually select (a) (i)f statement (or loop)
|
||||
;; vii (v)isually select (i)nside an (i)f statement (or loop)
|
||||
;;
|
||||
;; https://github.com/nvim-treesitter/nvim-treesitter-textobjects/blob/master/README.md
|
||||
|
||||
(subprogram_body) @function.outer
|
||||
(subprogram_body (non_empty_declarative_part) @function.inner)
|
||||
(subprogram_body (handled_sequence_of_statements) @function.inner)
|
||||
(function_specification) @function.outer
|
||||
(procedure_specification) @function.outer
|
||||
(package_declaration) @function.outer
|
||||
(generic_package_declaration) @function.outer
|
||||
(package_body) @function.outer
|
||||
(if_statement) @block.outer
|
||||
(if_statement statements: (_) @block.inner)
|
||||
(if_statement else_statements: (_) @block.inner)
|
||||
(elsif_statement_item statements: (_) @block.inner)
|
||||
(loop_statement) @block.outer
|
||||
(loop_statement statements: (_) @block.inner)
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,224 +0,0 @@
|
||||
#ifndef TREE_SITTER_PARSER_H_
|
||||
#define TREE_SITTER_PARSER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ts_builtin_sym_error ((TSSymbol)-1)
|
||||
#define ts_builtin_sym_end 0
|
||||
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
|
||||
|
||||
typedef uint16_t TSStateId;
|
||||
|
||||
#ifndef TREE_SITTER_API_H_
|
||||
typedef uint16_t TSSymbol;
|
||||
typedef uint16_t TSFieldId;
|
||||
typedef struct TSLanguage TSLanguage;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
TSFieldId field_id;
|
||||
uint8_t child_index;
|
||||
bool inherited;
|
||||
} TSFieldMapEntry;
|
||||
|
||||
typedef struct {
|
||||
uint16_t index;
|
||||
uint16_t length;
|
||||
} TSFieldMapSlice;
|
||||
|
||||
typedef struct {
|
||||
bool visible;
|
||||
bool named;
|
||||
bool supertype;
|
||||
} TSSymbolMetadata;
|
||||
|
||||
typedef struct TSLexer TSLexer;
|
||||
|
||||
struct TSLexer {
|
||||
int32_t lookahead;
|
||||
TSSymbol result_symbol;
|
||||
void (*advance)(TSLexer *, bool);
|
||||
void (*mark_end)(TSLexer *);
|
||||
uint32_t (*get_column)(TSLexer *);
|
||||
bool (*is_at_included_range_start)(const TSLexer *);
|
||||
bool (*eof)(const TSLexer *);
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
TSParseActionTypeShift,
|
||||
TSParseActionTypeReduce,
|
||||
TSParseActionTypeAccept,
|
||||
TSParseActionTypeRecover,
|
||||
} TSParseActionType;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
uint8_t type;
|
||||
TSStateId state;
|
||||
bool extra;
|
||||
bool repetition;
|
||||
} shift;
|
||||
struct {
|
||||
uint8_t type;
|
||||
uint8_t child_count;
|
||||
TSSymbol symbol;
|
||||
int16_t dynamic_precedence;
|
||||
uint16_t production_id;
|
||||
} reduce;
|
||||
uint8_t type;
|
||||
} TSParseAction;
|
||||
|
||||
typedef struct {
|
||||
uint16_t lex_state;
|
||||
uint16_t external_lex_state;
|
||||
} TSLexMode;
|
||||
|
||||
typedef union {
|
||||
TSParseAction action;
|
||||
struct {
|
||||
uint8_t count;
|
||||
bool reusable;
|
||||
} entry;
|
||||
} TSParseActionEntry;
|
||||
|
||||
struct TSLanguage {
|
||||
uint32_t version;
|
||||
uint32_t symbol_count;
|
||||
uint32_t alias_count;
|
||||
uint32_t token_count;
|
||||
uint32_t external_token_count;
|
||||
uint32_t state_count;
|
||||
uint32_t large_state_count;
|
||||
uint32_t production_id_count;
|
||||
uint32_t field_count;
|
||||
uint16_t max_alias_sequence_length;
|
||||
const uint16_t *parse_table;
|
||||
const uint16_t *small_parse_table;
|
||||
const uint32_t *small_parse_table_map;
|
||||
const TSParseActionEntry *parse_actions;
|
||||
const char * const *symbol_names;
|
||||
const char * const *field_names;
|
||||
const TSFieldMapSlice *field_map_slices;
|
||||
const TSFieldMapEntry *field_map_entries;
|
||||
const TSSymbolMetadata *symbol_metadata;
|
||||
const TSSymbol *public_symbol_map;
|
||||
const uint16_t *alias_map;
|
||||
const TSSymbol *alias_sequences;
|
||||
const TSLexMode *lex_modes;
|
||||
bool (*lex_fn)(TSLexer *, TSStateId);
|
||||
bool (*keyword_lex_fn)(TSLexer *, TSStateId);
|
||||
TSSymbol keyword_capture_token;
|
||||
struct {
|
||||
const bool *states;
|
||||
const TSSymbol *symbol_map;
|
||||
void *(*create)(void);
|
||||
void (*destroy)(void *);
|
||||
bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist);
|
||||
unsigned (*serialize)(void *, char *);
|
||||
void (*deserialize)(void *, const char *, unsigned);
|
||||
} external_scanner;
|
||||
const TSStateId *primary_state_ids;
|
||||
};
|
||||
|
||||
/*
|
||||
* Lexer Macros
|
||||
*/
|
||||
|
||||
#define START_LEXER() \
|
||||
bool result = false; \
|
||||
bool skip = false; \
|
||||
bool eof = false; \
|
||||
int32_t lookahead; \
|
||||
goto start; \
|
||||
next_state: \
|
||||
lexer->advance(lexer, skip); \
|
||||
start: \
|
||||
skip = false; \
|
||||
lookahead = lexer->lookahead;
|
||||
|
||||
#define ADVANCE(state_value) \
|
||||
{ \
|
||||
state = state_value; \
|
||||
goto next_state; \
|
||||
}
|
||||
|
||||
#define SKIP(state_value) \
|
||||
{ \
|
||||
skip = true; \
|
||||
state = state_value; \
|
||||
goto next_state; \
|
||||
}
|
||||
|
||||
#define ACCEPT_TOKEN(symbol_value) \
|
||||
result = true; \
|
||||
lexer->result_symbol = symbol_value; \
|
||||
lexer->mark_end(lexer);
|
||||
|
||||
#define END_STATE() return result;
|
||||
|
||||
/*
|
||||
* Parse Table Macros
|
||||
*/
|
||||
|
||||
#define SMALL_STATE(id) id - LARGE_STATE_COUNT
|
||||
|
||||
#define STATE(id) id
|
||||
|
||||
#define ACTIONS(id) id
|
||||
|
||||
#define SHIFT(state_value) \
|
||||
{{ \
|
||||
.shift = { \
|
||||
.type = TSParseActionTypeShift, \
|
||||
.state = state_value \
|
||||
} \
|
||||
}}
|
||||
|
||||
#define SHIFT_REPEAT(state_value) \
|
||||
{{ \
|
||||
.shift = { \
|
||||
.type = TSParseActionTypeShift, \
|
||||
.state = state_value, \
|
||||
.repetition = true \
|
||||
} \
|
||||
}}
|
||||
|
||||
#define SHIFT_EXTRA() \
|
||||
{{ \
|
||||
.shift = { \
|
||||
.type = TSParseActionTypeShift, \
|
||||
.extra = true \
|
||||
} \
|
||||
}}
|
||||
|
||||
#define REDUCE(symbol_val, child_count_val, ...) \
|
||||
{{ \
|
||||
.reduce = { \
|
||||
.type = TSParseActionTypeReduce, \
|
||||
.symbol = symbol_val, \
|
||||
.child_count = child_count_val, \
|
||||
__VA_ARGS__ \
|
||||
}, \
|
||||
}}
|
||||
|
||||
#define RECOVER() \
|
||||
{{ \
|
||||
.type = TSParseActionTypeRecover \
|
||||
}}
|
||||
|
||||
#define ACCEPT_INPUT() \
|
||||
{{ \
|
||||
.type = TSParseActionTypeAccept \
|
||||
}}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // TREE_SITTER_PARSER_H_
|
||||
@ -1,83 +0,0 @@
|
||||
================================================================================
|
||||
access types
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type A is access Integer;
|
||||
type B is access not null Integer;
|
||||
type C is access constant Integer;
|
||||
type D is access all Integer;
|
||||
type E is access function return Boolean;
|
||||
type F is access protected function return Boolean;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(access_to_object_definition
|
||||
(identifier)))
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(access_to_object_definition
|
||||
(null_exclusion)
|
||||
(identifier)))
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(access_to_object_definition
|
||||
(general_access_modifier)
|
||||
(identifier)))
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(access_to_object_definition
|
||||
(general_access_modifier)
|
||||
(identifier)))
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(access_to_subprogram_definition
|
||||
(result_profile
|
||||
(identifier))))
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(access_to_subprogram_definition
|
||||
(result_profile
|
||||
(identifier)))))))
|
||||
|
||||
================================================================================
|
||||
Dereference
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
A := Acc.all;
|
||||
Proc.all (1);
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(assignment_statement
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(selected_component
|
||||
(identifier)
|
||||
(identifier)))))
|
||||
(procedure_call_statement
|
||||
(selected_component
|
||||
(identifier)
|
||||
(identifier))
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))))))
|
||||
@ -1,289 +0,0 @@
|
||||
================================================================================
|
||||
Definite
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type A is array (1 .. 2) of Boolean;
|
||||
V : constant A := (1 => True, 2 => False);
|
||||
V2 : constant A := (1 => True, others => False);
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(array_type_definition
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(component_definition
|
||||
(identifier))))
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(named_array_aggregate
|
||||
(array_component_association
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(expression
|
||||
(term
|
||||
(identifier))))
|
||||
(array_component_association
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(expression
|
||||
(term
|
||||
(identifier))))))))
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(named_array_aggregate
|
||||
(array_component_association
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(expression
|
||||
(term
|
||||
(identifier))))
|
||||
(array_component_association
|
||||
(discrete_choice_list
|
||||
(discrete_choice))
|
||||
(expression
|
||||
(term
|
||||
(identifier))))))))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Definite-2
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type A is array (1 .. 3) of Boolean;
|
||||
V : constant A := (1, 2, 3);
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(array_type_definition
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(component_definition
|
||||
(identifier))))
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(positional_array_aggregate
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))))))
|
||||
|
||||
================================================================================
|
||||
Indefinite
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type B is array (Natural range <>) of Boolean;
|
||||
V : constant B := (1 .. 2 => False);
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(array_type_definition
|
||||
(index_subtype_definition
|
||||
(identifier))
|
||||
(component_definition
|
||||
(identifier))))
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(named_array_aggregate
|
||||
(array_component_association
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(expression
|
||||
(term
|
||||
(identifier))))))))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
2D
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type C is array (Natural range <>, Integer range <>) of Boolean;
|
||||
V : constant C := (1 .. 2 => (1 .. 2 => False));
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(array_type_definition
|
||||
(index_subtype_definition
|
||||
(identifier))
|
||||
(index_subtype_definition
|
||||
(identifier))
|
||||
(component_definition
|
||||
(identifier))))
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(named_array_aggregate
|
||||
(array_component_association
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(expression
|
||||
(term
|
||||
(named_array_aggregate
|
||||
(array_component_association
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(expression
|
||||
(term
|
||||
(identifier))))))))))))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Index in array aggregates
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
Arr := (for Index in 1 .. Count => Function_Returning_Limited (Index));
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(assignment_statement
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(named_array_aggregate
|
||||
(array_component_association
|
||||
(iterated_element_association
|
||||
(loop_parameter_specification
|
||||
(identifier)
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(identifier))))
|
||||
(expression
|
||||
(term
|
||||
(function_call
|
||||
(identifier)
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(expression
|
||||
(term
|
||||
(identifier))))))))))))))))))
|
||||
|
||||
================================================================================
|
||||
Slices
|
||||
================================================================================
|
||||
|
||||
Proc (Arr (1 .. 2));
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(procedure_call_statement
|
||||
(identifier)
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(expression
|
||||
(term
|
||||
(slice
|
||||
(identifier)
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))))))))))
|
||||
|
||||
================================================================================
|
||||
Slices with subtype declaration
|
||||
================================================================================
|
||||
|
||||
A : Arr (Boolean);
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(index_constraint
|
||||
(identifier)))))
|
||||
@ -1,113 +0,0 @@
|
||||
================================================================================
|
||||
Range attribute
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
A : MyArray (B'Range (1));
|
||||
begin
|
||||
for E in Arr'Range loop
|
||||
null;
|
||||
end loop;
|
||||
for E in Arr'Range (1) loop
|
||||
null;
|
||||
end loop;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(non_empty_declarative_part
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(slice
|
||||
(identifier)
|
||||
(range_g
|
||||
(identifier)
|
||||
(tick)
|
||||
(range_attribute_designator
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))))
|
||||
(handled_sequence_of_statements
|
||||
(loop_statement
|
||||
(iteration_scheme
|
||||
(loop_parameter_specification
|
||||
(identifier)
|
||||
(range_g
|
||||
(identifier)
|
||||
(tick)
|
||||
(range_attribute_designator))))
|
||||
(null_statement))
|
||||
(loop_statement
|
||||
(iteration_scheme
|
||||
(loop_parameter_specification
|
||||
(identifier)
|
||||
(range_g
|
||||
(identifier)
|
||||
(tick)
|
||||
(range_attribute_designator
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))))
|
||||
(null_statement))))))
|
||||
|
||||
================================================================================
|
||||
Reduction
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
X : Integer :=
|
||||
[parallel for Val of M when Val > 100.0 => (Val, 1)]
|
||||
'Reduce("+", 0);
|
||||
begin
|
||||
null;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(non_empty_declarative_part
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(value_sequence
|
||||
(iterated_element_association
|
||||
(iterator_specification
|
||||
(identifier)
|
||||
(identifier)
|
||||
(iterator_filter
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(expression
|
||||
(term
|
||||
(positional_array_aggregate
|
||||
(expression
|
||||
(term
|
||||
(identifier)))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))))
|
||||
(tick)
|
||||
(reduction_attribute_designator
|
||||
(identifier)
|
||||
(reduction_specification
|
||||
(string_literal)
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))))))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement)))))
|
||||
@ -1,92 +0,0 @@
|
||||
================================================================================
|
||||
generic package
|
||||
================================================================================
|
||||
|
||||
generic
|
||||
A : Integer := 1;
|
||||
type T (<>) is abstract tagged limited private or use My_Tagged;
|
||||
type I;
|
||||
with package Pro is new My_Pkg (F => 1, others => <>);
|
||||
with procedure Proc is null;
|
||||
with function Func return Boolean is <>;
|
||||
package P is
|
||||
pragma Compile_Time_Error (True, "an exception");
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(generic_package_declaration
|
||||
(generic_formal_part
|
||||
(formal_object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))
|
||||
(formal_complete_type_declaration
|
||||
(identifier)
|
||||
(unknown_discriminant_part)
|
||||
(formal_private_type_definition)
|
||||
(identifier))
|
||||
(formal_incomplete_type_declaration
|
||||
(identifier))
|
||||
(formal_package_declaration
|
||||
(identifier)
|
||||
(function_call
|
||||
(identifier)
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(component_choice_list
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))
|
||||
(parameter_association
|
||||
(component_choice_list)))))
|
||||
(formal_subprogram_declaration
|
||||
(formal_concrete_subprogram_declaration
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(subprogram_default)))
|
||||
(formal_subprogram_declaration
|
||||
(formal_concrete_subprogram_declaration
|
||||
(function_specification
|
||||
(identifier)
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(subprogram_default))))
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(pragma_g
|
||||
(identifier)
|
||||
(pragma_argument_association
|
||||
(expression
|
||||
(term
|
||||
(identifier))))
|
||||
(pragma_argument_association
|
||||
(expression
|
||||
(term
|
||||
(string_literal)))))))))
|
||||
|
||||
================================================================================
|
||||
formal derived types
|
||||
================================================================================
|
||||
|
||||
generic
|
||||
type T is new P with private;
|
||||
procedure A;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(generic_subprogram_declaration
|
||||
(generic_formal_part
|
||||
(formal_complete_type_declaration
|
||||
(identifier)
|
||||
(formal_derived_type_definition
|
||||
(identifier))))
|
||||
(procedure_specification
|
||||
(identifier)))))
|
||||
@ -1,67 +0,0 @@
|
||||
================================================================================
|
||||
String literals
|
||||
================================================================================
|
||||
|
||||
A : String := "12'34";
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(string_literal))))))
|
||||
|
||||
================================================================================
|
||||
String literals with quotes
|
||||
================================================================================
|
||||
|
||||
A : String := "12""23";
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(string_literal))))))
|
||||
|
||||
================================================================================
|
||||
Numeric literals with underscore
|
||||
================================================================================
|
||||
|
||||
A : Integer := 12_14.12_122E+11_2;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))
|
||||
|
||||
=======================
|
||||
Based numerals
|
||||
=======================
|
||||
|
||||
A : Integer := 16#FA01#E+02;
|
||||
|
||||
-----
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))
|
||||
@ -1,193 +0,0 @@
|
||||
================================================================================
|
||||
with clauses
|
||||
================================================================================
|
||||
|
||||
with Ada.Text_IO, System; -- multiple names, and fully qualified
|
||||
limited with Ada; -- limited with
|
||||
private with Ada;
|
||||
limited private with Ada;
|
||||
use Ada.Text_IO, System;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(with_clause
|
||||
(selected_component
|
||||
(identifier)
|
||||
(identifier))
|
||||
(identifier)))
|
||||
(comment)
|
||||
(compilation_unit
|
||||
(with_clause
|
||||
(identifier)))
|
||||
(comment)
|
||||
(compilation_unit
|
||||
(with_clause
|
||||
(identifier)))
|
||||
(compilation_unit
|
||||
(with_clause
|
||||
(identifier)))
|
||||
(compilation_unit
|
||||
(use_clause
|
||||
(selected_component
|
||||
(identifier)
|
||||
(identifier))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Case insensitive
|
||||
================================================================================
|
||||
|
||||
PACkaGe P1 Is
|
||||
enD;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
multiple compilation units
|
||||
================================================================================
|
||||
|
||||
package P1 is
|
||||
package Nested is
|
||||
end Nested;
|
||||
end P1;
|
||||
|
||||
private package Child.P2 is -- comment to be ignored
|
||||
private
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(identifier))
|
||||
(identifier)))
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(selected_component
|
||||
(identifier)
|
||||
(identifier))
|
||||
(comment))))
|
||||
|
||||
================================================================================
|
||||
body
|
||||
================================================================================
|
||||
|
||||
package body Child.P2 is
|
||||
package body Nested is
|
||||
begin
|
||||
null;
|
||||
end Nested;
|
||||
begin
|
||||
null;
|
||||
end Child.P2;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_body
|
||||
(selected_component
|
||||
(identifier)
|
||||
(identifier))
|
||||
(non_empty_declarative_part
|
||||
(package_body
|
||||
(identifier)
|
||||
(handled_sequence_of_statements
|
||||
(null_statement))
|
||||
(identifier)))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement))
|
||||
(selected_component
|
||||
(identifier)
|
||||
(identifier)))))
|
||||
|
||||
================================================================================
|
||||
separate
|
||||
================================================================================
|
||||
|
||||
separate (Child) package body P2 is
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subunit
|
||||
(identifier)
|
||||
(package_body
|
||||
(identifier)))))
|
||||
|
||||
================================================================================
|
||||
private types
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type A is private;
|
||||
type B is abstract synchronized new C with private;
|
||||
type C is abstract tagged limited private with Size => 8;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(private_type_declaration
|
||||
(identifier))
|
||||
(private_extension_declaration
|
||||
(identifier)
|
||||
(identifier))
|
||||
(private_type_declaration
|
||||
(identifier)
|
||||
(aspect_specification
|
||||
(aspect_mark_list
|
||||
(aspect_association
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))))))
|
||||
|
||||
================================================================================
|
||||
incomplete types
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
private
|
||||
type I;
|
||||
type R (A : Integer);
|
||||
type R2 (<>);
|
||||
type T is tagged;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(incomplete_type_declaration
|
||||
(identifier))
|
||||
(incomplete_type_declaration
|
||||
(identifier)
|
||||
(known_discriminant_part
|
||||
(discriminant_specification_list
|
||||
(discriminant_specification
|
||||
(identifier)
|
||||
(identifier)))))
|
||||
(incomplete_type_declaration
|
||||
(identifier)
|
||||
(unknown_discriminant_part))
|
||||
(incomplete_type_declaration
|
||||
(identifier)))))
|
||||
@ -1,90 +0,0 @@
|
||||
================================================================================
|
||||
pragma on record field
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type R is record
|
||||
Started : Boolean := False;
|
||||
pragma Atomic (Started);
|
||||
end record;
|
||||
pragma Foo;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(record_type_definition
|
||||
(record_definition
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(identifier))))
|
||||
(pragma_g
|
||||
(identifier)
|
||||
(pragma_argument_association
|
||||
(expression
|
||||
(term
|
||||
(identifier)))))))))
|
||||
(pragma_g
|
||||
(identifier)))))
|
||||
|
||||
================================================================================
|
||||
pragma in statement
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
null;
|
||||
pragma Foo;
|
||||
null;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement)
|
||||
(pragma_g
|
||||
(identifier))
|
||||
(null_statement)))))
|
||||
|
||||
================================================================================
|
||||
pragma in tasks
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
task type T is
|
||||
pragma Storage_Size (1024);
|
||||
end T;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(task_type_declaration
|
||||
(identifier)
|
||||
(task_definition
|
||||
(pragma_g
|
||||
(identifier)
|
||||
(pragma_argument_association
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(identifier)))))))
|
||||
@ -1,83 +0,0 @@
|
||||
================================================================================
|
||||
Preprocess-if (GNAT)
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
#if not CHECKING_MODE then
|
||||
pragma Suppress (Access_Checks);
|
||||
#end if;
|
||||
begin
|
||||
null;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(non_empty_declarative_part
|
||||
(gnatprep_declarative_if_statement
|
||||
(expression
|
||||
(term
|
||||
(factor_not
|
||||
(identifier))))
|
||||
(pragma_g
|
||||
(identifier)
|
||||
(pragma_argument_association
|
||||
(expression
|
||||
(term
|
||||
(identifier)))))))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement)))))
|
||||
|
||||
================================================================================
|
||||
Preprocess substitution (GNAT)
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
Flavour : constant F := $FLAVOR;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(gnatprep_identifier)))))))
|
||||
|
||||
================================================================================
|
||||
Preprocess empty (GNAT)
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
#if not CHECKING_MODE then
|
||||
-- pragma Suppress (Access_Checks);
|
||||
#end if;
|
||||
begin
|
||||
null;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(non_empty_declarative_part
|
||||
(gnatprep_declarative_if_statement
|
||||
(expression
|
||||
(term
|
||||
(factor_not
|
||||
(identifier))))
|
||||
(comment)))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement)))))
|
||||
@ -1,110 +0,0 @@
|
||||
================================================================================
|
||||
protected objects
|
||||
================================================================================
|
||||
|
||||
package body P is
|
||||
protected Obj is
|
||||
procedure Proc;
|
||||
function Func return Boolean;
|
||||
entry E;
|
||||
entry E2 (Color)(A : Integer);
|
||||
private
|
||||
Field : Integer;
|
||||
end Obj;
|
||||
|
||||
protected body Obj is
|
||||
procedure Proc is begin abort T; end;
|
||||
function Func return Boolean is begin return False; end;
|
||||
entry E when Field > 0 is
|
||||
begin
|
||||
requeue E with abort;
|
||||
end E;
|
||||
entry E2 (for C in Color)(A : Integer) when True is
|
||||
begin
|
||||
null;
|
||||
end E2;
|
||||
end Obj;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_body
|
||||
(identifier)
|
||||
(non_empty_declarative_part
|
||||
(object_declaration
|
||||
(single_protected_declaration
|
||||
(identifier)
|
||||
(protected_definition
|
||||
(subprogram_declaration
|
||||
(procedure_specification
|
||||
(identifier)))
|
||||
(subprogram_declaration
|
||||
(function_specification
|
||||
(identifier)
|
||||
(result_profile
|
||||
(identifier))))
|
||||
(entry_declaration
|
||||
(identifier))
|
||||
(entry_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier)))
|
||||
(identifier))))
|
||||
(protected_body
|
||||
(identifier)
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(abort_statement
|
||||
(identifier))))
|
||||
(subprogram_body
|
||||
(function_specification
|
||||
(identifier)
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(handled_sequence_of_statements
|
||||
(simple_return_statement
|
||||
(expression
|
||||
(term
|
||||
(identifier))))))
|
||||
(entry_body
|
||||
(identifier)
|
||||
(entry_barrier
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(numeric_literal))))
|
||||
(handled_sequence_of_statements
|
||||
(requeue_statement
|
||||
(identifier)))
|
||||
(identifier))
|
||||
(entry_body
|
||||
(identifier)
|
||||
(non_empty_entry_body_formal_part
|
||||
(entry_index_specification
|
||||
(identifier)
|
||||
(identifier))
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(entry_barrier
|
||||
(expression
|
||||
(term
|
||||
(identifier))))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement))
|
||||
(identifier))
|
||||
(identifier))))))
|
||||
@ -1,565 +0,0 @@
|
||||
================================================================================
|
||||
null record
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type R is null record;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(record_type_definition
|
||||
(record_definition))))))
|
||||
|
||||
================================================================================
|
||||
records
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type R2 is record
|
||||
A : aliased Integer;
|
||||
B : Integer range 0 .. 2;
|
||||
C, D : not null access Integer;
|
||||
end record;
|
||||
|
||||
for R2 use record
|
||||
A at 0 range 0 .. 31;
|
||||
end record;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(record_type_definition
|
||||
(record_definition
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier)))
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier)
|
||||
(range_constraint
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal))))))
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(component_definition
|
||||
(access_definition
|
||||
(null_exclusion)
|
||||
(identifier))))))))
|
||||
(record_representation_clause
|
||||
(identifier)
|
||||
(component_clause
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))))))
|
||||
|
||||
================================================================================
|
||||
Multiple fields on one line
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type R is record
|
||||
A, B : Integer;
|
||||
end record;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(record_type_definition
|
||||
(record_definition
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier))))))))))
|
||||
|
||||
================================================================================
|
||||
Discriminated
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type R (A : Integer; B : Integer) is record
|
||||
F : Float;
|
||||
end record;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(known_discriminant_part
|
||||
(discriminant_specification_list
|
||||
(discriminant_specification
|
||||
(identifier)
|
||||
(identifier))
|
||||
(discriminant_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(record_type_definition
|
||||
(record_definition
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier))))))))))
|
||||
|
||||
================================================================================
|
||||
tagged
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type T is abstract tagged limited null record;
|
||||
type T2 is new T with record
|
||||
F : Integer;
|
||||
end record;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(record_type_definition
|
||||
(record_definition)))
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(derived_type_definition
|
||||
(identifier)
|
||||
(record_extension_part
|
||||
(record_definition
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier)))))))))))
|
||||
|
||||
================================================================================
|
||||
Variant
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type R (A : Integer) is record
|
||||
case A is
|
||||
when 0 | 1 .. 2 =>
|
||||
B : Integer;
|
||||
when others =>
|
||||
null;
|
||||
end case;
|
||||
end record;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(known_discriminant_part
|
||||
(discriminant_specification_list
|
||||
(discriminant_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(record_type_definition
|
||||
(record_definition
|
||||
(component_list
|
||||
(variant_part
|
||||
(identifier)
|
||||
(variant_list
|
||||
(variant
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))
|
||||
(discrete_choice
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier)))))
|
||||
(variant
|
||||
(discrete_choice_list
|
||||
(discrete_choice))
|
||||
(component_list)))))))))))
|
||||
|
||||
================================================================================
|
||||
interface
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type R is interface;
|
||||
type R2 is interface and Intf1;
|
||||
type R3 is new Root and R with null record;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(interface_type_definition))
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(interface_type_definition
|
||||
(identifier)))
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(derived_type_definition
|
||||
(identifier)
|
||||
(identifier)
|
||||
(record_extension_part
|
||||
(record_definition)))))))
|
||||
|
||||
================================================================================
|
||||
record aggregates
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
A := (F1 => 1, F2 => 2);
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(assignment_statement
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(record_aggregate
|
||||
(record_component_association_list
|
||||
(component_choice_list
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(component_choice_list
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))))))))
|
||||
|
||||
================================================================================
|
||||
record aggregate extension
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
A := (B with F3 => 2);
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(assignment_statement
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(extension_aggregate
|
||||
(expression
|
||||
(term
|
||||
(identifier)))
|
||||
(record_component_association_list
|
||||
(component_choice_list
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))))))))
|
||||
|
||||
================================================================================
|
||||
record delta aggregate
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
A := (B with delta F3 => 2);
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(assignment_statement
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(record_delta_aggregate
|
||||
(expression
|
||||
(term
|
||||
(identifier)))
|
||||
(record_component_association_list
|
||||
(component_choice_list
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))))))))
|
||||
|
||||
================================================================================
|
||||
Variant records
|
||||
================================================================================
|
||||
|
||||
type R (D : Boolean) is record
|
||||
A : Integer;
|
||||
case D is
|
||||
when True => null;
|
||||
when False =>
|
||||
B : Integer := 1;
|
||||
-- some comment
|
||||
end case;
|
||||
end record;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(known_discriminant_part
|
||||
(discriminant_specification_list
|
||||
(discriminant_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(record_type_definition
|
||||
(record_definition
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier)))
|
||||
(variant_part
|
||||
(identifier)
|
||||
(variant_list
|
||||
(variant
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(identifier)))
|
||||
(component_list))
|
||||
(variant
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(identifier)))
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))))
|
||||
(comment))))))))
|
||||
|
||||
================================================================================
|
||||
variants 2
|
||||
================================================================================
|
||||
|
||||
type R (S : Config_Side) is record
|
||||
E : Duration;
|
||||
F : Duration;
|
||||
|
||||
case Side is
|
||||
when Config_Consumer =>
|
||||
C : Duration;
|
||||
end case;
|
||||
end record;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(known_discriminant_part
|
||||
(discriminant_specification_list
|
||||
(discriminant_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(record_type_definition
|
||||
(record_definition
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier)))
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier)))
|
||||
(variant_part
|
||||
(identifier)
|
||||
(variant_list
|
||||
(variant
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(identifier)))
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier)))))))))))))
|
||||
|
||||
================================================================================
|
||||
Extension with aggregate
|
||||
================================================================================
|
||||
|
||||
procedure Proc is
|
||||
Null : constant Rec := (Parent with A => null);
|
||||
Null2 : constant Rec := (Parent with null);
|
||||
begin
|
||||
null;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(non_empty_declarative_part
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(extension_aggregate
|
||||
(expression
|
||||
(term
|
||||
(identifier)))
|
||||
(record_component_association_list
|
||||
(component_choice_list
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(primary_null))))))))
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(extension_aggregate
|
||||
(expression
|
||||
(term
|
||||
(identifier)))
|
||||
(expression
|
||||
(term
|
||||
(primary_null))))))))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement)))))
|
||||
|
||||
================================================================================
|
||||
Record with discr
|
||||
================================================================================
|
||||
|
||||
procedure Proc is
|
||||
type Rec (Len : Natural) is null record;
|
||||
R : Rec (0);
|
||||
R2 : Rec (if N > 0 then 1 else 0);
|
||||
begin
|
||||
null;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(non_empty_declarative_part
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(known_discriminant_part
|
||||
(discriminant_specification_list
|
||||
(discriminant_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(record_type_definition
|
||||
(record_definition)))
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(discriminant_constraint
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(discriminant_constraint
|
||||
(if_expression
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement)))))
|
||||
@ -1,52 +0,0 @@
|
||||
================================================================================
|
||||
Renames object
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
Threshold renames With_Type_Inference;
|
||||
A : Integer renames B;
|
||||
CE : exception renames Constraint_Error;
|
||||
package TIO renames Ada.Text_IO;
|
||||
procedure Proc (A : Integer) renames Process;
|
||||
generic procedure Proc renames Generic_Process;
|
||||
begin
|
||||
null;
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(non_empty_declarative_part
|
||||
(object_renaming_declaration
|
||||
(identifier)
|
||||
(identifier))
|
||||
(object_renaming_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(identifier))
|
||||
(exception_renaming_declaration
|
||||
(identifier)
|
||||
(identifier))
|
||||
(package_renaming_declaration
|
||||
(identifier)
|
||||
(selected_component
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(subprogram_renaming_declaration
|
||||
(procedure_specification
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(identifier))
|
||||
(generic_renaming_declaration
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement))
|
||||
(identifier))))
|
||||
@ -1,95 +0,0 @@
|
||||
================================================================================
|
||||
Separate subprograms
|
||||
================================================================================
|
||||
|
||||
package body P is
|
||||
overriding procedure Proc is separate with Inline;
|
||||
overriding function Func return Boolean is separate with Inline;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_body
|
||||
(identifier)
|
||||
(non_empty_declarative_part
|
||||
(body_stub
|
||||
(subprogram_body_stub
|
||||
(overriding_indicator)
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(aspect_specification
|
||||
(aspect_mark_list
|
||||
(aspect_association
|
||||
(identifier))))))
|
||||
(body_stub
|
||||
(subprogram_body_stub
|
||||
(overriding_indicator)
|
||||
(function_specification
|
||||
(identifier)
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(aspect_specification
|
||||
(aspect_mark_list
|
||||
(aspect_association
|
||||
(identifier))))))))))
|
||||
|
||||
================================================================================
|
||||
Separate packages
|
||||
================================================================================
|
||||
|
||||
package body P is
|
||||
package body Child is separate;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_body
|
||||
(identifier)
|
||||
(non_empty_declarative_part
|
||||
(body_stub
|
||||
(package_body_stub
|
||||
(identifier)))))))
|
||||
|
||||
================================================================================
|
||||
Separate protected
|
||||
================================================================================
|
||||
|
||||
package body P is
|
||||
protected body Prot is separate;
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_body
|
||||
(identifier)
|
||||
(non_empty_declarative_part
|
||||
(body_stub
|
||||
(protected_body_stub
|
||||
(identifier))))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Separate task
|
||||
================================================================================
|
||||
|
||||
package body P is
|
||||
task body T is separate;
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_body
|
||||
(identifier)
|
||||
(non_empty_declarative_part
|
||||
(body_stub
|
||||
(task_body_stub
|
||||
(identifier))))
|
||||
(identifier))))
|
||||
@ -1,643 +0,0 @@
|
||||
================================================================================
|
||||
Untyped Constant
|
||||
================================================================================
|
||||
|
||||
A : constant := 111;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(number_declaration
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))
|
||||
|
||||
================================================================================
|
||||
Factors
|
||||
================================================================================
|
||||
|
||||
A : constant Integer := 2 + 8 * 3;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))
|
||||
(binary_adding_operator)
|
||||
(term
|
||||
(numeric_literal)
|
||||
(multiplying_operator)
|
||||
(numeric_literal))))))
|
||||
|
||||
================================================================================
|
||||
While
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
while True loop
|
||||
exit;
|
||||
exit when A > 0;
|
||||
end loop;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(loop_statement
|
||||
(iteration_scheme
|
||||
(expression
|
||||
(term
|
||||
(identifier))))
|
||||
(exit_statement)
|
||||
(exit_statement
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(numeric_literal)))))))))
|
||||
|
||||
================================================================================
|
||||
For loops
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
for E in Pkg.Arr'Range loop
|
||||
goto end_loop;
|
||||
|
||||
<<end_loop>>
|
||||
end loop;
|
||||
|
||||
for E of reverse Arr loop
|
||||
delay 1.0;
|
||||
end loop;
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(loop_statement
|
||||
(iteration_scheme
|
||||
(loop_parameter_specification
|
||||
(identifier)
|
||||
(range_g
|
||||
(selected_component
|
||||
(identifier)
|
||||
(identifier))
|
||||
(tick)
|
||||
(range_attribute_designator))))
|
||||
(goto_statement
|
||||
(identifier))
|
||||
(label
|
||||
(identifier)))
|
||||
(loop_statement
|
||||
(iteration_scheme
|
||||
(iterator_specification
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(delay_relative_statement
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Named loop
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
Main:
|
||||
loop
|
||||
exit Main;
|
||||
end loop Main;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(loop_statement
|
||||
(loop_label
|
||||
(identifier))
|
||||
(exit_statement
|
||||
(identifier))
|
||||
(identifier))))))
|
||||
|
||||
================================================================================
|
||||
Return
|
||||
================================================================================
|
||||
|
||||
function F return Boolean is
|
||||
begin
|
||||
return True;
|
||||
return A : My_Rec := (F => 1) do
|
||||
null;
|
||||
end return;
|
||||
end F;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(function_specification
|
||||
(identifier)
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(handled_sequence_of_statements
|
||||
(simple_return_statement
|
||||
(expression
|
||||
(term
|
||||
(identifier))))
|
||||
(extended_return_statement
|
||||
(extended_return_object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(record_aggregate
|
||||
(record_component_association_list
|
||||
(component_choice_list
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement))))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Procedure call
|
||||
================================================================================
|
||||
|
||||
procedure P (A : Integer) is
|
||||
begin
|
||||
P2 (1, False);
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(handled_sequence_of_statements
|
||||
(procedure_call_statement
|
||||
(identifier)
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))
|
||||
(parameter_association
|
||||
(expression
|
||||
(term
|
||||
(identifier)))))))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Raise exception
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
raise Constraint_Error;
|
||||
raise Constraint_Error with "msg";
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(raise_statement
|
||||
(identifier))
|
||||
(raise_statement
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(string_literal))))))))
|
||||
|
||||
================================================================================
|
||||
Function calls
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
A : Integer;
|
||||
begin
|
||||
A := Func (B => 1);
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(non_empty_declarative_part
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(handled_sequence_of_statements
|
||||
(assignment_statement
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(function_call
|
||||
(identifier)
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(component_choice_list
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))))))))))
|
||||
|
||||
================================================================================
|
||||
if statement
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
if A = 0 or else B = 1 then
|
||||
declare
|
||||
begin
|
||||
null;
|
||||
end;
|
||||
elsif A = 1 then
|
||||
declare
|
||||
C : Integer;
|
||||
begin
|
||||
null;
|
||||
exception
|
||||
when Constraint_Error => null;
|
||||
end;
|
||||
else
|
||||
begin
|
||||
null;
|
||||
end;
|
||||
end if;
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(if_statement
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(block_statement
|
||||
(handled_sequence_of_statements
|
||||
(null_statement)))
|
||||
(elsif_statement_item
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(block_statement
|
||||
(non_empty_declarative_part
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement)
|
||||
(exception_handler
|
||||
(exception_choice_list
|
||||
(exception_choice
|
||||
(identifier)))
|
||||
(null_statement)))))
|
||||
(block_statement
|
||||
(handled_sequence_of_statements
|
||||
(null_statement)))))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Case statement
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
case Func(A => 1) is
|
||||
when '1' .. '2' =>
|
||||
null;
|
||||
when '3' | '4' =>
|
||||
null;
|
||||
end case;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(case_statement
|
||||
(expression
|
||||
(term
|
||||
(function_call
|
||||
(identifier)
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(component_choice_list
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))))
|
||||
(case_statement_alternative
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(range_g
|
||||
(term
|
||||
(character_literal))
|
||||
(term
|
||||
(character_literal)))))
|
||||
(null_statement))
|
||||
(case_statement_alternative
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(character_literal))
|
||||
(discrete_choice
|
||||
(character_literal)))
|
||||
(null_statement)))))))
|
||||
|
||||
================================================================================
|
||||
Allocators
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
A := new T;
|
||||
A := new (pkg.pool) T'((F => 1));
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(assignment_statement
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(allocator
|
||||
(identifier)))))
|
||||
(assignment_statement
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(allocator
|
||||
(subpool_specification
|
||||
(selected_component
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(qualified_expression
|
||||
(identifier)
|
||||
(tick)
|
||||
(expression
|
||||
(term
|
||||
(record_aggregate
|
||||
(record_component_association_list
|
||||
(component_choice_list
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))))))))))))
|
||||
|
||||
================================================================================
|
||||
Filtered for loops
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
for E of Some_Array when E /= 0 loop
|
||||
null;
|
||||
end loop;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(loop_statement
|
||||
(iteration_scheme
|
||||
(iterator_specification
|
||||
(identifier)
|
||||
(identifier)
|
||||
(iterator_filter
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(numeric_literal))))))
|
||||
(null_statement))))))
|
||||
|
||||
================================================================================
|
||||
Assignment target name
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
Some_Very_Long.And_Complex (Expression) := @ + 1;
|
||||
Another_Very_Long.And_Complex (Expression) := Function_Call (@);
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(assignment_statement
|
||||
(function_call
|
||||
(selected_component
|
||||
(identifier)
|
||||
(identifier))
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(expression
|
||||
(term
|
||||
(identifier))))))
|
||||
(expression
|
||||
(term
|
||||
(target_name))
|
||||
(binary_adding_operator)
|
||||
(term
|
||||
(numeric_literal))))
|
||||
(assignment_statement
|
||||
(function_call
|
||||
(selected_component
|
||||
(identifier)
|
||||
(identifier))
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(expression
|
||||
(term
|
||||
(identifier))))))
|
||||
(expression
|
||||
(term
|
||||
(function_call
|
||||
(identifier)
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(expression
|
||||
(term
|
||||
(target_name)))))))))))))
|
||||
|
||||
================================================================================
|
||||
if-expressions
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
S := new String'((if N /= "" then N else "12"));
|
||||
S := new String'(if N /= "" then N else "12");
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(assignment_statement
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(allocator
|
||||
(qualified_expression
|
||||
(identifier)
|
||||
(tick)
|
||||
(expression
|
||||
(term
|
||||
(if_expression
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(string_literal)))
|
||||
(expression
|
||||
(term
|
||||
(identifier)))
|
||||
(expression
|
||||
(term
|
||||
(string_literal)))))))))))
|
||||
(assignment_statement
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(allocator
|
||||
(qualified_expression
|
||||
(identifier)
|
||||
(tick)
|
||||
(if_expression
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(string_literal)))
|
||||
(expression
|
||||
(term
|
||||
(identifier)))
|
||||
(expression
|
||||
(term
|
||||
(string_literal)))))))))))))
|
||||
|
||||
================================================================================
|
||||
Re-raise
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
null;
|
||||
exception
|
||||
when others =>
|
||||
Proc;
|
||||
pragma Assert (True);
|
||||
raise;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement)
|
||||
(exception_handler
|
||||
(exception_choice_list
|
||||
(exception_choice))
|
||||
(procedure_call_statement
|
||||
(identifier))
|
||||
(pragma_g
|
||||
(identifier)
|
||||
(pragma_argument_association
|
||||
(expression
|
||||
(term
|
||||
(identifier)))))
|
||||
(raise_statement))))))
|
||||
@ -1,603 +0,0 @@
|
||||
================================================================================
|
||||
null procedure
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
procedure A is null;
|
||||
overriding procedure B is null;
|
||||
procedure B is null with Inline;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(null_procedure_declaration
|
||||
(procedure_specification
|
||||
(identifier)))
|
||||
(null_procedure_declaration
|
||||
(overriding_indicator)
|
||||
(procedure_specification
|
||||
(identifier)))
|
||||
(null_procedure_declaration
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(aspect_specification
|
||||
(aspect_mark_list
|
||||
(aspect_association
|
||||
(identifier))))))))
|
||||
|
||||
================================================================================
|
||||
procedures
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
procedure A (P1, P2 : Integer; P3 : Float)
|
||||
with Inline;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(subprogram_declaration
|
||||
(procedure_specification
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier)
|
||||
(identifier))
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(aspect_specification
|
||||
(aspect_mark_list
|
||||
(aspect_association
|
||||
(identifier))))))))
|
||||
|
||||
================================================================================
|
||||
abstract procedures
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
procedure B is abstract;
|
||||
overriding procedure C is abstract with Inline;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(subprogram_declaration
|
||||
(procedure_specification
|
||||
(identifier)))
|
||||
(subprogram_declaration
|
||||
(overriding_indicator)
|
||||
(procedure_specification
|
||||
(identifier))
|
||||
(aspect_specification
|
||||
(aspect_mark_list
|
||||
(aspect_association
|
||||
(identifier))))))))
|
||||
|
||||
================================================================================
|
||||
functions
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
function F (A, B : Integer) return not null access Integer
|
||||
with Inline, Convention => C;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(subprogram_declaration
|
||||
(function_specification
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(result_profile
|
||||
(access_definition
|
||||
(null_exclusion)
|
||||
(identifier))))
|
||||
(aspect_specification
|
||||
(aspect_mark_list
|
||||
(aspect_association
|
||||
(identifier))
|
||||
(aspect_association
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(identifier))))))))))
|
||||
|
||||
================================================================================
|
||||
subprogram body
|
||||
================================================================================
|
||||
|
||||
package body P is
|
||||
procedure A (B : Integer) is
|
||||
V : Integer;
|
||||
begin
|
||||
null;
|
||||
end A;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_body
|
||||
(identifier)
|
||||
(non_empty_declarative_part
|
||||
(subprogram_body
|
||||
(procedure_specification
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(non_empty_declarative_part
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement))
|
||||
(identifier))))))
|
||||
|
||||
================================================================================
|
||||
Expression function membership
|
||||
================================================================================
|
||||
|
||||
function F2 (A : Integer) return Boolean
|
||||
is (A not in Small_Integer);
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(expression_function_declaration
|
||||
(function_specification
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(expression
|
||||
(relation_membership
|
||||
(term
|
||||
(identifier))
|
||||
(membership_choice_list
|
||||
(term
|
||||
(identifier))))))))
|
||||
|
||||
================================================================================
|
||||
Expression function declare
|
||||
================================================================================
|
||||
|
||||
function F2 (A : Integer) return Boolean
|
||||
is (declare B : constant Integer := A + 1; begin B);
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(expression_function_declaration
|
||||
(function_specification
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(declare_expression
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(binary_adding_operator)
|
||||
(term
|
||||
(numeric_literal))))
|
||||
(expression
|
||||
(term
|
||||
(identifier)))))))
|
||||
|
||||
================================================================================
|
||||
Expression function raise
|
||||
================================================================================
|
||||
|
||||
function F3 return Boolean
|
||||
is (raise Constraint_Error);
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(expression_function_declaration
|
||||
(function_specification
|
||||
(identifier)
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(expression
|
||||
(raise_expression
|
||||
(identifier))))))
|
||||
|
||||
================================================================================
|
||||
Expression function simple
|
||||
================================================================================
|
||||
|
||||
function F4 return Boolean is (True);
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(expression_function_declaration
|
||||
(function_specification
|
||||
(identifier)
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(expression
|
||||
(term
|
||||
(identifier))))))
|
||||
|
||||
================================================================================
|
||||
Expression function if
|
||||
================================================================================
|
||||
|
||||
function F (A : Integer) return Boolean
|
||||
is (if A = 0 or A = 1 then True else False);
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(expression_function_declaration
|
||||
(function_specification
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(if_expression
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(expression
|
||||
(term
|
||||
(identifier)))
|
||||
(expression
|
||||
(term
|
||||
(identifier)))))))
|
||||
|
||||
================================================================================
|
||||
Expression function if extra parenthesis
|
||||
================================================================================
|
||||
|
||||
function F5 (A : Integer) return Boolean
|
||||
is ((if A = 0 then True else False));
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(expression_function_declaration
|
||||
(function_specification
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(expression
|
||||
(term
|
||||
(if_expression
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(expression
|
||||
(term
|
||||
(identifier)))
|
||||
(expression
|
||||
(term
|
||||
(identifier)))))))))
|
||||
|
||||
================================================================================
|
||||
Expression function case
|
||||
================================================================================
|
||||
|
||||
function F (A : Integer) return Boolean
|
||||
is (case A + 1 is
|
||||
when 0 .. 1 | 3 .. 4 => True,
|
||||
when others => False);
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(expression_function_declaration
|
||||
(function_specification
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(case_expression
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(binary_adding_operator)
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(case_expression_alternative
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal))))
|
||||
(discrete_choice
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(expression
|
||||
(term
|
||||
(identifier))))
|
||||
(case_expression_alternative
|
||||
(discrete_choice_list
|
||||
(discrete_choice))
|
||||
(expression
|
||||
(term
|
||||
(identifier))))))))
|
||||
|
||||
================================================================================
|
||||
Expression function array
|
||||
================================================================================
|
||||
|
||||
function F return My_Array is (1 .. 2 => True);
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(expression_function_declaration
|
||||
(function_specification
|
||||
(identifier)
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(named_array_aggregate
|
||||
(array_component_association
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(expression
|
||||
(term
|
||||
(identifier))))))))
|
||||
|
||||
================================================================================
|
||||
Expression function quantified
|
||||
================================================================================
|
||||
|
||||
function F (A : My_Array) return Boolean
|
||||
is (for some E of A => E = 1);
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(expression_function_declaration
|
||||
(function_specification
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(quantified_expression
|
||||
(quantifier)
|
||||
(iterator_specification
|
||||
(identifier)
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(identifier))
|
||||
(relational_operator)
|
||||
(term
|
||||
(numeric_literal)))))))
|
||||
|
||||
================================================================================
|
||||
Operators
|
||||
================================================================================
|
||||
|
||||
overriding function "<" (Left, Right : My_Int) return Boolean is
|
||||
begin
|
||||
return False;
|
||||
end "<";
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_body
|
||||
(overriding_indicator)
|
||||
(function_specification
|
||||
(string_literal)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(handled_sequence_of_statements
|
||||
(simple_return_statement
|
||||
(expression
|
||||
(term
|
||||
(identifier)))))
|
||||
(string_literal))))
|
||||
|
||||
================================================================================
|
||||
Access Parameters
|
||||
================================================================================
|
||||
|
||||
procedure Proc (A : access Integer);
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_declaration
|
||||
(procedure_specification
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(access_definition
|
||||
(identifier))))))))
|
||||
|
||||
================================================================================
|
||||
Subprogram and field access
|
||||
================================================================================
|
||||
|
||||
V := Func (2).Value;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(assignment_statement
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(selected_component
|
||||
(function_call
|
||||
(identifier)
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))
|
||||
(identifier)))))))
|
||||
|
||||
================================================================================
|
||||
Parameterless Procedure call
|
||||
================================================================================
|
||||
|
||||
Proc;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(procedure_call_statement
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Parameterless Function call
|
||||
================================================================================
|
||||
|
||||
A := Func;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(assignment_statement
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(identifier))))))
|
||||
|
||||
================================================================================
|
||||
Parameter association for operators
|
||||
================================================================================
|
||||
|
||||
package P is new Pack ("+" => "+", "-" => Imported."+");
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(generic_instantiation
|
||||
(identifier)
|
||||
(function_call
|
||||
(identifier)
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(component_choice_list
|
||||
(string_literal))
|
||||
(expression
|
||||
(term
|
||||
(string_literal))))
|
||||
(parameter_association
|
||||
(component_choice_list
|
||||
(string_literal))
|
||||
(expression
|
||||
(term
|
||||
(selected_component
|
||||
(identifier)
|
||||
(string_literal))))))))))
|
||||
|
||||
================================================================================
|
||||
Function renaming
|
||||
================================================================================
|
||||
|
||||
function F (S : String) return Boolean renames F2;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(subprogram_renaming_declaration
|
||||
(function_specification
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(result_profile
|
||||
(identifier)))
|
||||
(identifier))))
|
||||
@ -1,294 +0,0 @@
|
||||
================================================================================
|
||||
tasks
|
||||
================================================================================
|
||||
|
||||
package body P is
|
||||
task T is
|
||||
entry E (A : Integer);
|
||||
private
|
||||
entry E2;
|
||||
end T;
|
||||
|
||||
task body T is
|
||||
A : Integer;
|
||||
begin
|
||||
accept E (A : Integer) do
|
||||
null;
|
||||
end E;
|
||||
|
||||
select
|
||||
Call (1);
|
||||
or
|
||||
delay 1.0;
|
||||
end select;
|
||||
|
||||
select
|
||||
Call (1);
|
||||
else
|
||||
null;
|
||||
end select;
|
||||
end T;
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_body
|
||||
(identifier)
|
||||
(non_empty_declarative_part
|
||||
(object_declaration
|
||||
(single_task_declaration
|
||||
(identifier)
|
||||
(task_definition
|
||||
(entry_declaration
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(entry_declaration
|
||||
(identifier))
|
||||
(identifier))))
|
||||
(task_body
|
||||
(identifier)
|
||||
(non_empty_declarative_part
|
||||
(object_declaration
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(handled_sequence_of_statements
|
||||
(accept_statement
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement))
|
||||
(identifier))
|
||||
(timed_entry_call
|
||||
(entry_call_alternative
|
||||
(procedure_call_statement
|
||||
(identifier)
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))))
|
||||
(delay_alternative
|
||||
(delay_relative_statement
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))
|
||||
(conditional_entry_call
|
||||
(entry_call_alternative
|
||||
(procedure_call_statement
|
||||
(identifier)
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))))
|
||||
(null_statement)))
|
||||
(identifier)))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Task types
|
||||
================================================================================
|
||||
|
||||
package body P is
|
||||
task type T1;
|
||||
task type T is
|
||||
entry E (A : Integer);
|
||||
end T;
|
||||
task type T2 is new T with
|
||||
entry E2;
|
||||
end T2;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_body
|
||||
(identifier)
|
||||
(non_empty_declarative_part
|
||||
(full_type_declaration
|
||||
(task_type_declaration
|
||||
(identifier)))
|
||||
(full_type_declaration
|
||||
(task_type_declaration
|
||||
(identifier)
|
||||
(task_definition
|
||||
(entry_declaration
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(identifier))))
|
||||
(full_type_declaration
|
||||
(task_type_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(task_definition
|
||||
(entry_declaration
|
||||
(identifier))
|
||||
(identifier))))))))
|
||||
|
||||
================================================================================
|
||||
asynchronous select
|
||||
================================================================================
|
||||
|
||||
package body P is
|
||||
task body T is
|
||||
begin
|
||||
select
|
||||
Proc (1);
|
||||
null;
|
||||
then abort
|
||||
Proc2;
|
||||
end select;
|
||||
end;
|
||||
end;
|
||||
null;
|
||||
end;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_body
|
||||
(identifier)
|
||||
(non_empty_declarative_part
|
||||
(task_body
|
||||
(identifier)
|
||||
(handled_sequence_of_statements
|
||||
(asynchronous_select
|
||||
(triggering_alternative
|
||||
(procedure_call_statement
|
||||
(identifier)
|
||||
(actual_parameter_part
|
||||
(parameter_association
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))
|
||||
(null_statement))
|
||||
(procedure_call_statement
|
||||
(identifier))))))))
|
||||
(compilation_unit
|
||||
(null_statement))
|
||||
(compilation_unit
|
||||
(procedure_call_statement
|
||||
(identifier)))
|
||||
(compilation_unit
|
||||
(procedure_call_statement
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Accept
|
||||
================================================================================
|
||||
|
||||
accept Start (A : Integer; B : Integer) do
|
||||
null;
|
||||
end Start;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(accept_statement
|
||||
(identifier)
|
||||
(formal_part
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier))
|
||||
(parameter_specification
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(handled_sequence_of_statements
|
||||
(null_statement))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Select terminate
|
||||
================================================================================
|
||||
|
||||
select
|
||||
accept Start;
|
||||
or
|
||||
terminate;
|
||||
end select;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(selective_accept
|
||||
(select_alternative
|
||||
(accept_alternative
|
||||
(accept_statement
|
||||
(identifier))))
|
||||
(select_alternative
|
||||
(terminate_alternative)))))
|
||||
|
||||
================================================================================
|
||||
Task type with discriminant
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
task type T (A : Integer) is
|
||||
end T;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(task_type_declaration
|
||||
(identifier)
|
||||
(known_discriminant_part
|
||||
(discriminant_specification_list
|
||||
(discriminant_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(task_definition
|
||||
(identifier)))))))
|
||||
|
||||
================================================================================
|
||||
Task type with aspect
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
task type T (A : Integer) with Priority => 1 is
|
||||
end T;
|
||||
end;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(task_type_declaration
|
||||
(identifier)
|
||||
(known_discriminant_part
|
||||
(discriminant_specification_list
|
||||
(discriminant_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(aspect_specification
|
||||
(aspect_mark_list
|
||||
(aspect_association
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))))
|
||||
(task_definition
|
||||
(identifier)))))))
|
||||
@ -1,200 +0,0 @@
|
||||
================================================================================
|
||||
Range type
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type A is range 1 .. 2;
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(signed_integer_type_definition
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal))))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Derived type
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type B is new Integer
|
||||
with Size => 8;
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(derived_type_definition
|
||||
(identifier))
|
||||
(aspect_specification
|
||||
(aspect_mark_list
|
||||
(aspect_association
|
||||
(identifier)
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Modular types
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type C is mod 256;
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(modular_type_definition
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Floats
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type B is new Float range 0.0 .. 1.0;
|
||||
type D is delta 0.1 digits 8;
|
||||
type E is delta 0.1 range 0.0 .. 1.0;
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(derived_type_definition
|
||||
(identifier)
|
||||
(range_constraint
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal))))))
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(decimal_fixed_point_definition
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(ordinary_fixed_point_definition
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(real_range_specification
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Enumerations
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
type E is (VAL1, VAL2);
|
||||
for E use (VAL1 => 1, VAL2 => 2);
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(enumeration_type_definition
|
||||
(identifier)
|
||||
(identifier)))
|
||||
(enumeration_representation_clause
|
||||
(identifier)
|
||||
(enumeration_aggregate
|
||||
(named_array_aggregate
|
||||
(array_component_association
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(identifier)))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal))))
|
||||
(array_component_association
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(identifier)))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))))
|
||||
(identifier))))
|
||||
|
||||
================================================================================
|
||||
Subtypes
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
subtype T is Integer range 1 .. 2;
|
||||
subtype Arr is MyArray (1 .. 2, 3 .. 4);
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_declaration
|
||||
(identifier)
|
||||
(subtype_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(range_constraint
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(subtype_declaration
|
||||
(identifier)
|
||||
(identifier)
|
||||
(index_constraint
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))
|
||||
(range_g
|
||||
(term
|
||||
(numeric_literal))
|
||||
(term
|
||||
(numeric_literal)))))
|
||||
(identifier))))
|
||||
Loading…
Reference in New Issue