package d2parser
Import Path
oss.terrastruct.com/d2/d2parser (on go.dev)
Dependency Relation
imports 13 packages, and imported by 5 packages
Involved Source Files
parse.go
Package-Level Type Names (total 2)
TODO: rename to Error and make existing Error a private type errorWithRange
Errors []d2ast.Error
Errors from globs need to be deduplicated
(*ParseError) Empty() bool
(*ParseError) Error() string
*ParseError : error
ParseError *ParseError
UTF16Pos would be used with input received from a browser where the browser will send the text as UTF-8 but
JavaScript keeps strings in memory as UTF-16 and so needs UTF-16 indexes into the text to line up errors correctly.
So you want to read UTF-8 still but adjust the indexes to pretend the input is utf16.
func Parse(path string, r io.Reader, opts *ParseOptions) (*d2ast.Map, error)
Package-Level Functions (total 5)
Parse parses a .d2 Map in r.
The returned Map always represents a valid .d2 file. All encountered errors will be in
[]error.
The map may be compiled via Compile even if there are errors to keep language tooling
operational. Though autoformat should not run.
If UTF16Pos is true, positions will be recorded in UTF-16 codeunits as required by LSP
and browser clients. See
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocuments
TODO: update godocs
func ParseMapKey(mapKey string) (*d2ast.Key, error) func ParseValue(value string) (d2ast.Value, error)![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |