context
pyvider.hcl.parser.context
¶
HCL parsing with enhanced error context.
Classes¶
Functions¶
parse_with_context
¶
Parse HCL content with enhanced error context.
This function parses HCL content and provides rich error context if parsing fails. It returns the raw parsed data (dict/list), not CTY values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
str
|
HCL content string to parse |
required |
source_file
|
Path | None
|
Optional source file path for error reporting |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
Raw parsed data (typically dict or list) |
Raises:
| Type | Description |
|---|---|
HclParsingError
|
If parsing fails, with source location information |
Example
content = 'name = "example"' data = parse_with_context(content) data['name'] 'example'