syntax

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Call

func Call(ctx context.Context, method string, params []byte) (result []byte, err error)

Call runs the method named on params, the protojson request body, and returns the response body. A name the package does not serve is refused Unimplemented, and a request that does not decode InvalidArgument.

func Serve

func Serve(ctx context.Context, r io.Reader, w io.Writer) error

Serve answers Content-Length-delimited JSON-RPC frames over r and w until r ends, the same transport the engine serves.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL