| | 1117 | |
| | 1118 | The ''Resolver'' interfaces of '''`Loader`''' and '''`Dumper`''' are identical. |
| | 1119 | |
| | 1120 | {{{ |
| | 1121 | #!python |
| | 1122 | add_implicit_resolver(tag, regexp, first, Loader=Loader, Dumper=Dumper) |
| | 1123 | add_path_resolver(tag, path, kind, Loader=Loader, Dumper=Dumper) |
| | 1124 | |
| | 1125 | Loader.add_implicit_resolver(tag, regexp, first) # Loader.add_implicit_resolver is a class method. |
| | 1126 | Loader.add_path_resolver(tag, path, kind) # Loader.add_path_resolver is a class method. |
| | 1127 | |
| | 1128 | Dumper.add_implicit_resolver(tag, regexp, first) # Dumper.add_implicit_resolver is a class method. |
| | 1129 | Dumper.add_path_resolver(tag, path, kind) # Dumper.add_path_resolver is a class method. |
| | 1130 | }}} |
| | 1131 | |
| | 1132 | '''`add_implicit_resolver(tag, regexp, first)`''' adds an implicit tag resolver for plain scalars. |
| | 1133 | If the scalar value is matched the given `regexp`, it is assigned the `tag`. `first` is a |
| | 1134 | list of possible initial characters or `None`. |
| | 1135 | |
| | 1136 | '''`add_path_resolver(tag, path, kind)`''' adds a path-based implicit tag resolver. |
| | 1137 | A `path` is a list of keys that form a path to a node in the representation graph. |
| | 1138 | Paths elements can be string values, integers, or `None`. The `kind` of a node can |
| | 1139 | be `str`, `list`, `dict`, or `None`. |