@@ -64,7 +64,7 @@ The fragment kinds are:
6464 [ Rule Rewriting] ( ./rewriting.md ) ).
6565* ` va_args ` : the expansion point for a variadic tail.
6666
67- Every type in the IR (in ` params ` , ` return_type ` , and type rules) is a
67+ Every type in the Rules IR (in ` params ` , ` return_type ` , and type rules) is a
6868` TypeInfo ` object, the type text plus a set of flags:
6969
7070* ` is_refcount_pointer ` : the type is a ` Ptr<...> ` .
@@ -83,7 +83,7 @@ An `ExprRule` carries two flags of its own:
8383* ` is_extern ` : the rule is an extern passthrough declaration and has no
8484 body.
8585
86- Fields that are false, empty, or unset are omitted from the JSON . A ` va `
86+ Fields that are false, empty, or unset are omitted from the Rules IR . A ` va `
8787parameter is never listed in ` params ` , and a ` () ` return type is omitted.
8888
8989A type rule serializes as a ` TypeRule ` object: its ` TypeInfo ` plus the
@@ -98,28 +98,35 @@ There is no explicit tag distinguishing the two rule kinds: an entry with
9898
9999## In-memory form
100100
101- ` cpp2rust ` mirrors this JSON in C++ structs of the same names, defined in
102- ` cpp2rust/converter/translation_rule.h ` . ` TranslationRule::Load ` reads one
101+ ` cpp2rust ` mirrors the Rules IR in C++ structs of the same names, defined in
102+ [ ` cpp2rust/converter/translation_rule.h ` ] [ translation-rule-h ] .
103+ ` TranslationRule::Load ` reads one
103104module directory (the ` ir_*.json ` files described above) and produces two
104- maps keyed by rule name, one holding ` ExprRule ` s and one holding ` TypeRule ` s:
105+ maps keyed by rule name, one holding [ ` ExprRule ` ] s and one holding
106+ [ ` TypeRule ` ] s:
107+
108+ [ translation-rule-h ] : https://github.com/cpp2rust/cpp2rust/blob/master/cpp2rust/converter/translation_rule.h
109+ [ `ExprRule` ] : https://github.com/cpp2rust/cpp2rust/blob/master/cpp2rust/converter/translation_rule.h#L71
110+ [ `TypeRule` ] : https://github.com/cpp2rust/cpp2rust/blob/master/cpp2rust/converter/translation_rule.h#L84
105111
106112* An ` ExprRule ` holds the body
107113 [ fragments] ( #target-ir-ir_unsafejson--ir_refcountjson ) , the parameter and
108- return ` TypeInfo ` s, and the two rule-level flags. The name-keyed JSON maps become
114+ return ` TypeInfo ` s, and the two rule-level flags (` multi_statement ` and ` is_extern ` ). The
115+ name-keyed Rules IR maps become
109116 positional vectors: parameter ` aN ` is entry N of ` params ` , generic ` TN ` is
110117 entry N-1 of ` generics ` (each entry being the bound list). Rules support
111118 at most 9 generic parameters (` kMaxGenerics ` ).
112119* A ` TypeRule ` holds the mapped type's ` TypeInfo ` and the ` initializer `
113120 expression. The same struct also represents the built-in type mappings
114121 (scalars, pointers, ...) that the loader registers directly in code,
115- without any JSON behind them: for example, ` int ` maps to ` i32 ` , and
122+ without any Rules IR behind them: for example, ` int ` maps to ` i32 ` , and
116123 ` int * ` to ` *mut i32 ` in the unsafe model or ` Ptr<i32> ` in the refcount
117124 model.
118125
119126Both also carry ` src ` , the canonical C++ signature attached from
120127[ ` ir_src.json ` ] ( #source-ir-ir_srcjson ) ; it is the key the rule is matched
121128by.
122129
123- How the loader finds the IR directory, overlays the refcount model on the
130+ How the loader finds the Rules IR directory, overlays the refcount model on the
124131unsafe one, and indexes the loaded rules for matching is covered in
125132[ Loading and Matching] ( ./loading.md ) .
0 commit comments