yes_parser 1.0.5
yes_parser: ^1.0.5 copied to clipboard
Dart implementation of the YES scriplet standard. YES is a meta scriptlet standard whose elements and meaning are customized by the programmer. This library parses files using the YES spec and deliver [...]
YES Script #
YES - Your Extensible Script .
Do you want a custom and simple file format but don't want to code the parser? YES is the answer! ✨
YES is a meta scriplet standard whose elements, keys, and evaluation are yours to decide. These scriplets are used for configuration files, animation documents, tiny scripting, and then some. YES has optional attribute support to tag elements and extend their behavior further.
Tip
- Read the scriptlet standard to learn more.
- See one of the many use cases: animation files.
Getting Started #
This API provides two static class methods:
- Parse by file.
- Parse by string.
Note
Loading by file is asynchronous.
void main() async {
final YesParser parser = await YesParser.fromFile(
File.fromUri(
Uri.file("doc.mesh"),
),
);
// Successfully parsed elements are stored in [elementInfoList].
// Errors are stored in [errorInfoList].
onComplete(parser.elementInfoList, parser.errorInfoList);
}
void onComplete(List<ElementInfo> elements, List<ErrorInfo> errors) { ... }
Note
Loading by string is synchronous.
void main() {
// docStr is a large document with each line separated by new-lines.
final String docStr = "...";
final YesParser parser = YesParser.fromString(docStr);
onComplete(parser.elementInfoList, parser.errorInfoList);
}
void onComplete(List<ElementInfo> elements, List<ErrorInfo> errors) { ... }
Run the Example #
Enter the example directory and run from command line.
cd example
dart yes_parser_example.dart
This simple example shows how to step through
each element and ignore unimportant errors for a 3D Mesh format
similar to Wavefront's 3D .OBJ format.
License #
This project is licensed under the Common Development and Distribution License (CDDL).