yarp 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -81,32 +81,35 @@ Each node is structured like the following table:
81
81
  | `1` | node type |
82
82
  | location | node location |
83
83
 
84
- Each node's child is then appended to the serialized string.
85
- The child node types can be determined by referencing `config.yml`.
86
- Depending on the type of child node, it could take a couple of different forms, described below:
87
-
88
- * `node` - A child node that is a node itself. This is structured just as like parent node.
89
- * `node?` - A child node that is optionally present. If the node is not present, then a single `0` byte will be written in its place. If it is present, then it will be structured just as like parent node.
90
- * `node[]` - A child node that is an array of nodes. This is structured as a variable-length integer length, followed by the child nodes themselves.
91
- * `string` - A child node that is a string. For example, this is used as the name of the method in a call node, since it cannot directly reference the source string (as in `@-` or `foo=`). This is structured as a variable-length integer byte length, followed by the string itself (_without_ a trailing null byte).
84
+ Every field on the node is then appended to the serialized string. The fields can be determined by referencing `config.yml`. Depending on the type of field, it could take a couple of different forms, described below:
85
+
86
+ * `node` - A field that is a node. This is structured just as like parent node.
87
+ * `node?` - A field that is a node that is optionally present. If the node is not present, then a single `0` byte will be written in its place. If it is present, then it will be structured just as like parent node.
88
+ * `node[]` - A field that is an array of nodes. This is structured as a variable-length integer length, followed by the child nodes themselves.
89
+ * `string` - A field that is a string. For example, this is used as the name of the method in a call node, since it cannot directly reference the source string (as in `@-` or `foo=`). This is structured as a variable-length integer byte length, followed by the string itself (_without_ a trailing null byte).
92
90
  * `constant` - A variable-length integer that represents an index in the constant pool.
93
- * `constant[]` - A child node that is an array of constants. This is structured as a variable-length integer length, followed by the child constants themselves.
94
- * `location` - A child node that is a location. This is structured as a variable-length integer start followed by a variable-length integer length.
95
- * `location?` - A child node that is a location that is optionally present. If the location is not present, then a single `0` byte will be written in its place. If it is present, then it will be structured just like the `location` child node.
96
- * `location[]` - A child node that is an array of locations. This is structured as a `4` byte length, followed by the locations themselves.
97
- * `uint32` - A child node that is a 32-bit unsigned integer. This is structured as a variable-length integer.
91
+ * `constant?` - An optional variable-length integer that represents an index in the constant pool. If it's not present, then a single `0` byte will be written in its place.
92
+ * `location` - A field that is a location. This is structured as a variable-length integer start followed by a variable-length integer length.
93
+ * `location?` - A field that is a location that is optionally present. If the location is not present, then a single `0` byte will be written in its place. If it is present, then it will be structured just like the `location` child node.
94
+ * `uint32` - A field that is a 32-bit unsigned integer. This is structured as a variable-length integer.
95
+
96
+ After the syntax tree, the content pool is serialized. This is a list of constants that were referenced from within the tree. The content pool begins at the offset specified in the header. Constants can be either "owned" (in which case their contents are embedded in the serialization) or "shared" (in which case their contents represent a slice of the source string). The most significant bit of the constant indicates whether it is owned or shared.
97
+
98
+ In the case that it is owned, the constant is structured as follows:
99
+
100
+ | # bytes | field |
101
+ | --- | --- |
102
+ | `4` | the byte offset in the serialization for the contents of the constant |
103
+ | `4` | the byte length in the serialization |
98
104
 
99
- After the syntax tree, the content pool is serialized.
100
- This is a list of constants that were referenced from within the tree.
101
- The content pool begins at the offset specified in the header.
102
- Each constant is structured as:
105
+ Note that you will need to mask off the most significant bit for the byte offset in the serialization. In the case that it is shared, the constant is structured as follows:
103
106
 
104
107
  | # bytes | field |
105
108
  | --- | --- |
106
- | `4` | the byte offset in the source |
107
- | `4` | the byte length in the source |
109
+ | `4` | the byte offset in the source string for the contents of the constant |
110
+ | `4` | the byte length in the source string |
108
111
 
109
- At the end of the serialization, the buffer is null terminated.
112
+ After the constant pool, the contents of the owned constants are serialized. This is just a sequence of bytes that represent the contents of the constants. At the end of the serialization, the buffer is null terminated.
110
113
 
111
114
  ## APIs
112
115