index

Index

Classes

Interfaces

BOM

A Byte-Order Mark at the start of a document

Properties

text

text: string

The BOM text, i.e. '\ufeff'.

Defined in

src/model/whitespace.d.ts:17


type

type: "bom"

A property to differentiate the different types of whitespace

Defined in

src/model/whitespace.d.ts:12


EscLine

An escaped newline

Properties

text

text: string

The escaped newline

Defined in

src/model/whitespace.d.ts:64


type

type: "line-escape"

A property to differentiate the different types of whitespace

Defined in

src/model/whitespace.d.ts:59


InlineWhitespace

Regular plain old whitespace characters

Properties

text

text: string

The whitespace's text

Defined in

src/model/whitespace.d.ts:32


type

type: "space"

A property to differentiate the different types of whitespace

Defined in

src/model/whitespace.d.ts:27


LineSpaceSlashDash

A slashdash comment in a document, i.e. a slashdash commented node

Properties

preface

preface: PlainNodeSpace[]

Any whitespace between the slashdash token and the value

Defined in

src/model/whitespace.d.ts:149


type

type: "slashdash"

A property to differentiate the different types of whitespace

Defined in

src/model/whitespace.d.ts:144


value

value: Node

The escaped value

Defined in

src/model/whitespace.d.ts:154


Location

Location inside source text

Properties

endColumn

endColumn: number

Column of the last character of the Token. 1-indexed.

Defined in

src/locations.js:10


endLine

endLine: number

Line of the last character. 1-indexed.

Defined in

src/locations.js:9


endOffset

endOffset: number

Offset behind the last character. 0-indexed.

Defined in

src/locations.js:8


startColumn

startColumn: number

Column of the first character of the Token. 1-indexed.

Defined in

src/locations.js:7


startLine

startLine: number

Line of the first character. 1-indexed.

Defined in

src/locations.js:6


startOffset

startOffset: number

Offset of the first character. 0-indexed.

Defined in

src/locations.js:5


MultilineComment

A multiline comment

Properties

text

text: string

The comment text, including the comment tokens themselves

Defined in

src/model/whitespace.d.ts:79


type

type: "multiline"

A property to differentiate the different types of whitespace

Defined in

src/model/whitespace.d.ts:74


Newline

A single newline

Note a newline can consist of multiple characters: \r\n is a single newline.

Properties

text

text: string

The newline

Defined in

src/model/whitespace.d.ts:49


type

type: "newline"

A property to differentiate the different types of whitespace

Defined in

src/model/whitespace.d.ts:44


NodeSpaceSlashDash

A slashdash comment inside a node, i.e. a slashdash commented argument, property, or child block

Properties

preface

preface: PlainNodeSpace[]

Any whitespace between the slashdash token and the value

Defined in

src/model/whitespace.d.ts:114


type

type: "slashdash"

A property to differentiate the different types of whitespace

Defined in

src/model/whitespace.d.ts:109


value

value: Entry | Document

The escaped value

Defined in

src/model/whitespace.d.ts:119


SingleLineComment

A single-line comment

Properties

text

text: string

The comment's text, starting at the // and ending with a newline unless the comment ended at the end of the file

Defined in

src/model/whitespace.d.ts:94


type

type: "singleline"

A property to differentiate the different types of whitespace

Defined in

src/model/whitespace.d.ts:89

Type Aliases

LineSpace

LineSpace: (PlainLineSpace | LineSpaceSlashDash)[]

Whitespace in a document, i.e. before/after/between nodes

Defined in

src/model/whitespace.d.ts:160


NodeSpace

NodeSpace: (PlainNodeSpace | NodeSpaceSlashDash)[]

Whitespace inside of a node, e.g. between two arguments in a node.

Defined in

src/model/whitespace.d.ts:125


PlainLineSpace

PlainLineSpace: BOM | InlineWhitespace | Newline | SingleLineComment | MultilineComment

A single plain whitespace item in a document, i.e. before/after/between nodes

Defined in

src/model/whitespace.d.ts:130


PlainNodeSpace

PlainNodeSpace: InlineWhitespace | EscLine | MultilineComment

A single plain whitespace item inside of a node, e.g. between two arguments in a node.

Defined in

src/model/whitespace.d.ts:100

Functions

clearFormat()

clearFormat<T>(v): T

Type Parameters

T extends Identifier | Tag | Value | Entry | Node | Document

Parameters

v: T

Returns

T

Defined in

src/clear-format.js:122


format()

format(v): string

Parameters

v: Identifier | Tag | Value | Entry | Node | Document

Returns

string

Defined in

src/format.js:149


getLocation()

getLocation(element): undefined | Location

Get location information of the given parsed element

If the element was not created by the parser, or if the parser option storeLocations was not set to true, the result will be undefined.

Parameters

element: Identifier | Tag | Value | Entry | Node | Document

Returns

undefined | Location

Defined in

src/locations.js:27


parse()

parse(text, options)

parse(text, options): Value

Parse the given text as a value.

The text should not contain anything other than the value, i.e. no leading or trailing whitespace, no comments, no tags.

Parameters

text: string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array

options

options.as: "value"

options.graphemeLocations?: boolean

options.storeLocations?: boolean

Returns

Value

Defined in

src/parse.d.ts:23

parse(text, options)

parse(text, options): Identifier

Parse the given text as a identifier.

The text should not contain anything other than the identifier, i.e. no leading or trailing whitespace, no comments, no tags.

Parameters

text: string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array

options

options.as: "identifier"

options.graphemeLocations?: boolean

options.storeLocations?: boolean

Returns

Identifier

Defined in

src/parse.d.ts:46

parse(text, options)

parse(text, options): Entry

Parse the given text as an entry.

The text can contain extra whitespace, tags, and comments (though no slashdash comments of entire nodes)

Parameters

text: string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array

options

options.as: "entry"

options.graphemeLocations?: boolean

options.storeLocations?: boolean

Returns

Entry

Defined in

src/parse.d.ts:69

parse(text, options)

parse(text, options): Node

Parse the given text as a node.

The text can contain extra whitespace, tags, and comments.

Parameters

text: string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array

options

options.as: "node"

options.graphemeLocations?: boolean

options.storeLocations?: boolean

Returns

Node

Defined in

src/parse.d.ts:91

parse(text, options)

parse(text, options): LineSpace

Parse the given text as a whitespace in a document.

Parameters

text: string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array

options

options.as: "whitespace in document"

options.graphemeLocations?: boolean

options.storeLocations?: boolean

Returns

LineSpace

Defined in

src/parse.d.ts:107

parse(text, options)

parse(text, options): NodeSpace

Parse the given text as a whitespace in a node.

Parameters

text: string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array

options

options.as: "whitespace in node"

options.graphemeLocations?: boolean

options.storeLocations?: boolean

Returns

NodeSpace

Defined in

src/parse.d.ts:127

parse(text, options)

parse(text, options?): Document

Parse the given text as a document.

The text can contain extra whitespace, tags, and comments.

Parameters

text: string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array

options?

options.as?: "document"

options.graphemeLocations?: boolean

options.storeLocations?: boolean

Returns

Document

Defined in

src/parse.d.ts:149