Let a tag say that going takes it off
`removable` is `chip` with the third constructor and nothing else
different, so it is the same emission and one word apart. `Tag` has three
constructors and the form now says all three: `badge` is inert, `chip`
goes somewhere, `removable` goes somewhere and says the going takes it
off.
Earned by audiofiles' detail panel, which draws each of a sample's tags
as a token that removes it. One site, and the honest note is that the
alternative was a chip that does not say it can be taken off, which is a
described fact lost rather than a cheaper spelling.
4 files changed,
+46 insertions,
-9 deletions
| 1 |
1 |
|
[package]
|
| 2 |
2 |
|
name = "quasi-declare"
|
| 3 |
|
- |
version = "0.1.2"
|
|
3 |
+ |
version = "0.1.3"
|
| 4 |
4 |
|
description = "The declare! form: a screen description compiled to Rust at build time."
|
| 5 |
5 |
|
edition.workspace = true
|
| 6 |
6 |
|
rust-version.workspace = true
|
| 161 |
161 |
|
args: Vec<Arg>,
|
| 162 |
162 |
|
body: Vec<Item>,
|
| 163 |
163 |
|
},
|
| 164 |
|
- |
/// `chip <value> to <action> { .. }`
|
|
164 |
+ |
/// `chip <value> to <action> { .. }`, and `removable <value> to <action>`.
|
| 165 |
165 |
|
///
|
| 166 |
166 |
|
/// Its own emission rather than a `Simple` member because `Tag::chip` takes
|
| 167 |
167 |
|
/// an `Action`, and an action is spelled `to <verb>` rather than as an arg.
|
|
168 |
+ |
///
|
|
169 |
+ |
/// One emission for both because they differ by one constructor and nothing
|
|
170 |
+ |
/// else. `Tag` has three constructors and the form now says all three:
|
|
171 |
+ |
/// `badge` is the inert one, `chip` goes somewhere, and `removable` goes
|
|
172 |
+ |
/// somewhere and says the going takes it off.
|
| 168 |
173 |
|
Chip {
|
| 169 |
174 |
|
value: Arg,
|
| 170 |
175 |
|
action: Action,
|
|
176 |
+ |
/// Whether the tag says it can be taken off, which is `Tag::removable`.
|
|
177 |
+ |
removable: bool,
|
| 171 |
178 |
|
body: Vec<Item>,
|
| 172 |
179 |
|
},
|
| 173 |
180 |
|
/// `screen <arrangement> <arg> { .. }`
|
| 886 |
886 |
|
Emission::Chip {
|
| 887 |
887 |
|
value,
|
| 888 |
888 |
|
action,
|
|
889 |
+ |
removable,
|
| 889 |
890 |
|
body,
|
| 890 |
891 |
|
} => {
|
| 891 |
|
- |
// The other half of `badge`. A chip goes somewhere, so it carries an
|
| 892 |
|
- |
// action, which is why it is spelled `chip <value> to <action>`
|
| 893 |
|
- |
// rather than as a member with two arguments.
|
|
892 |
+ |
// The other two thirds of `badge`. A chip goes somewhere, so it
|
|
893 |
+ |
// carries an action, which is why it is spelled
|
|
894 |
+ |
// `chip <value> to <action>` rather than as a member with two
|
|
895 |
+ |
// arguments. `removable` is the same member and the same shape with
|
|
896 |
+ |
// the third constructor: a tag whose going takes it off. audiofiles'
|
|
897 |
+ |
// detail panel is the site and `Tag` has no fourth constructor, so
|
|
898 |
+ |
// the form now says all of them.
|
| 894 |
899 |
|
let value = arg(value)?;
|
| 895 |
900 |
|
let called = self::action(action)?;
|
| 896 |
901 |
|
let tag = accrete(
|
| 897 |
902 |
|
body,
|
| 898 |
903 |
|
Container::Tag,
|
| 899 |
|
- |
"e!(::quasi_router::screen::Tag::chip(#value, #called)),
|
|
904 |
+ |
&if *removable {
|
|
905 |
+ |
quote!(::quasi_router::screen::Tag::removable(#value, #called))
|
|
906 |
+ |
} else {
|
|
907 |
+ |
quote!(::quasi_router::screen::Tag::chip(#value, #called))
|
|
908 |
+ |
},
|
| 900 |
909 |
|
)?;
|
| 901 |
910 |
|
Ok(quote!(::quasi_router::Node::token(#tag)))
|
| 902 |
911 |
|
}
|
| 56 |
56 |
|
/// without a production is a parse error naming it, which is the failure worth
|
| 57 |
57 |
|
/// having.
|
| 58 |
58 |
|
const MEMBERS: &[&str] = &[
|
| 59 |
|
- |
"act", "across", "activate", "at", "beside", "cell", "cells", "chip", "column", "field",
|
| 60 |
|
- |
"form", "given", "include", "link", "offering", "offers", "region", "row", "screen", "table",
|
|
59 |
+ |
"act",
|
|
60 |
+ |
"across",
|
|
61 |
+ |
"activate",
|
|
62 |
+ |
"at",
|
|
63 |
+ |
"beside",
|
|
64 |
+ |
"cell",
|
|
65 |
+ |
"cells",
|
|
66 |
+ |
"chip",
|
|
67 |
+ |
"column",
|
|
68 |
+ |
"field",
|
|
69 |
+ |
"form",
|
|
70 |
+ |
"given",
|
|
71 |
+ |
"include",
|
|
72 |
+ |
"link",
|
|
73 |
+ |
"offering",
|
|
74 |
+ |
"offers",
|
|
75 |
+ |
"region",
|
|
76 |
+ |
"removable",
|
|
77 |
+ |
"row",
|
|
78 |
+ |
"screen",
|
|
79 |
+ |
"table",
|
| 61 |
80 |
|
];
|
| 62 |
81 |
|
|
| 63 |
82 |
|
/// The members that are one of `Node`'s own constructors, called by its name.
|
| 758 |
777 |
|
// A chip is a tag that goes somewhere, so it takes an action, and
|
| 759 |
778 |
|
// an action is spelled `to <verb>` rather than as an argument. That
|
| 760 |
779 |
|
// is why it is not in NODE_MEMBERS with `badge`.
|
| 761 |
|
- |
"chip" => {
|
|
780 |
+ |
"chip" | "removable" => {
|
|
781 |
+ |
let removable = member == "removable";
|
| 762 |
782 |
|
let value: Arg = input.parse()?;
|
| 763 |
783 |
|
preposition(input, "to")?;
|
| 764 |
784 |
|
let action: Action = input.parse()?;
|
| 774 |
794 |
|
Self::Chip {
|
| 775 |
795 |
|
value,
|
| 776 |
796 |
|
action,
|
|
797 |
+ |
removable,
|
| 777 |
798 |
|
body,
|
| 778 |
799 |
|
},
|
| 779 |
800 |
|
))
|