¶fir.generic.parser
A parser that works with the format provided by the generic backend.
You can see an example of parser output here.
¶Helpers
Several functions that aid in the process of parsing.
| Element | Summary |
|---|---|
| Functions | |
| determineSummaryBoundary | Gets the boundary line where a summary ends and the description begins |
| parseDescription | Parses codeblocks, tags, headers and normal text in descriptions. |
| Types | |
| DescriptionLine | A single element in a description returned by parseDescription |
Gets the boundary line where a summary ends and the description begins
- Gets the boundary line where a summary ends and the description begins
Parses codeblocks, tags, headers and normal text in descriptions.
¶Notes
- In a codeblock, the first character of every line is removed (for a space).
¶Supported tags
@internal- Adds aninternaltrue flag to the element.
A single element in a description returned by parseDescription
DescriptionLine {
type :: string (text|snippet|header)
content :: [string]
language? :: string -- only when type is snippet
title? :: string -- only when type is snippet
n? :: number -- only when type is header
}
¶API
This is the API provided to work with the generic parser.
| Element | Summary |
|---|---|
| Functions | |
| parse | Parses a list of GenericComments into a GenericAST |
| Types | |
| GenericAST | The AST produced by parse. |
Parses a list of GenericComments into a GenericAST
- Parses a list of GenericComments into a GenericAST
Aliases: GenericSection, GenericSectionContent, GenericElement
The AST produced by parse.
GenericAST {
title :: string
description :: [DescriptionLine]
[n] :: GenericSection { -- where n is the ID of the section
section :: GenericSectionDetails {
id :: number
name :: string
description :: [DescriptionLine]
}
content :: GenericSectionContent {
[name] :: GenericElement {
is :: string (type|function|constant|class)
description :: [DescriptionLine]
name :: [string] -- an array, meant to also contain aliases
summary :: string
type :: string -- only when `is` is `"function"` or `"constant"`
}
}
}
}