aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/parse2/derive.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-netdoc: parse2: debug: Explain why we use io::stderr()Ian Jackson2025-12-101-0/+2
|
* tor-netdoc: parse2: debug: Fix an error messageIan Jackson2025-12-101-1/+1
| | | | What is being written to here is StderrLock, not a String.
* tor-netdoc: parse2: debug: Fix scoping of netdoc_parseable_derive_debugIan Jackson2025-12-101-1/+1
| | | | | | While testing I discovered that the `#[deftly(netdoc(debug))]` feature (which dumps parsing progress to stderr) didn't compile if the derive was invoked from elsewhere.
* tor-netdoc: derive_common: Break out docs for attrs in flattenIan Jackson2025-12-101-8/+2
| | | | | | Code motion fromk NetdocParseableFields to NetdocFieldsDeriveCommon. This uses the derive-deftly imported doc comment feature.
* tor-netdoc: derive_common: Break out field ordering checkIan Jackson2025-12-101-16/+1
| | | | Code motion from NetdocParseable to NetdocEntireDeriveCommon.
* tor-netdoc: derive_common: Break out item field type definitionsIan Jackson2025-12-101-6/+0
| | | | Code motion from ItemValueParseable to NetdocItemDeriveCommon.
* tor-netdoc: derive_common: Break out main field type definitionsIan Jackson2025-12-101-12/+0
| | | | | | | | Code motion from NetdocParseable to NetdocEntireDeriveCommon. Code motion from NetdocParseableFields to NetdocFieldsDeriveCommon. Again, the encoder wants exactly this logic.
* tor-netdoc: derive_common: Break out F_KEYWORD_*, F_FLATTEN, F_NORMALIan Jackson2025-12-101-34/+0
| | | | | | | Code motion from NetdocSomeItemsParseableCommon to NetdocSomeItemsDeriveCommon. Encoding wants exactly the same logic.
* tor-netdoc: Introduce new derive_common Rust module with d-d modulesIan Jackson2025-12-101-0/+13
| | | | | | | There is nothing actually in any of these yet. But it is most convenient to lay out the structure now. We'll move code into these modules in forthcoming commits.
* tor-netdoc: parse2: Rename NetdocParseableCommon d-d moduleIan Jackson2025-12-101-3/+3
| | | | | | | | This is only used for structs which contain items, not item value structs. We need a name that reflects this, especially as we are going to add a bunch more modules full of common macro elements.
* tor-netdoc: Break out netdoc_ordering_check into new derive_common.rsIan Jackson2025-12-101-34/+0
|
* tor-netdoc: NetdocParseable: Document that BTreeSet is allowedIan Jackson2025-12-101-0/+1
| | | | | | | When we implemented this we documented it for ItemValueParseable but forgot to do so for NetdocParseable. Add some xrefs to the traits to try to stop similar mistakes.
* tor-netdoc: Suppress a clippy warning more thoroughlyIan Jackson2025-12-041-1/+2
|
* tor-netdoc: Suppress a clippy warningIan Jackson2025-12-031-0/+1
| | | | | | | This code sometimes expands to `let item = item;`. That's OK. In derive-deftly 1.5.x the two `item` wrongly had different hygiene span so the warning didn't trigger.
* parse2: ItemValueParseable, netdoc(object, rest): docs: state signatureIan Jackson2025-12-021-1/+3
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3502/diffs?commit_id=f9a6d90ec6d5abf2958534d2c100c84f325e3634#2525aaf11b44162850101813478c4734160e11fa_920_919
* parse2: ItemValueParseable, netdoc(object, rest): docs: clarify errorsIan Jackson2025-12-021-1/+1
| | | | | | The error is not really discarded (which would seem to mean ignoring it). The erorr *value* is discarded and is replaced with a less informative error value.
* parse2: ItemValueParseable, netdoc(object, rest): docs: fix typoIan Jackson2025-12-021-1/+1
|
* parse2: ItemValueParseable, netdoc(rest, with): reworkIan Jackson2025-12-021-5/+8
| | | | | | | | | | The path in `with` must always be a module, not a function, because we need to use it for encoding too. In the case of `rest`, it's probably sensible to require a different function name, given that the semantics are subtly different to those of `rest` without `with`, since the latter can only get a single word but with `rest` you get the whole line.
* parse2: ItemValueParseable, netdoc(rest): docs: clarify behaviourIan Jackson2025-12-021-1/+1
|
* tor-netdoc: Minor wording fix in a docIan Jackson2025-11-261-1/+1
| | | | | This is in the ItemValueParseable derive, so the individual fields are Arguments, not Items.
* tor-netdoc: Minor grammar fix in a docIan Jackson2025-11-261-1/+1
|
* Merge branch 'p2-mult' into 'main'Ian Jackson2025-11-251-3/+3
|\ | | | | | | | | tor-netdoc: parse2: Combine MultiplicitySelector See merge request tpo/core/arti!3478
| * tor-netdoc: parse2: Combine all the multiplicity SelectorsIan Jackson2025-11-191-3/+3
| | | | | | | | | | There is no conflict between the different uses. Having just one type makes things simpler.
* | tor-netdoc: parse2 docs: Improve `#[deftly(netdoc(rest))]` docsIan Jackson2025-11-191-0/+2
| |
* | tor-netdoc: parse2 docs: Fix docs for ItemArgumentParseableIan Jackson2025-11-191-3/+2
| | | | | | | | This is not impl for all FromStr. We have NormalItemArgument now.
* | tor-netdoc: parse2 docs: Document BTreeSet in multiplicityIan Jackson2025-11-191-2/+3
|/ | | | This was added at some point, but not documented.
* tor-netdoc: parse2: Introduce ParseInput intermediate structIan Jackson2025-11-181-2/+3
| | | | | | | We're going to add options arguments, effectively, to the parsing entrypoints. To avoid a proliferation of entrypoints (eg, parse_multiple_with_options), encapsulate the run-time input values in this structure.
* tor-netdoc: parse2: Improve error message when using with=Ian Jackson2025-11-101-1/+1
| | | | | This can result in "trait not implemented" errors here. Use the `${paste_spanned}` trick.
* tor-netdoc: parse2 derive: deduplicate completionIan Jackson2025-11-101-35/+33
|
* tor-netdoc: parse2 derive: deduplicate item accumulationIan Jackson2025-11-101-31/+35
|
* tor-netdoc: parse2 derive: deduplicate item accumulation (prep)Ian Jackson2025-11-101-43/+54
| | | | | | | | | Move what is now IF_NONSTRUCTURAL_ACCUMULATE into the common module. It's not yet suitable for reuse. The docs for ACCUMULATE_ITEM_VALUE are still wrong. We'll fix that in a moment.
* tor-netdoc: parse2 derive: Provide dtrace in NetdocParseableFieldsIan Jackson2025-11-101-12/+21
| | | | | | This was previously only not done because of the need to c&p. Also, we're going to be expanding some common macros that will use it.
* tor-netdoc: parse2 derive: Get rid of $ITEM workaroundIan Jackson2025-11-101-10/+4
| | | | The hygiene is fixed in derive-deftly 1.5.x.
* tor-netdoc: Fix typoIan Jackson2025-11-101-1/+1
|
* tor-netdoc: parse2 derive: deduplicate item parsingIan Jackson2025-11-061-24/+23
|
* tor-netdoc: parse2 derive: deduplicate item set selectorsIan Jackson2025-11-061-47/+62
|
* tor-netdoc: parse2 derive: deduplicate F_EFFECTIVE_TYPEIan Jackson2025-11-061-24/+13
|
* tor-netdoc: parse2 derive: deduplication: field types and keywordsIan Jackson2025-11-061-36/+39
| | | | | | | Have the module expect the use site to determine (mostly) the field kind. Document this expectation. Now NetdocParseableCommon can have the keyword-related definitions.
* tor-netdoc: parse2 derive: deduplication: start a moduleIan Jackson2025-11-061-8/+12
| | | | Put one textually-identical define in it, to start with.
* tor-netdoc: NetdocParseableFields derive: support flattenIan Jackson2025-10-221-2/+26
| | | | | | | | | This allows a NetdocParseableFields inside a NetdocParseableFields. The code is rather duplicative with the NetdocParseable implementation. This is due to limitations in derive-deftly; see https://gitlab.torproject.org/Diziet/rust-derive-deftly/-/merge_requests/525 where I'm trying to start to address them.
* tor-netdoc: NetdocParseableFields derive: break out kw variableIan Jackson2025-10-221-1/+3
| | | | We're going to reuse this.
* Merge branch 'p2-misc-fixes' into 'main'opara2025-10-211-1/+5
|\ | | | | | | | | tor-netdoc: parse2: Minor fixes See merge request tpo/core/arti!3376
| * tor-netdoc: NetdocParseable derive: use more explicit syntaxIan Jackson2025-10-211-1/+1
| | | | | | | | In principle some other trait might be in scope.
| * tor-netdoc: parse2: Don't declare internal error on subdoc intro itemsIan Jackson2025-10-211-0/+4
| | | | | | | | | | subdoc intro items aren't inherently incoherent, but implementing them is nontrivial. Let's reject them with a bespoke error instead.
* | tor-netdoc: parse2: Provide documentation for derived Accumulator typesIan Jackson2025-10-211-0/+3
|/
* tor-netdoc: parse2: Replace EP with AE in derive fields rest pathIan Jackson2025-10-091-1/+2
|
* tor-netdoc: Abolish now-obsolete field argument to from_argsIan Jackson2025-10-091-1/+0
|
* tor-netdoc: Introduce ArgumentErrorIan Jackson2025-10-091-2/+2
| | | | | This will allow us to (1) move field name handling out of the argument parser method, and also (2) add columns more easily.
* tor-netdoc: parse2: Make NetdocParseableFields work out of-moduleIan Jackson2025-10-061-0/+9
|
* tor-netdoc: parse2: Fix ItemValueParseable field attribute `with`Ian Jackson2025-10-061-1/+1
| | | | | According to the docs this is supposed to name the module, not the function. (This will be necessary when we do netdoc generation.)