structured

package
v0.0.4-beta.12 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 2 Imported by: 0

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

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

type ParseResult struct {
	FilePath string
	Entities []*Entity
}

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.

Jump to

Keyboard shortcuts

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