Skip to content

Commit

Permalink
update deno
Browse files Browse the repository at this point in the history
  • Loading branch information
yoav-lavi committed Jul 16, 2023
1 parent 32244a2 commit 1c84527
Show file tree
Hide file tree
Showing 6 changed files with 273 additions and 329 deletions.
57 changes: 34 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions integrations/deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ Deno bindings for the Melody language compiler
## Usage

```ts
import init, { compiler } from 'https://deno.land/x/melody/melody_wasm.js';

await init();
import { compiler } from 'https://deno.land/x/melody/melody_wasm.js';

const source = `
<start>;
Expand Down
123 changes: 46 additions & 77 deletions integrations/deno/melody_wasm.d.ts
Original file line number Diff line number Diff line change
@@ -1,82 +1,51 @@
/* tslint:disable */
/* eslint-disable */
/**
*
*Compiles Melody source code to a regular expression
*
*# Errors
*
*Throws an error if a compilation error is encountered
*
*# Example
*
*```js
*import init, { compiler } from "https://deno.land/x/melody/melody_wasm.js";
*
*await init();
*
*const source = `
* <start>;
*
* option of "v";
*
* capture major {
* some of <digit>;
* }
*
* ".";
*
* capture minor {
* some of <digit>;
* }
*
* ".";
*
* capture patch {
* some of <digit>;
* }
*
* <end>;
*`;
*
*try {
* const output = compiler(source);
* new RegExp(output).test("v1.1.1"); // true
*} catch (error) {
* // handle compilation error
*}
*```
* @param {string} source
* @returns {string}
*/
*
*Compiles Melody source code to a regular expression
*
*# Errors
*
*Throws an error if a compilation error is encountered
*
*# Example
*
*```js
*const source = `
* <start>;
*
* option of "v";
*
* capture major {
* some of <digit>;
* }
*
* ".";
*
* capture minor {
* some of <digit>;
* }
*
* ".";
*
* capture patch {
* some of <digit>;
* }
*
* <end>;
*`;
*
*try {
* const output = compiler(source);
* new RegExp(output).test("v1.1.1"); // true
*} catch (error) {
* // handle compilation error
*}
*```
* @param {string} source
* @returns {string}
*/
export function compiler(source: string): string;

export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly compiler: (a: number, b: number, c: number) => void;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_malloc: (a: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
readonly __wbindgen_free: (a: number, b: number) => void;
}

/**
* Synchronously compiles the given `bytes` and instantiates the WebAssembly module.
*
* @param {BufferSource} bytes
*
* @returns {InitOutput}
*/
export function initSync(bytes: BufferSource): InitOutput;

/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
*
* @returns {Promise<InitOutput>}
*/
export default function init(module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
*/
export function main(): void;
Loading

0 comments on commit 1c84527

Please sign in to comment.