0.0.12 • Published 6 years ago
bavary v0.0.12
Getting Started
⚠ Bavary is currently not stable and heavily under development.
The API might change and all 0.0.x
releases should be treated as test / preview releases.
Install via npm:
$ npm install bavary
Install via yarn:
$ yarn add bavary
Include directly via jsdelivr:
<script src="https://cdn.jsdelivr.net/npm/bavary/lib/bavary.js"></script>
Usage
import {compile} from 'bavary';
// Compile definitions
const parse = compile(`
entry ['A' | 'B']
`);
// Use compiled definitions to parse a string
const parsed = parse('A');
// Logs "A" to the console
console.log(parsed);
The function compile
accepts as second argument a config object;
Getting started
Check out the documentation to get started or jump directly into one of the examples:
- string - Parsing strings and support escaped quotes.
- hex-color - Parsing different kinds of color types in the hexadecimal format.
- number - Parsing floats and integers with optional scientific notation.
CLI
Usage:
$ bvc [files] [options...]
Where files
can be any kind of directory, file or glob-pattern.
If no output file is specified (via --output
) it'll print the result to the console.
Flag | Explanation | Example |
---|---|---|
-w, --watch | Watches source-files matched by [files] | $ bva src/**/*.bv input.txt --watch |
-v, --version | Prints the current version | $ bva --version |
-o, --output <file> | Write results to disk | $ bva --output result.json |
-p, --prettify | Prettify result (Works only in combination with --output ) | $ bva --output result.json --prettify |
-h, --help | Shows usage info | $ bva --help |