@types/pegjs
- Version 0.10.6
- Published
- 9.11 kB
- No dependencies
- MIT license
Install
npm i @types/pegjsyarn add @types/pegjspnpm add @types/pegjsOverview
TypeScript definitions for pegjs
Index
Variables
Functions
Interfaces
Type Aliases
Namespaces
Variables
variable GrammarError
var GrammarError: any;Functions
function generate
generate: { (grammar: string, options?: ParserBuildOptions): Parser; (grammar: string, options: OutputFormatAmdCommonjs): string; (grammar: string, options: OutputFormatUmd): string; (grammar: string, options: OutputFormatGlobals): string; (grammar: string, options: OutputFormatBare): string;};Returns a generated parser object. It will throw an exception if the grammar is invalid. The exception will contain
messageproperty with more details about the error.Returns the generated source code as a
string. It will throw an exception if the grammar is invalid. The exception will containmessageproperty with more details about the error.
Interfaces
interface BuildOptionsBase
interface BuildOptionsBase {}property allowedStartRules
allowedStartRules?: string[] | undefined;rules the parser will be allowed to start parsing from (default: the first rule in the grammar)
property cache
cache?: boolean | undefined;if
true, makes the parser cache results, avoiding exponential parsing time in pathological cases but making the parser slower (default:false)
property optimize
optimize?: 'speed' | 'size' | undefined;selects between optimizing the generated parser for parsing speed (
"speed") or code size ("size") (default:"speed")
property plugins
plugins?: any[] | undefined;plugins to use
property trace
trace?: boolean | undefined;makes the parser trace its progress (default:
false)
interface ExpectedItem
interface ExpectedItem {}property description
description: string;property type
type: string;property value
value?: string | undefined;interface OutputFormatAmdCommonjs
interface OutputFormatAmdCommonjs extends BuildOptionsBase {}property dependencies
dependencies?: any;parser dependencies, the value is an object which maps variables used to access the dependencies in the parser to module IDs used to load them; valid only when
formatis set to"amd","commonjs", or"umd"(default:{})
property format
format: 'amd' | 'commonjs';format of the genreated parser (
"amd","bare","commonjs","globals", or"umd"); valid only whenoutputis set to"source"(default:"bare")
property output
output: 'source';if set to
"parser", the method will return generated parser object; if set to"source", it will return parser source code as a string (default:"parser")
interface OutputFormatBare
interface OutputFormatBare extends BuildOptionsBase {}property format
format?: 'bare' | undefined;format of the genreated parser (
"amd","bare","commonjs","globals", or"umd"); valid only whenoutputis set to"source"(default:"bare")
property output
output: 'source';if set to
"parser", the method will return generated parser object; if set to"source", it will return parser source code as a string (default:"parser")
interface OutputFormatGlobals
interface OutputFormatGlobals extends BuildOptionsBase {}property exportVar
exportVar?: any;name of a global variable into which the parser object is assigned to when no module loader is detected; valid only when
formatis set to"globals"or"umd"(default:null)
property format
format: 'globals';format of the genreated parser (
"amd","bare","commonjs","globals", or"umd"); valid only whenoutputis set to"source"(default:"bare")
property output
output: 'source';if set to
"parser", the method will return generated parser object; if set to"source", it will return parser source code as a string (default:"parser")
interface OutputFormatUmd
interface OutputFormatUmd extends BuildOptionsBase {}property dependencies
dependencies?: any;parser dependencies, the value is an object which maps variables used to access the dependencies in the parser to module IDs used to load them; valid only when
formatis set to"amd","commonjs", or"umd"(default:{})
property exportVar
exportVar?: any;name of a global variable into which the parser object is assigned to when no module loader is detected; valid only when
formatis set to"globals"or"umd"(default:null)
property format
format: 'umd';format of the genreated parser (
"amd","bare","commonjs","globals", or"umd"); valid only whenoutputis set to"source"(default:"bare")
property output
output: 'source';if set to
"parser", the method will return generated parser object; if set to"source", it will return parser source code as a string (default:"parser")
interface Parser
interface Parser {}property SyntaxError
SyntaxError: any;method parse
parse: (input: string, options?: ParserOptions) => any;interface ParserBuildOptions
interface ParserBuildOptions extends BuildOptionsBase {}property output
output?: 'parser' | undefined;if set to
"parser", the method will return generated parser object; if set to"source", it will return parser source code as a string (default:"parser")
interface ParserOptions
interface ParserOptions {}property startRule
startRule?: string | undefined;property tracer
tracer?: any;index signature
[key: string]: any;Type Aliases
type GrammarError
type GrammarError = PegjsError;type Location
type Location = PEG.Location;type LocationRange
type LocationRange = PEG.LocationRange;Namespaces
namespace parser
namespace parser {}variable SyntaxError
var SyntaxError: any;type SyntaxError
type SyntaxError = PegjsError;namespace PEG
namespace PEG {}function parse
parse: (input: string) => any;class SyntaxError
class SyntaxError {}interface Location
interface Location {}interface LocationRange
interface LocationRange {}Package Files (1)
Dependencies (0)
No dependencies.
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/pegjs.
- Markdown[](https://www.jsdocs.io/package/@types/pegjs)
- HTML<a href="https://www.jsdocs.io/package/@types/pegjs"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4348 ms. - Missing or incorrect documentation? Open an issue for this package.
