gram_parse


gram.js API

Globals / gram-parse

Package: gram-parse

From text literal (a)-->(b) to a gram AST.

How to gram-parse

Install:

npm install @gram-data/gram-parse

Parse text into an AST:

import { toAST } from '@gram-data/gram-parse'; 

const src = '(a)-->(b)';
const parsed = toAST(src);

Inspect AST using unist-util-inspect:

const inspect = require('unist-util-inspect');

console.log(inspect(parsed));

Next Steps

Index

Interfaces

Variables

Functions

Variables

INCOMPLETE_PARSE

Const INCOMPLETE_PARSE: "Incomplete parse." = “Incomplete parse.”

Defined in packages/gram-parse/src/gram-errors.ts:1


SYNTAX_ERROR

Const SYNTAX_ERROR: "Syntax error at" = “Syntax error at”

Defined in packages/gram-parse/src/gram-errors.ts:2

Functions

parse

Constparse(text: string, file: VFile): any

Defined in packages/gram-parse/src/gram-parser-plugin.ts:27

Parameters:

Name Type
text string
file VFile

Returns: any


toAST

ConsttoAST(src: string): GramSeq

Defined in packages/gram-parse/src/index.ts:7

Parameters:

Name Type
src string

Returns: GramSeq