doc comments and annotations in Souffle datalog #2472
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Annotations are free meta-data that can be attached to most items of a Souffle datalog program.
A documentation comment is a syntactic sugar for a
doc
annotation.The design is close to Rust's attributes.
All program's and component's items can have outer annotations of the form
@[annotation]
or/// doc comment
. Attributes and ADT branches also accept outer annotations.Some items can have inner annotations of the for
@![annotation]
or//! doc comment
:{
of a component, before the first component's item.{
of an ADT branch, before the first attribute of the branch.:-
of a clause, before the first constraint.Annotations should not appear before
.include
or before any}
or before the end of a file.An annotation's payload may be of these forms:
@[IDENT]
@[IDENT DELIM]
=
and a delimited token stream:@[IDENT = DELIM]
or@[IDENT = TOKEN TT*]
Where:
IDENT
is an identifier or a keyword of Souffle.TOKEN
is any token except delimiters.TS ::= TT+
is a token-stream.TT ::= TOKEN | DELIM
is a token-tree.DELIM ::= '(' TS? ')' | '[' TS? ']' | '{' TS? '}'
is a delimited token-stream.