| Crates.io | mantra-lang-tracing |
| lib.rs | mantra-lang-tracing |
| version | 0.7.0 |
| created_at | 2024-04-29 13:05:40.107043+00 |
| updated_at | 2024-12-17 15:16:54.97065+00 |
| description | Contains functionality needed to collect requirement traces from code or plain text files for the `mantra` framework. |
| homepage | |
| repository | https://github.com/mhatzl/mantra |
| max_upload_size | |
| id | 1224163 |
| size | 46,389 |
This crate contains functionality needed to collect requirement traces from code or plain text files. Traces are a link between requirement definitions and where they are implemented in code.
The PlainCollector may be used to collect traces from plain text files.
Traces with the form [req(<requirement id(s)>)] are collected line by line.
Example:
This line has a valid trace. [req(valid_trace)]
Traces cannot span multiple lines. [req(
invalid_trace)]
The AstCollector may be used to collect traces from the abstract syntax tree of a code file.
It uses tree-sitter to create the AST,
and allows to define a collector function that tries to collect traces from AST nodes.
This collector may be used as a base to create trace collectors for programming languages.
The extract_req_ids*() functions offer a consistent way to extract requirement IDs from traces.
They should be used in custom collector implementations, to keep the same syntax for specifying IDs.
Syntax:
ids = id , {(",", id)} ;
id = {(id_part, "." )}, id_part ;
id_part = escaped_id_part | unescaped_id_part ;
escaped_id_part = '"', ?any char except '"', '`', or '.'?, '"' ;
unescaped_id_part = ( digit | rust_identifier ) , { digit | rust_identifier } ;
Examples:
"escaped-id".sub_id
1234."digit-only-main-id"
first_id, second_id