yes_parser
v1.0.3
Published
Official YES standard parser for js
Readme
YES Script
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.
Getting Started
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)Example
See the example to learn how to access element data from an example mesh file format which uses the YES scriplet spec.
npm run exampleTests
Node tests are supplied to ensure the parser is spec-compliant and prevent regressions in future updates.
You can run these tests with:
node --testLicense
This project is licensed under the Common Development and Distribution License (CDDL).
