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
type
type:
"bom"
A property to differentiate the different types of whitespace
Defined in
EscLine
An escaped newline
Properties
text
text:
string
The escaped newline
Defined in
type
type:
"line-escape"
A property to differentiate the different types of whitespace
Defined in
InlineWhitespace
Regular plain old whitespace characters
Properties
text
text:
string
The whitespace's text
Defined in
type
type:
"space"
A property to differentiate the different types of whitespace
Defined in
Location
A location in the source text
Properties
column
column:
number
Column in the line
The first character of the line is column number 1.
Defined in
line
line:
number
Line number in the source text
The first line has number 1.
Defined in
offset
offset:
number
Index of this location in the source text
The first character in the source text has offset 0.
Defined in
MultilineComment
A multiline comment
Properties
text
text:
string
The comment text, including the comment tokens themselves
Defined in
type
type:
"multiline"
A property to differentiate the different types of whitespace
Defined in
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
type
type:
"newline"
A property to differentiate the different types of whitespace
Defined in
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
type
type:
"singleline"
A property to differentiate the different types of whitespace
Defined in
SlashDashInDocument
A slashdash comment in a document, i.e. a slashdash commented node
Properties
preface
preface:
NodeSpace
[]
Any whitespace between the slashdash token and the value
Defined in
type
type:
"slashdash"
A property to differentiate the different types of whitespace
Defined in
value
value:
Node
The escaped value
Defined in
SlashDashInNode
A slashdash comment inside a node, i.e. a slashdash commented argument, property, or child block
Properties
preface
preface:
NodeSpace
[]
Any whitespace between the slashdash token and the value
Defined in
type
type:
"slashdash"
A property to differentiate the different types of whitespace
Defined in
value
The escaped value
Defined in
StoredLocation
Stored location of a Document, Entry, Identifier, Node, Tag, or Value.
Properties
end
end:
Location
The location after the last character
Defined in
start
start:
Location
The location of the first character
Defined in
Token
A single token in the KDL text
Properties
end
end:
Location
The location after the last character of this token
Defined in
start
start:
Location
The location of the first character of this token
Defined in
text
text:
string
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)
Defined in
Type Aliases
LineSpace
LineSpace:
BOM
|Newline
|WS
|SingleLineComment
A single plain whitespace item in a document, i.e. before/after/between nodes
Defined in
NodeSpace
NodeSpace:
EscLine
|WS
A single plain whitespace item inside of a node, e.g. between two arguments in a node.
Defined in
Primitive
Primitive<>:
string
|number
|boolean
|null
A primitive is any type that can be represented as an argument or property
Type Parameters
Type Parameter |
---|
Defined in
WhitespaceInDocument
WhitespaceInDocument: (
LineSpace
|SlashDashInDocument
)[]
Whitespace in a document, i.e. before/after/between nodes
Defined in
WhitespaceInNode
WhitespaceInNode: (
NodeSpace
|SlashDashInNode
)[]
Whitespace inside of a node, e.g. between two arguments in a node.
Defined in
Functions
clearFormat()
clearFormat<
T
>(v
):T
Type Parameters
Parameters
Parameter | Type | Description |
---|---|---|
v | T |
Returns
T
Defined in
format()
format(
v
):string
Parameters
Returns
string
Defined in
getLocation()
getLocation(
element
):undefined
|StoredLocation
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
Defined in
parse()
Call Signature
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
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
Defined in
Call Signature
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
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
Defined in
Call Signature
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
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
Defined in
Call Signature
parse(
text
,options
):Node
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
Defined in
Call Signature
parse(
text
,options
):LineSpace
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
Defined in
Call Signature
parse(
text
,options
):NodeSpace
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
Defined in
Call Signature
parse(
text
,options
?):Document
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 |