-
Notifications
You must be signed in to change notification settings - Fork 13
Pastey crate requirement #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| load("@trlc//:trlc.bzl", "trlc_requirements") | ||
|
|
||
| trlc_requirements( | ||
| name = "system_requirements", | ||
| srcs = [ | ||
| "assumed_system_requirements.trlc", | ||
| ], | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
|
|
||
| trlc_requirements( | ||
| name = "feature_requirements", | ||
| srcs = [ | ||
| "feature_requirements.trlc", | ||
| ], | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| ":system_requirements", | ||
| ], | ||
| ) | ||
|
|
||
| trlc_requirements( | ||
| name = "component_requirements", | ||
| srcs = [ | ||
| "component_requirements.trlc", | ||
| ], | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| ":system_requirements", | ||
| ":feature_requirements", | ||
| ], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /******************************************************************************** | ||
| * Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| * | ||
| * See the NOTICE file(s) distributed with this work for additional | ||
| * information regarding copyright ownership. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Apache License Version 2.0 which is available at | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| ********************************************************************************/ | ||
| package PasteySysReq | ||
|
|
||
| import ScoreReq | ||
|
|
||
| ScoreReq.AssumedSystemReq ASR_PASTEY_001 { | ||
| description = "The Rust toolchain shall provide the proc_macro crate API, making TokenStream, Ident, Punct, and Literal types available to procedural macro crates during compilation" | ||
| safety = ScoreReq.Asil.B | ||
| version = 1 | ||
| rationale = "pastey is built as a proc-macro crate, the entire token-stream processing and identifier-synthesis mechanism depends on the proc_macro API being present and stable in any Rust toolchain used to compile pastey" | ||
| } | ||
|
|
||
| ScoreReq.AssumedSystemReq ASR_PASTEY_002 { | ||
| description = "The Rust build environment shall make the values of host environment variables accessible to procedural macros during macro-expansion time" | ||
| safety = ScoreReq.Asil.B | ||
| version = 1 | ||
| rationale = "pastey reads host environment variables when processing env!(\"VAR_NAME\") expressions inside paste! interpolation blocks (the [< ... >] syntax), this requires the compiler proc_macro execution context to have read access to the build environment variables" | ||
| } |
|
aschemmel-tech marked this conversation as resolved.
aschemmel-tech marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| /******************************************************************************** | ||
| * Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| * | ||
| * See the NOTICE file(s) distributed with this work for additional | ||
| * information regarding copyright ownership. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Apache License Version 2.0 which is available at | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| ********************************************************************************/ | ||
| package PasteyComReq | ||
|
|
||
| import ScoreReq | ||
|
|
||
| ScoreReq.CompReq REQ_COMP_PASTEY_001 { | ||
| description = "The pastey component shall collect all tokens inside a paste! interpolation block (the [< ... >] syntax) and shall discard whitespace tokens between them before performing identifier concatenation" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteyFeatReq.FEAT_PASTEY_001@1] | ||
| version = 1 | ||
| } | ||
|
|
||
| ScoreReq.CompReq REQ_COMP_PASTEY_002 { | ||
| description = "The pastey component shall convert the accumulated identifier string to lowercase when the :lower modifier is present" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteyFeatReq.FEAT_PASTEY_002@1] | ||
| version = 1 | ||
| } | ||
|
|
||
| ScoreReq.CompReq REQ_COMP_PASTEY_003 { | ||
| description = "The pastey component shall convert the accumulated identifier string to uppercase when the :upper modifier is present" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteyFeatReq.FEAT_PASTEY_002@1] | ||
| version = 1 | ||
| } | ||
|
|
||
| ScoreReq.CompReq REQ_COMP_PASTEY_004 { | ||
| description = "The pastey component shall convert the accumulated identifier string to snake_case when the :snake modifier is present" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteyFeatReq.FEAT_PASTEY_002@1] | ||
| version = 1 | ||
| } | ||
|
|
||
| ScoreReq.CompReq REQ_COMP_PASTEY_005 { | ||
| description = "The pastey component shall convert the accumulated identifier string to UpperCamelCase when the :camel or :upper_camel modifier is present" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteyFeatReq.FEAT_PASTEY_002@1] | ||
| version = 1 | ||
| } | ||
|
|
||
| ScoreReq.CompReq REQ_COMP_PASTEY_006 { | ||
| description = "The pastey component shall convert the accumulated identifier string to lowerCamelCase when the :lower_camel modifier is present" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteyFeatReq.FEAT_PASTEY_002@1] | ||
| version = 1 | ||
| } | ||
|
|
||
| ScoreReq.CompReq REQ_COMP_PASTEY_007 { | ||
| description = "The pastey component shall convert the accumulated identifier string to UpperCamelCase while preserving edge-case boundaries such as consecutive uppercase letter sequences when the :camel_edge modifier is present" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteyFeatReq.FEAT_PASTEY_002@1] | ||
| version = 1 | ||
| } | ||
|
|
||
| ScoreReq.CompReq REQ_COMP_PASTEY_008 { | ||
| description = "The pastey component shall accept exactly one token for each of the from and to arguments of the :replace(from, to) modifier and shall emit a compile error when more than one token is supplied for either argument, when the preceding value is absent, or when the modifier syntax is malformed" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteyFeatReq.FEAT_PASTEY_003@1] | ||
| version = 1 | ||
| } | ||
|
|
||
| ScoreReq.CompReq REQ_COMP_PASTEY_009 { | ||
| description = "If the first token inside a paste! interpolation block (the [< ... >] syntax) is #, the pastey component shall produce a raw identifier (r#ident) from the remaining concatenated tokens; if # appears at any position other than the first, the pastey component shall emit a compile error" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteyFeatReq.FEAT_PASTEY_001@1] | ||
| version = 1 | ||
| } | ||
|
|
||
| ScoreReq.CompReq REQ_COMP_PASTEY_010 { | ||
| description = "The pastey component shall collect the string values of all #[doc = ...] attribute arguments within a pastey invocation and shall concatenate them in order into a single documentation string" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteyFeatReq.FEAT_PASTEY_004@1] | ||
| version = 1 | ||
| } | ||
|
|
||
| ScoreReq.CompReq REQ_COMP_PASTEY_011 { | ||
| description = "The pastey component shall look up the named variable in the compile-time environment, shall replace all hyphens in the resolved string with underscores, and shall emit a compile error when the variable is absent from the build environment" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteyFeatReq.FEAT_PASTEY_005@1] | ||
| version = 1 | ||
| } |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discussed in meeting: our preferred solution was to have one feature collecting several crates (components) - which would mean that the feature level requirements could be even more abstract. Folder structure can be kept. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /******************************************************************************** | ||
| * Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| * | ||
| * See the NOTICE file(s) distributed with this work for additional | ||
| * information regarding copyright ownership. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Apache License Version 2.0 which is available at | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| ********************************************************************************/ | ||
| package PasteyFeatReq | ||
|
|
||
| import ScoreReq | ||
|
|
||
| ScoreReq.FeatReq FEAT_PASTEY_001 { | ||
| description = "The pastey crate shall provide compile-time identifier synthesis by concatenating one or more tokens specified inside a paste! interpolation block (the [< ... >] syntax), ignoring any whitespace between tokens, and shall support a raw-identifier prefix (# as the first token) to produce a raw identifier (r#ident)" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteySysReq.ASR_PASTEY_001@1] | ||
| version = 1 | ||
| note = "Assumption of Use: the invoker shall only use pastey in Rust source positions where an identifier or item is syntactically valid, as the crate emits raw tokens into the surrounding code without additional context checks" | ||
| } | ||
|
|
||
| ScoreReq.FeatReq FEAT_PASTEY_002 { | ||
| description = "The pastey crate shall support case-transformation modifiers (:lower, :upper, :snake, :camel, :upper_camel, :lower_camel, :camel_edge) that convert a synthesized identifier to the casing style associated with the applied modifier" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteySysReq.ASR_PASTEY_001@1] | ||
| version = 1 | ||
| } | ||
|
|
||
| ScoreReq.FeatReq FEAT_PASTEY_003 { | ||
| description = "The pastey crate shall support a string-replacement modifier (:replace(from, to)) that performs substring replacement on a synthesized identifier value and shall produce a compile error when more than one token is supplied for either argument, when the preceding value is absent, or when the modifier syntax is malformed" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteySysReq.ASR_PASTEY_001@1] | ||
| version = 1 | ||
| } | ||
|
|
||
| ScoreReq.FeatReq FEAT_PASTEY_004 { | ||
| description = "The pastey crate shall support assembly of documentation strings by concatenating the argument values of all #[doc = ...] attributes present within a single pastey invocation into one documentation string" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteySysReq.ASR_PASTEY_001@1] | ||
| version = 1 | ||
| } | ||
|
|
||
| ScoreReq.FeatReq FEAT_PASTEY_005 { | ||
| description = "The pastey crate shall support compile-time expansion of build-environment variables via env!(\"VAR_NAME\") inside a paste! interpolation block (the [< ... >] syntax), replacing hyphens in the resolved value with underscores, and shall produce a compile error when the named variable is not defined in the build environment" | ||
| safety = ScoreReq.Asil.B | ||
| derived_from = [PasteySysReq.ASR_PASTEY_002@1] | ||
| version = 1 | ||
| note = "Assumption of Use: the invoker shall ensure that any environment variable referenced via env!(\"VAR_NAME\") inside a paste! interpolation block is defined in the build environment at compile time, since an absent variable causes a compile error that cannot be recovered from at the call site" | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.