Documentation
¶
Overview ¶
Package parser — build-tag scanning.
ExtractBuildTags reads the leading contiguous comment block of a `.hzn` source file and pulls out any `//hzn:build <expr>` directives. Multiple directives are caller-ANDed (the matcher in `compiler/buildmatrix.go` joins them with `&&`). Scanning stops at the first non-comment, non-blank line — directives after the `package` clause are ignored.
The scanner is intentionally permissive of leading whitespace (a `.hzn` file authored with a stray indent on the directive line still parses) and of non-directive comment lines (doc comments interleaved with directives do not break the scan). The directive prefix is `//hzn:build ` (note the trailing space) — `//hzn:buildx`-style pseudo-directives are skipped.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractBuildTags ¶ added in v0.3.0
ExtractBuildTags returns the list of `//hzn:build <expr>` expressions declared in the leading comment block of source, in source order. Returns an empty slice when no directives are present.
Types ¶
type File ¶
type File struct {
Source SourceFile
Tree *gotreesitter.Tree
Lang *gotreesitter.Language
Package string
}
func ParseSource ¶
func ParseSource(source SourceFile) (*File, error)
type ParseError ¶
type ParseError struct {
Path string
Line int
Column int
EndLine int
EndColumn int
StartByte int
EndByte int
Message string
}
func (*ParseError) Error ¶
func (e *ParseError) Error() string
func (*ParseError) Span ¶
func (e *ParseError) Span() span.Span
type SourceFile ¶
func ReadSource ¶
func ReadSource(path string) (SourceFile, error)