Documentation
¶
Overview ¶
Package syntax serves the purely syntactic RPCs a WebAssembly build can answer without a symbol table or a standard library: parsing content for its syntax diagnostics, reformatting it, and classifying its lexical tokens. It is stateless — a call carries everything it needs — and its diagnostic shape is the protojson Diagnostic the gRPC service answers with.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Diagnostic ¶
type Diagnostic struct {
Severity string `json:"severity,omitempty"`
Message string `json:"message,omitempty"`
Span *Span `json:"span,omitempty"`
Code string `json:"code,omitempty"`
}
Diagnostic is the Diagnostic message: severity, message, code and the span it was located at, under the protojson field names.
func FromDiag ¶
func FromDiag(d diag.Diagnostic, sf *source.SourceFile) *Diagnostic
FromDiag converts a diag.Diagnostic to the Diagnostic message.
func ParserDiagnostic ¶
func ParserDiagnostic(d parser.Diagnostic, sf *source.SourceFile) *Diagnostic
ParserDiagnostic converts a parser error to the Diagnostic message.
type Span ¶
type Span struct {
File string `json:"file,omitempty"`
StartLine int32 `json:"startLine,omitempty"`
StartCol int32 `json:"startCol,omitempty"`
EndLine int32 `json:"endLine,omitempty"`
EndCol int32 `json:"endCol,omitempty"`
}
Span is the Span message: the file and its start and end line/column.