YES - Your Extensible Script .
YES is a meta scriptlet standard whose elements and meaning are determined by YOU the programmer. They can be extended further with attributes which allow YOUR end-users to make their additions to YOUR elements.
The js API provides a parser which reads an entire file's contents by string. You do not need to split the contents. The parser will do that for you.
YesParser.fromBuffer will return {elements: [], errors: []}
See element.mjs for the API for Element.
Each error take the form {line: Integer, type: String} to report to users.
import { parser, Literal } from './../lib.mjs'
import { readFileSync } from 'fs'
const buffer = readFileSync('./example/example.mesh', 'utf-8')
// Treat content between curly-braces as string literals
// for custom parsing later.
const literals = [
new Literal('{', '}')
]
const results = parser.fromBuffer(buffer, literals)See the example to learn how to access element data from an example mesh file format which uses the YES scriplet spec.
npm run exampleNode tests are supplied to ensure the parser is spec-compliant and prevent regressions in future updates.
You can run these tests with:
node --testThis project is licensed under the Common Development and Distribution License (CDDL).