Documentation
¶
Overview ¶
Package structured implements lightweight regex-based parsers for structured data formats: JSON, XML, YAML, TOML, and HCL (Terraform). No tree-sitter dependency — pure Go string/regex extraction.
Index ¶
- type Entity
- type ParseResult
- func ParseHCL(filePath string, content string) *ParseResult
- func ParseJSON(filePath string, content string) *ParseResult
- func ParseProperties(filePath string, content string) *ParseResult
- func ParseTOML(filePath string, content string) *ParseResult
- func ParseXML(filePath string, content string) *ParseResult
- func ParseYAML(filePath string, content string) *ParseResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entity ¶
type Entity struct {
Name string
Type string // "key", "object", "array", "element", "attribute", "section", "block", "variable", "output", "resource", "data", "module"
Kind string
Signature string
StartLine int
EndLine int
Parent string
}
Entity represents a named element extracted from a structured file.
type ParseResult ¶
ParseResult is the output of Parse.
func ParseHCL ¶
func ParseHCL(filePath string, content string) *ParseResult
ParseHCL extracts resource, data, variable, output, module, and locals blocks from HCL / Terraform content.
func ParseJSON ¶
func ParseJSON(filePath string, content string) *ParseResult
ParseJSON extracts top-level keys from JSON content.
func ParseProperties ¶
func ParseProperties(filePath string, content string) *ParseResult
ParseProperties extracts key names from Java .properties files.
func ParseTOML ¶
func ParseTOML(filePath string, content string) *ParseResult
ParseTOML extracts sections and top-level keys from TOML content.
func ParseXML ¶
func ParseXML(filePath string, content string) *ParseResult
ParseXML extracts element and attribute names from XML content.
func ParseYAML ¶
func ParseYAML(filePath string, content string) *ParseResult
ParseYAML extracts top-level and second-level keys from YAML content.