parser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package parser turns .gwdk source files into syntax trees.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseComponent

func ParseComponent(source []byte) (manifest.Component, error)

ParseComponent extracts component metadata and top-level block declarations.

func ParseLayout

func ParseLayout(source []byte) (manifest.Layout, error)

ParseLayout extracts layout metadata and top-level block declarations.

func ParsePage

func ParsePage(source []byte) (manifest.Page, error)

ParsePage extracts page metadata and top-level block declarations.

Types

type APIStatement

type APIStatement struct {
	Method string
	Route  string
	Span   manifest.SourceSpan
}

APIStatement is one supported statement inside api {}.

type ActionStatement

type ActionStatement struct {
	Kind      string
	Name      string
	InputName string
	InputType string
	Target    string
	Redirect  string
	Body      string
	Span      manifest.SourceSpan
}

ActionStatement is one supported statement inside act {}.

type BuildCall

type BuildCall struct {
	Alias    string
	Function string
	Span     manifest.SourceSpan
}

BuildCall is a first-slice imported build data function call.

type LiteralRecord

type LiteralRecord struct {
	Fields map[string]string
	Span   manifest.SourceSpan
}

LiteralRecord is a first-slice paths/build return record.

type SyntaxAnnotation

type SyntaxAnnotation struct {
	Name  string
	Value string
	Span  manifest.SourceSpan
}

SyntaxAnnotation is one top-level @annotation.

type SyntaxBlock

type SyntaxBlock struct {
	Kind    string
	Name    string
	Body    string
	Span    manifest.SourceSpan
	View    []view.Node
	Records []LiteralRecord
	Call    *BuildCall
	Actions []ActionStatement
	APIs    []APIStatement
}

SyntaxBlock is one parsed top-level block.

type SyntaxFile

type SyntaxFile struct {
	Annotations []SyntaxAnnotation
	Imports     []SyntaxImport
	Blocks      []SyntaxBlock
}

SyntaxFile is the typed AST for the currently supported .gwdk syntax subset.

func ParseSyntax

func ParseSyntax(source []byte) (SyntaxFile, error)

ParseSyntax parses a .gwdk source file into a typed syntax AST for the current compiler subset.

type SyntaxImport

type SyntaxImport struct {
	Alias string
	Path  string
	Span  manifest.SourceSpan
}

SyntaxImport is one top-level Go import declaration.

Jump to

Keyboard shortcuts

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