npm module for rapid parsing of cds written in rust as component of rapidcds extention
Installing of rapid-cds-parser requires a supported version of Node and Rust.
You can install the project with npm. In the project directory, run:
$ npm install
This fully installs the project, including installing any dependencies and running the build.
If you have already installed the project and only want to run the build, run:
$ npm run build
This command uses the cargo-cp-artifact utility to run the Rust build and copy the built library into ./index.node
.
After building rapid-cds-parser, you can explore its exports at the Node REPL:
$ npm install
$ node
> require('.').generateIR('test.cds')
{
types: [],
entities: [
{
name: 'Test',
aspects: [],
isProjection: false,
fields: [
{
name: 'field',
hasDefault: false,
type: 'TestType',
},
],
},
],
services: [
{
actions: [
{
name: 'actionName',
hasOutput: true,
output: {
type: 'Test',
isArrayed: true,
},
params: [
{
type: 'Test',
isArrayed: false,
name: 'arg1',
},
],
},
],
name: 'TestService',
entities: [
],
functions: [
{
output: {
isArrayed: false,
type: 'OutputType',
},
params: [],
name: 'functionName',
},
],
},
],
}
In the project directory, you can run:
Installs the project, including running npm run build
.
Builds the Node addon (index.node
) from source.
Runs the unit tests by calling cargo test
. You can learn more about adding tests to your Rust code from the Rust book.
The directory structure of this project is:
rapid-cds-parser/
├── Cargo.toml
├── README.md
├── lib.node
├── index.js
├── package.json
├── src/
| └── lib.rs
| └── parser/
| └── ir/
├── tests/
└── target/
The Cargo manifest file, which informs the cargo
command.
This file.
The Node addon—i.e., a binary Node module—generated by building the project.
Under the hood, a Node addon is a dynamically-linked shared object. The "build"
script produces this file by copying it from within the target/
directory, which is where the Rust build produces the shared object.
The wrapper around lib.node to make it usable in modern IDEs.
This is the main module for this package, as dictated by the "main"
key in package.json
.
The npm manifest file, which informs the npm
command.
The directory tree containing the Rust source code for the project.
Implementation of a cds languages parser with lalrpop.
Implementation of intermediate representation generation from the AST parser produces.
The Rust library's main module.
Implementation of library's integration tests.
Binary artifacts generated by the Rust build.