[−][src]Module binjs::io::binjs_json
A format for generating invalid file, to test decoder implementation.
The expected usage is the following:
- Convert .js file to this JSON format (write module)
- Modify the JSON file, for instance:
- Remove a field from an interface
- Add a field to an interface
- Replace a field value
- Convert JSON file to other BinAST format (read module)
- Feed the possibly-invalid BinAST to decoder
The JSON format is in the following structure:
tagged tuple
{ "@TYPE": "tagged tuple", "@INTERFACE": "<interface name>", "@FIELDS": [ { "@FIELD_NAME": "<field name>" "@FIELD_VALUE": <field value> }, ... ] }
<interface name>
and <field name>
are the names of the interface and
the field in WebIDL, and <field value>
the field's value.
list
{ "@TYPE": "list", "@VALUE": [ <item>, ... ] }
<item>
is the list's item.
string
{ "@TYPE": "string", "@VALUE": <value> }
<value>
is the value of the string. if the value is null, it's null
.
enum, identifier name, property key, float, unsigned long, bool also use
the same format, with corresponding "@TYPE" value
Modules
read | A JSON reader with extra support for JSON->BinAST converter. The input JSON file is supposed to be the output of the JSON writer, filtered with some command to generate an invalid content. See mod.rs for the detail of the filter. Some methods implemented on Decoder are for binjs_convert_from_json command. |
write | A JSON writer for BinAST file structure. The written file is supposed to be filtered with some command to generate an invalid content, and then fed to binjs_convert_from_json command to generate BinAST file with the invalid content. See mod.rs for the detail of the filter. |
Structs
FormatProvider | Command-line management. |