index
Classes
Interfaces
BOM
Defined in: src/model/whitespace.d.ts:8
A Byte-Order Mark at the start of a document
Properties
text
text:
string
Defined in: src/model/whitespace.d.ts:17
The BOM text, i.e. '\ufeff'.
type
type:
"bom"
Defined in: src/model/whitespace.d.ts:12
A property to differentiate the different types of whitespace
EscLine
Defined in: src/model/whitespace.d.ts:55
An escaped newline
Properties
text
text:
string
Defined in: src/model/whitespace.d.ts:64
The escaped newline
type
type:
"line-escape"
Defined in: src/model/whitespace.d.ts:59
A property to differentiate the different types of whitespace
InlineWhitespace
Defined in: src/model/whitespace.d.ts:23
Regular plain old whitespace characters
Properties
text
text:
string
Defined in: src/model/whitespace.d.ts:32
The whitespace's text
type
type:
"space"
Defined in: src/model/whitespace.d.ts:27
A property to differentiate the different types of whitespace
Location
Defined in: src/parser/token.d.ts:6
A location in the source text
Properties
column
column:
number
Defined in: src/parser/token.d.ts:24
Column in the line
The first character of the line is column number 1.
line
line:
number
Defined in: src/parser/token.d.ts:18
Line number in the source text
The first line has number 1.
offset
offset:
number
Defined in: src/parser/token.d.ts:12
Index of this location in the source text
The first character in the source text has offset 0.
MultilineComment
Defined in: src/model/whitespace.d.ts:70
A multiline comment
Properties
text
text:
string
Defined in: src/model/whitespace.d.ts:79
The comment text, including the comment tokens themselves
type
type:
"multiline"
Defined in: src/model/whitespace.d.ts:74
A property to differentiate the different types of whitespace
Newline
Defined in: src/model/whitespace.d.ts:40
A single newline
Note a newline can consist of multiple characters: \r\n is a single newline.
Properties
text
text:
string
Defined in: src/model/whitespace.d.ts:49
The newline
type
type:
"newline"
Defined in: src/model/whitespace.d.ts:44
A property to differentiate the different types of whitespace
SingleLineComment
Defined in: src/model/whitespace.d.ts:85
A single-line comment
Properties
text
text:
string
Defined in: src/model/whitespace.d.ts:94
The comment's text, starting at the // and ending with a newline unless the comment ended at the end of the file
type
type:
"singleline"
Defined in: src/model/whitespace.d.ts:89
A property to differentiate the different types of whitespace
SlashDashInDocument
Defined in: src/model/whitespace.d.ts:137
A slashdash comment in a document, i.e. a slashdash commented node
Properties
preface
preface:
NodeSpace[]
Defined in: src/model/whitespace.d.ts:146
Any whitespace between the slashdash token and the value
type
type:
"slashdash"
Defined in: src/model/whitespace.d.ts:141
A property to differentiate the different types of whitespace
value
value:
Node
Defined in: src/model/whitespace.d.ts:151
The escaped value
SlashDashInNode
Defined in: src/model/whitespace.d.ts:112
A slashdash comment inside a node, i.e. a slashdash commented argument, property, or child block
Properties
preface
preface:
NodeSpace[]
Defined in: src/model/whitespace.d.ts:121
Any whitespace between the slashdash token and the value
type
type:
"slashdash"
Defined in: src/model/whitespace.d.ts:116
A property to differentiate the different types of whitespace
value
Defined in: src/model/whitespace.d.ts:126
The escaped value
StoredLocation
Defined in: src/locations.js:5
Stored location of a Document, Entry, Identifier, Node, Tag, or Value.
Properties
end
end:
Location
Defined in: src/locations.js:9
The location after the last character
start
start:
Location
Defined in: src/locations.js:8
The location of the first character
Token
Defined in: src/parser/token.d.ts:30
A single token in the KDL text
Properties
end
end:
Location
Defined in: src/parser/token.d.ts:60
The location after the last character of this token
start
start:
Location
Defined in: src/parser/token.d.ts:55
The location of the first character of this token
text
text:
string
Defined in: src/parser/token.d.ts:50
The text of this token
This could be computed if you have access to the source text using
sourceText.slice(token.start.offset, token.end.offset)
Type Aliases
LineSpace
LineSpace:
BOM|Newline|WS|SingleLineComment
Defined in: src/model/whitespace.d.ts:107
A single plain whitespace item in a document, i.e. before/after/between nodes
NodeSpace
NodeSpace:
EscLine|WS
Defined in: src/model/whitespace.d.ts:102
A single plain whitespace item inside of a node, e.g. between two arguments in a node.
Primitive
Primitive<>:
string|number|boolean|null
Defined in: src/model/value.js:4
A primitive is any type that can be represented as an argument or property
Type Parameters
| Type Parameter |
|---|
WhitespaceInDocument
WhitespaceInDocument: (
LineSpace|SlashDashInDocument)[]
Defined in: src/model/whitespace.d.ts:157
Whitespace in a document, i.e. before/after/between nodes
WhitespaceInNode
WhitespaceInNode: (
NodeSpace|SlashDashInNode)[]
Defined in: src/model/whitespace.d.ts:132
Whitespace inside of a node, e.g. between two arguments in a node.
Functions
clearFormat()
clearFormat<
T>(v):T
Defined in: src/clear-format.js:123
Type Parameters
Parameters
| Parameter | Type | Description |
|---|---|---|
v | T |
Returns
T
format()
format(
v):string
Defined in: src/format.js:201
Parameters
Returns
string
getLocation()
getLocation(
element):undefined|StoredLocation
Defined in: src/locations.js:26
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
Returns
undefined | StoredLocation
parse()
Call Signature
parse(
text,options):Value
Defined in: src/parse.d.ts:23
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
| Parameter | Type |
|---|---|
text | string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array |
options | { as: "value"; graphemeLocations: boolean; storeLocations: boolean; } |
options.as | "value" |
options.graphemeLocations? | boolean |
options.storeLocations? | boolean |
Returns
Call Signature
parse(
text,options):Identifier
Defined in: src/parse.d.ts:46
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
| Parameter | Type |
|---|---|
text | string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array |
options | { as: "identifier"; graphemeLocations: boolean; storeLocations: boolean; } |
options.as | "identifier" |
options.graphemeLocations? | boolean |
options.storeLocations? | boolean |
Returns
Call Signature
parse(
text,options):Entry
Defined in: src/parse.d.ts:69
Parse the given text as an entry.
The text can contain extra whitespace, tags, and comments (though no slashdash comments of entire nodes)
Parameters
| Parameter | Type |
|---|---|
text | string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array |
options | { as: "entry"; graphemeLocations: boolean; storeLocations: boolean; } |
options.as | "entry" |
options.graphemeLocations? | boolean |
options.storeLocations? | boolean |
Returns
Call Signature
parse(
text,options):Node
Defined in: src/parse.d.ts:91
Parse the given text as a node.
The text can contain extra whitespace, tags, and comments.
Parameters
| Parameter | Type |
|---|---|
text | string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array |
options | { as: "node"; graphemeLocations: boolean; storeLocations: boolean; } |
options.as | "node" |
options.graphemeLocations? | boolean |
options.storeLocations? | boolean |
Returns
Call Signature
parse(
text,options):LineSpace
Defined in: src/parse.d.ts:111
Parse the given text as a whitespace in a document.
Parameters
| Parameter | Type |
|---|---|
text | string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array |
options | { as: "whitespace in document"; graphemeLocations: boolean; storeLocations: boolean; } |
options.as | "whitespace in document" |
options.graphemeLocations? | boolean |
options.storeLocations? | boolean |
Returns
Call Signature
parse(
text,options):NodeSpace
Defined in: src/parse.d.ts:131
Parse the given text as a whitespace in a node.
Parameters
| Parameter | Type |
|---|---|
text | string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array |
options | { as: "whitespace in node"; graphemeLocations: boolean; storeLocations: boolean; } |
options.as | "whitespace in node" |
options.graphemeLocations? | boolean |
options.storeLocations? | boolean |
Returns
Call Signature
parse(
text,options?):Document
Defined in: src/parse.d.ts:153
Parse the given text as a document.
The text can contain extra whitespace, tags, and comments.
Parameters
| Parameter | Type |
|---|---|
text | string | ArrayBuffer | DataView | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array |
options? | { as: "document"; graphemeLocations: boolean; storeLocations: boolean; } |
options.as? | "document" |
options.graphemeLocations? | boolean |
options.storeLocations? | boolean |