Documentation ¶
Overview ¶
Package genprotocol generates the TypeScript codes from Microsoft/language-server-protocol/specification.md markdown.
The "gitlab.com/golang-commonmark/markdown" AST are:
*markdown.HeadingOpen *markdown.Inline *markdown.HeadingClose *markdown.ParagraphOpen *markdown.Inline *markdown.ParagraphClose *markdown.BulletListOpen *markdown.ListItemOpen *markdown.ParagraphOpen *markdown.Inline *markdown.ParagraphClose *markdown.ListItemClose *markdown.BulletListClose *markdown.BlockquoteOpen *markdown.ParagraphOpen *markdown.Inline *markdown.ParagraphClose *markdown.BlockquoteClose *markdown.Fence *markdown.CodeBlock *markdown.OrderedListOpen *markdown.ListItemOpen *markdown.ParagraphOpen *markdown.Inline *markdown.ParagraphClose *markdown.ListItemClose *markdown.OrderedListClose *markdown.TableOpen *markdown.TheadOpen *markdown.TrOpen *markdown.ThOpen *markdown.Inline *markdown.ThClose *markdown.TrClose *markdown.TheadClose *markdown.TbodyOpen *markdown.TrOpen *markdown.TdOpen *markdown.ThClose *markdown.Inline *markdown.TdClose *markdown.TrClose *markdown.TbodyClose *markdown.TableClose *markdown.Hr
Index ¶
- Constants
- Variables
- func ExpandHTML(s string) string
- func Getspecification(uri string) ([]byte, error)
- func SplitComment(comment string) string
- func ToLowerCamelCase(s string) string
- type Parser
- func (p *Parser) Parse(tokens []markdown.Token)
- func (p *Parser) ParseComment(src string)
- func (p *Parser) ParseFence(tok *markdown.Fence)
- func (p *Parser) ParseHeading(tok *markdown.HeadingOpen)
- func (p *Parser) ParseInline(tok *markdown.Inline)
- func (p *Parser) ParseParagraph(tok *markdown.ParagraphOpen)
- type TypeScriptFunc
Constants ¶
const HeaderLevel = 3
HeaderLevel needs headers comment heading level.
const (
// SpecificationMarkdownURI is the Microsoft/language-server-protocol/specification.md markdown uri.
SpecificationMarkdownURI = "https://github.com/Microsoft/language-server-protocol/raw/gh-pages/specification.md"
)
Variables ¶
var CommonInitialisms = map[string]bool{ "ACL": true, "API": true, "ASCII": true, "CPU": true, "CSS": true, "DNS": true, "EOF": true, "GUID": true, "HTML": true, "HTTP": true, "HTTPS": true, "ID": true, "IP": true, "JSON": true, "LHS": true, "QPS": true, "RAM": true, "RHS": true, "RPC": true, "SLA": true, "SMTP": true, "SQL": true, "SSH": true, "TCP": true, "TLS": true, "TTL": true, "UDP": true, "UI": true, "UID": true, "UUID": true, "URI": true, "URL": true, "UTF8": true, "VM": true, "XML": true, "XMPP": true, "XSRF": true, "XSS": true, }
CommonInitialisms is a set of common initialisms. Only add entries that are highly unlikely to be non-initialisms. For instance, "ID" is fine (Freudian code is rare), but "AND" is not.
This code copied from golang.org/x/lint/lint.go
https://github.com/golang/lint/blob/5614ed5bae6fb75893070bdc0996a68765fdd275/lint.go#L768-L810
var IgnoreFences = map[string]bool{ `{ start: { line: 5, character: 23 }, end : { line 6, character : 0 } } `: true, `{ language: 'typescript', scheme: 'file' } { language: 'json', pattern: '**/package.json' } `: true, }
IgnoreFences map of ignore Fences codes map.
var IgnoreHeaders = map[string]bool{ "$ Notifications and Requests": true, "Goto Declaration Request": true, "Goto Definition Request": true, "Goto Type Definition Request": true, "Goto Implementation Request": true, }
IgnoreHeaders ignores header comment map.
var InlineReplacer = strings.NewReplacer(
"`", "",
"\n", " ",
)
InlineReplacer replacer of inline code block.
Functions ¶
func Getspecification ¶
GetSpec gets the specification.md.
func SplitComment ¶
func ToLowerCamelCase ¶
ToLowerCamelCase converts s to LowerCamelCase.
Types ¶
type Parser ¶
type Parser struct { Tokens []markdown.Token TokenPos int PrevToken markdown.Token TypeScriptFuncs []*TypeScriptFunc TypeScriptFuncPos int }
Parser represents a specification markdown parser.
func (*Parser) ParseComment ¶
func (*Parser) ParseFence ¶
ParseFence parses markdown Fence codes.
func (*Parser) ParseHeading ¶
func (p *Parser) ParseHeading(tok *markdown.HeadingOpen)
ParseHeading parses the markdown.Heading.
func (*Parser) ParseInline ¶
ParseInline parses inline markdown text.
func (*Parser) ParseParagraph ¶
func (p *Parser) ParseParagraph(tok *markdown.ParagraphOpen)
ParseParagraph parses markdown Paragraph text.
type TypeScriptFunc ¶
TypeScriptFunc represents a typescript function.