Documentation
¶
Overview ¶
Package parser turns .gwdk source files into syntax trees.
Index ¶
- func ParseComponent(source []byte) (manifest.Component, error)
- func ParseLayout(source []byte) (manifest.Layout, error)
- func ParsePage(source []byte) (manifest.Page, error)
- type APIStatement
- type ActionStatement
- type BuildCall
- type LiteralRecord
- type SyntaxAnnotation
- type SyntaxBlock
- type SyntaxFile
- type SyntaxImport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseComponent ¶
ParseComponent extracts component metadata and top-level block declarations.
func ParseLayout ¶
ParseLayout extracts layout 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.