Keith Hall
a19593b383
improvements from PR review
...
1. Added `Deserialize` derive and `#[serde(try_from = "RawMatcher")]` to the `Matcher` struct. With `try_from`, serde generates a `Deserialize` impl that first deserializes into `RawMatcher`, then calls `TryFrom<RawMatcher> for Matcher`. It never attempts to deserialize `Matcher`'s fields directly, so `Case` and `MatcherSegment` don't need `Deserialize` impls.
2. Replaced the manual `impl<'de> serde::Deserialize<'de> for Matcher` with a standard `impl TryFrom<RawMatcher> for Matcher`. The logic is identical - the conversion is fallible because `Matcher::from_str` returns `Result<_, anyhow::Error>`, so `try_from` (not `from`) is the correct choice, avoiding any panics.
The net effect: same behavior, same error handling, but using the idiomatic serde pattern instead of a manual deserializer impl. The `RawMatcher` intermediate type and its `#[serde(untagged)]` derive remain unchanged.
2026-03-20 23:53:30 +02:00
Keith Hall
7a6f442c86
improvements from PR review
...
- prefer to use `Default::default` because it's semantically clearer why we've chosen to use a particular value
2026-03-20 23:35:27 +02:00
Keith Hall
c6e661d80b
cargo fmt
2026-03-18 22:25:07 +02:00
copilot-swe-agent[bot]
2a29802dd5
Refactor: string-or-struct matcher syntax, Case enum, remove case_sensitive_mappings table
...
Co-authored-by: keith-hall <11882719+keith-hall@users.noreply.github.com >
2026-03-18 22:16:50 +02:00
Keith Hall
56fe0fa226
Add case-sensitive glob support to syntax mapping
...
to allow us to map `BUILD` case sensitively to Python for Skylark
2026-03-14 09:18:56 +02:00
cyqsimon
68df079c0e
Add improvement note on parse + unparse
2025-07-10 23:31:12 +03:00
cyqsimon
563c4c290d
Consistent spaces in quote! invocations
2025-07-10 23:31:12 +03:00
cyqsimon
fd12328293
Build script: replace string-based codegen with quote-based codegen
2025-07-10 23:31:12 +03:00
David Tolnay
db7da314e7
Work around cargo vendor losing syntax_mapping builtins directory
2025-01-17 21:30:37 -08:00
einfachIrgendwer0815
dbe25ba5e6
Include shell completions in the executable
2024-12-01 09:39:17 +01:00
cyqsimon
75cdabaf13
Relax syntax mapping rule restrictions to allow brace expansion
2024-02-20 14:24:51 +08:00
David Tolnay
1a54c9bf6d
Eliminate dependency on serde's "derive" feature
2024-02-08 15:55:30 -08:00
cyqsimon
9f36a7a284
Minor codestyle improvements
2024-01-18 23:07:11 +08:00
cyqsimon
daf33709a0
Additional sanity check for matcher parser
2023-12-11 10:21:06 +08:00
cyqsimon
12fa2cb1eb
- is not a legal character in variable name
2023-12-11 10:21:06 +08:00
cyqsimon
0c1b80faab
Impl per-target syntax mappings
2023-12-11 10:21:05 +08:00
cyqsimon
2c9bf229e1
Add doc comment for BUILTIN_MAPPINGS
2023-12-11 10:21:05 +08:00
cyqsimon
822e81bb24
Suppress clippy warning for MappingTarget in build script
2023-12-11 10:21:05 +08:00
cyqsimon
4ad3002543
s/Lazy<GlobMatcher>/Lazy<Option<GlobMatcher>>/
2023-12-11 10:21:05 +08:00
cyqsimon
1c7c9a6b6d
Split syntax_mapping/builtin.rs
2023-12-11 10:21:05 +08:00
cyqsimon
0c93ca80f4
Guard against duplicate matchers in build script
2023-12-11 10:21:04 +08:00
cyqsimon
de6d418d42
Remove BuiltinMatcher enum
...
Explanation added as comments in code
Using plain `Lazy<Option<GlobMatcher>>` is just better
2023-12-11 10:21:04 +08:00
cyqsimon
c016b462c0
STATIC_RULES => BUILTIN_MAPPINGS
2023-12-11 10:21:04 +08:00
cyqsimon
075b5b288a
Matcher parser errors when empty
2023-12-11 10:20:12 +08:00
cyqsimon
7cfd1e0d78
Rerun build script only when necessary
2023-12-11 10:20:12 +08:00
cyqsimon
9f7d70f642
Use regex for matcher parsing
...
- Somewhat better maintainability I think
2023-12-11 10:20:12 +08:00
cyqsimon
0fea82cff9
Minor improvement of variable naming accuracy
2023-12-11 10:20:11 +08:00
cyqsimon
64840fbbae
join_segments -> build_glob_string
...
- this is a more descriptive name
2023-12-11 10:20:11 +08:00
cyqsimon
9478d2dfe8
Isolate variables at compile time
2023-12-11 10:20:11 +08:00
cyqsimon
9f4259721a
Fix codegen type declaration
2023-12-11 10:20:11 +08:00
cyqsimon
77e491161c
Ensure lexicographical ordering
2023-12-11 10:20:10 +08:00
cyqsimon
97780f987e
MappingDefModel::into_mapping_list returns MappingList
2023-12-11 10:20:10 +08:00
cyqsimon
d1bc0ef0d4
Build script codegen initial impl
2023-12-11 10:20:10 +08:00
cyqsimon
5498c24c33
Rerun build script only when necessary
2023-11-02 17:54:57 +01:00
cyqsimon
79a03b4299
Reorganise build script into modules
2023-11-02 17:54:57 +01:00