Syntaxes
Built-in syntaxes, the base class for custom syntaxes, and the syntax factory. See Syntaxes for wire formats and usage.
hother.streamblocks.syntaxes.base
Base syntax class and utilities for StreamBlocks syntax implementations.
BaseSyntax
Bases: ABC
Abstract base class for syntax implementations.
This class provides default implementations and helper methods to reduce code duplication across syntax implementations. It implements the BlockSyntax protocol and provides a template method pattern for parsing blocks.
Custom syntax implementations should: 1. Inherit from this class 2. Implement the abstract methods marked with @abstractmethod 3. Optionally override validate_block() for custom validation
Example
class MySyntax(BaseSyntax): ... def detect_line(self, line: str, candidate: BlockCandidate | None) -> DetectionResult: ... # Implementation here ... pass ... ... def should_accumulate_metadata(self, candidate: BlockCandidate) -> bool: ... # Implementation here ... pass ... ... def extract_block_type(self, candidate: BlockCandidate) -> str | None: ... # Implementation here ... pass ... ... def parse_block(self, candidate: BlockCandidate, block_class: type[Any] | None = None) -> ParseResult[BaseMetadata, BaseContent]: ... # Implementation here ... pass
Source code in src/hother/streamblocks/syntaxes/base.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | |
describe_format
describe_format() -> str
Return a human-readable description of this syntax's block format.
Used in generated prompts to teach the model the block format. The default returns a minimal description; shipped syntaxes override it with a concrete format specification.
Returns:
| Type | Description |
|---|---|
str
|
A description of the block format for this syntax |
Source code in src/hother/streamblocks/syntaxes/base.py
detect_line
abstractmethod
detect_line(
line: str, candidate: BlockCandidate | None
) -> DetectionResult
Detect if line is significant for this syntax.
This method is called for each line in the stream to determine if it's an opening marker, closing marker, metadata boundary, or regular content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
str
|
Current line to check |
required |
candidate
|
BlockCandidate | None
|
Current candidate if we're inside a block, None if searching |
required |
Returns:
| Type | Description |
|---|---|
DetectionResult
|
DetectionResult indicating what was detected |
Source code in src/hother/streamblocks/syntaxes/base.py
extract_block_type
abstractmethod
extract_block_type(candidate: BlockCandidate) -> str | None
Extract block_type from candidate without full parsing.
This method performs minimal parsing to extract just the block_type, which is needed to look up the appropriate block_class from the registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidate
|
BlockCandidate
|
The block candidate to extract block_type from |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The block_type string, or None if it cannot be determined |
Source code in src/hother/streamblocks/syntaxes/base.py
parse_block
abstractmethod
parse_block(
candidate: BlockCandidate,
block_class: type[Any] | None = None,
) -> ParseResult[BaseMetadata, BaseContent]
Parse a complete block candidate using the specified block class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidate
|
BlockCandidate
|
The complete block candidate to parse |
required |
block_class
|
type[Any] | None
|
The Block class to use for parsing (inherits from Block[M, C]) If None, uses default base classes |
None
|
Returns:
| Type | Description |
|---|---|
ParseResult[BaseMetadata, BaseContent]
|
ParseResult with parsed metadata and content or error |
Source code in src/hother/streamblocks/syntaxes/base.py
parse_content_early
parse_content_early(
candidate: BlockCandidate,
) -> dict[str, Any] | None
Parse content section early, before final block extraction.
This method is called when the content section completes (block closes), allowing early validation. The result can be cached in the candidate for reuse during full block parsing.
Default implementation returns None (no early parsing). Override in subclasses to provide early content parsing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidate
|
BlockCandidate
|
The complete block candidate with content accumulated |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
Parsed content dict if successful, None if parsing not supported |
dict[str, Any] | None
|
or failed |
Source code in src/hother/streamblocks/syntaxes/base.py
parse_metadata_early
parse_metadata_early(
candidate: BlockCandidate,
) -> dict[str, Any] | None
Parse metadata section early, before content accumulation.
This method is called when the metadata section completes, allowing early validation and processing. The result can be cached in the candidate for reuse during full block parsing.
Default implementation returns None (no early parsing). Override in subclasses to provide early metadata parsing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidate
|
BlockCandidate
|
The current block candidate with metadata accumulated |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
Parsed metadata dict if successful, None if parsing not supported |
dict[str, Any] | None
|
or failed |
Source code in src/hother/streamblocks/syntaxes/base.py
serialize_block
serialize_block(
block: Block[BaseMetadata, BaseContent],
) -> str
Serialize a block instance back to this syntax's textual form.
Used by prompt generation to render examples in the exact format the model is expected to produce. The shipped syntaxes override this. Custom syntaxes that want example rendering in prompts should override it as well.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
Block[BaseMetadata, BaseContent]
|
Block instance to serialize |
required |
Returns:
| Type | Description |
|---|---|
str
|
The block rendered in this syntax's text format |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the concrete syntax does not implement it |
Source code in src/hother/streamblocks/syntaxes/base.py
should_accumulate_metadata
abstractmethod
should_accumulate_metadata(
candidate: BlockCandidate,
) -> bool
Check if syntax expects more metadata lines.
This method determines whether the processor should continue accumulating metadata lines or move to content accumulation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidate
|
BlockCandidate
|
The current block candidate |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if more metadata lines are expected, False otherwise |
Source code in src/hother/streamblocks/syntaxes/base.py
validate_block
validate_block(
_block: ExtractedBlock[BaseMetadata, BaseContent],
) -> bool
Additional validation after parsing.
Default implementation always returns True. Override this method to add custom validation logic specific to your syntax or block type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
_block
|
ExtractedBlock[BaseMetadata, BaseContent]
|
Extracted block to validate |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the block is valid, False otherwise |
Source code in src/hother/streamblocks/syntaxes/base.py
YAMLFrontmatterMixin
Mixin providing YAML frontmatter parsing utilities.
This mixin reduces code duplication in syntaxes that use YAML for metadata. It provides two parsing methods: - _parse_yaml_metadata: Silent failure, returns None on error - _parse_yaml_metadata_strict: Returns exception for error handling
Example
class MySyntax(BaseSyntax, YAMLFrontmatterMixin): ... def extract_block_type(self, candidate): ... metadata = self._parse_yaml_metadata(candidate.metadata_lines) ... return metadata.get("block_type") if metadata else None
Source code in src/hother/streamblocks/syntaxes/base.py
hother.streamblocks.syntaxes.delimiter
Delimiter-based syntax implementations.
ContentParser
Bases: Protocol
Protocol for content classes with a parse method.
Source code in src/hother/streamblocks/syntaxes/delimiter.py
DelimiterFrontmatterSyntax
Bases: BaseSyntax, YAMLFrontmatterMixin
This syntax uses simple delimiter markers with YAML frontmatter for metadata. The frontmatter section is delimited by --- markers and must be valid YAML.
Format
!!start
id: block_001 block_type: example custom_field: value
Content lines here !!end
The YAML frontmatter should include
- id: Block identifier (required if using BaseMetadata)
- block_type: Block type (required if using BaseMetadata)
- Any additional custom fields defined in your metadata class
Examples:
>>> # Simple block with minimal metadata
>>> '''
... !!start
... ---
... id: msg001
... block_type: message
... ---
... Hello, world!
... !!end
... '''
>>>
>>> # Block with nested YAML metadata
>>> '''
... !!start
... ---
... id: task001
... block_type: task
... priority: high
... tags:
... - urgent
... - backend
... ---
... Implement user authentication
... !!end
... '''
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_delimiter
|
str
|
Opening delimiter string (default: "!!start") |
'!!start'
|
end_delimiter
|
str
|
Closing delimiter string (default: "!!end") |
'!!end'
|
Source code in src/hother/streamblocks/syntaxes/delimiter.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | |
describe_format
describe_format() -> str
Describe the delimiter frontmatter format for prompts.
Source code in src/hother/streamblocks/syntaxes/delimiter.py
detect_line
detect_line(
line: str, candidate: BlockCandidate | None = None
) -> DetectionResult
Detect delimiter markers and frontmatter boundaries.
Source code in src/hother/streamblocks/syntaxes/delimiter.py
extract_block_type
extract_block_type(candidate: BlockCandidate) -> str | None
Extract block_type from YAML frontmatter.
Source code in src/hother/streamblocks/syntaxes/delimiter.py
parse_block
parse_block(
candidate: BlockCandidate,
block_class: type[Any] | None = None,
) -> ParseResult[BaseMetadata, BaseContent]
Parse the complete block using the specified block class.
Source code in src/hother/streamblocks/syntaxes/delimiter.py
parse_content_early
parse_content_early(
candidate: BlockCandidate,
) -> dict[str, Any] | None
Parse content section early.
Returns raw content dict with the content text.
Source code in src/hother/streamblocks/syntaxes/delimiter.py
parse_metadata_early
parse_metadata_early(
candidate: BlockCandidate,
) -> dict[str, Any] | None
Parse YAML metadata section early.
Returns parsed YAML frontmatter as a dict.
Source code in src/hother/streamblocks/syntaxes/delimiter.py
serialize_block
serialize_block(
block: Block[BaseMetadata, BaseContent],
) -> str
Serialize a block to delimiter frontmatter format.
Produces the round-trip form of this syntax::
!!start
---
<yaml metadata>
---
<raw content>
!!end
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
Block[BaseMetadata, BaseContent]
|
Block instance to serialize |
required |
Returns:
| Type | Description |
|---|---|
str
|
The block rendered in delimiter frontmatter format |
Source code in src/hother/streamblocks/syntaxes/delimiter.py
should_accumulate_metadata
should_accumulate_metadata(
candidate: BlockCandidate,
) -> bool
Check if we're still in metadata section.
validate_block
validate_block(
_block: ExtractedBlock[BaseMetadata, BaseContent],
) -> bool
DelimiterPreambleSyntax
Bases: BaseSyntax
This syntax uses delimiter markers with inline metadata in the opening line. Metadata is extracted from the delimiter preamble, and all lines between opening and closing delimiters become the content.
Format
!!
The opening delimiter must include
- Block ID (alphanumeric, required)
- Block type (alphanumeric, required)
- Additional parameters (optional, colon-separated)
Additional parameters are stored as param_0, param_1, etc. in metadata.
Examples:
>>> # Simple block with just ID and type
>>> '''
... !!patch001:patch
... Fix the login bug
... !!end
... '''
>>>
>>> # Block with parameters
>>> '''
... !!file123:operation:create:urgent
... Create new config file
... !!end
... '''
>>> # Metadata will be: {
>>> # "id": "file123",
>>> # "block_type": "operation",
>>> # "param_0": "create",
>>> # "param_1": "urgent"
>>> # }
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
delimiter
|
str
|
Opening delimiter string (default: "!!") |
'!!'
|
Source code in src/hother/streamblocks/syntaxes/delimiter.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
describe_format
describe_format() -> str
Describe the delimiter preamble format for prompts.
Source code in src/hother/streamblocks/syntaxes/delimiter.py
detect_line
detect_line(
line: str, candidate: BlockCandidate | None = None
) -> DetectionResult
Detect delimiter-based markers.
Source code in src/hother/streamblocks/syntaxes/delimiter.py
extract_block_type
extract_block_type(candidate: BlockCandidate) -> str | None
Extract block_type from opening line.
Source code in src/hother/streamblocks/syntaxes/delimiter.py
parse_block
parse_block(
candidate: BlockCandidate,
block_class: type[Any] | None = None,
) -> ParseResult[BaseMetadata, BaseContent]
Parse the complete block using the specified block class.
Source code in src/hother/streamblocks/syntaxes/delimiter.py
parse_content_early
parse_content_early(
candidate: BlockCandidate,
) -> dict[str, Any] | None
Parse content section early.
Returns raw content dict with the content text.
Source code in src/hother/streamblocks/syntaxes/delimiter.py
parse_metadata_early
parse_metadata_early(
candidate: BlockCandidate,
) -> dict[str, Any] | None
Parse metadata from inline preamble.
For this syntax, metadata is extracted from the opening line (e.g., !!id:type:param1:param2).
Source code in src/hother/streamblocks/syntaxes/delimiter.py
serialize_block
serialize_block(
block: Block[BaseMetadata, BaseContent],
) -> str
Serialize a block to delimiter preamble format.
Produces the round-trip form of this syntax::
!!<id>:<type>[:<param_0>:<param_1>...]
<raw content>
!!end
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
Block[BaseMetadata, BaseContent]
|
Block instance to serialize |
required |
Returns:
| Type | Description |
|---|---|
str
|
The block rendered in delimiter preamble format |
Source code in src/hother/streamblocks/syntaxes/delimiter.py
should_accumulate_metadata
should_accumulate_metadata(
candidate: BlockCandidate,
) -> bool
validate_block
validate_block(
_block: ExtractedBlock[BaseMetadata, BaseContent],
) -> bool
hother.streamblocks.syntaxes.markdown
Markdown-based syntax implementations.
MarkdownFrontmatterSyntax
Bases: BaseSyntax, YAMLFrontmatterMixin
This syntax uses Markdown-style fenced code blocks with optional YAML frontmatter for metadata. The info_string after the opening fence can be used as a fallback block_type when no frontmatter is present.
Format
```[info_string]
id: block_001 block_type: example custom_field: value
Content lines here ```
The info_string is optional. When provided, it's used as the block_type if no YAML frontmatter is present. The YAML frontmatter is also optional - if omitted, all content becomes the block content.
Examples:
>>> # Block with frontmatter
>>> '''
... ```python
... ---
... id: code001
... block_type: code
... language: python
... ---
... def hello():
... print("Hello, world!")
... ```
... '''
>>>
>>> # Block without frontmatter (info_string becomes block_type)
>>> '''
... ```patch
... diff --git a/file.py b/file.py
... - old line
... + new line
... ```
... '''
>>> # block_type will be "patch" from info_string
>>>
>>> # Block with nested YAML
>>> '''
... ```task
... ---
... id: task001
... block_type: task
... assignees:
... - alice
... - bob
... ---
... Implement user authentication
... ```
... '''
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fence
|
str
|
Fence string (default: "```") |
'```'
|
info_string
|
str | None
|
Optional info string used as fallback block_type |
None
|
Source code in src/hother/streamblocks/syntaxes/markdown.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
describe_format
describe_format() -> str
Describe the markdown frontmatter format for prompts.
Source code in src/hother/streamblocks/syntaxes/markdown.py
detect_line
detect_line(
line: str, candidate: BlockCandidate | None = None
) -> DetectionResult
Detect markdown fence markers and frontmatter boundaries.
Source code in src/hother/streamblocks/syntaxes/markdown.py
extract_block_type
extract_block_type(candidate: BlockCandidate) -> str | None
Extract block_type from YAML frontmatter.
Source code in src/hother/streamblocks/syntaxes/markdown.py
parse_block
parse_block(
candidate: BlockCandidate,
block_class: type[Any] | None = None,
) -> ParseResult[BaseMetadata, BaseContent]
Parse the complete block using the specified block class.
Source code in src/hother/streamblocks/syntaxes/markdown.py
parse_content_early
parse_content_early(
candidate: BlockCandidate,
) -> dict[str, Any] | None
Parse content section early, before final block extraction.
This method is called when the content section completes (block closes), allowing early validation. The result can be cached in the candidate for reuse during full block parsing.
Default implementation returns None (no early parsing). Override in subclasses to provide early content parsing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidate
|
BlockCandidate
|
The complete block candidate with content accumulated |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
Parsed content dict if successful, None if parsing not supported |
dict[str, Any] | None
|
or failed |
Source code in src/hother/streamblocks/syntaxes/base.py
parse_metadata_early
parse_metadata_early(
candidate: BlockCandidate,
) -> dict[str, Any] | None
Parse metadata section early, before content accumulation.
This method is called when the metadata section completes, allowing early validation and processing. The result can be cached in the candidate for reuse during full block parsing.
Default implementation returns None (no early parsing). Override in subclasses to provide early metadata parsing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidate
|
BlockCandidate
|
The current block candidate with metadata accumulated |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
Parsed metadata dict if successful, None if parsing not supported |
dict[str, Any] | None
|
or failed |
Source code in src/hother/streamblocks/syntaxes/base.py
serialize_block
serialize_block(
block: Block[BaseMetadata, BaseContent],
) -> str
Serialize a block to markdown frontmatter format.
Produces the round-trip form of this syntax::
```[info_string]
---
<yaml metadata>
---
<raw content>
```
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
block
|
Block[BaseMetadata, BaseContent]
|
Block instance to serialize |
required |
Returns:
| Type | Description |
|---|---|
str
|
The block rendered in markdown frontmatter format |
Source code in src/hother/streamblocks/syntaxes/markdown.py
should_accumulate_metadata
should_accumulate_metadata(
candidate: BlockCandidate,
) -> bool
Check if we're still in metadata section.
validate_block
validate_block(
_block: ExtractedBlock[BaseMetadata, BaseContent],
) -> bool
hother.streamblocks.syntaxes.factory
Factory function for creating syntax instances.
Syntax
Bases: StrEnum
Enum of built-in syntax types.
Source code in src/hother/streamblocks/syntaxes/factory.py
get_syntax_instance
get_syntax_instance(
syntax: Syntax | BaseSyntax,
) -> BaseSyntax
Get a syntax instance from a Syntax enum or return custom instance.
This helper function allows users to specify built-in syntaxes using the Syntax enum or provide their own custom syntax implementations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
syntax
|
Syntax | BaseSyntax
|
Either a Syntax enum member or a custom BaseSyntax instance |
required |
Returns:
| Type | Description |
|---|---|
BaseSyntax
|
A syntax instance inheriting from BaseSyntax |
Raises:
| Type | Description |
|---|---|
SyntaxConfigError
|
If syntax is neither a Syntax enum nor a BaseSyntax instance |
Example
Using built-in syntax
syntax = get_syntax_instance(Syntax.DELIMITER_PREAMBLE)
Using custom syntax
my_syntax = MySyntax() syntax = get_syntax_instance(my_syntax)
Source code in src/hother/streamblocks/syntaxes/factory.py
hother.streamblocks.syntaxes.models
Base syntax class and utilities for StreamBlocks syntax implementations.
Syntax
Bases: StrEnum
Enum of built-in syntax types.
Source code in src/hother/streamblocks/syntaxes/factory.py
get_syntax_instance
get_syntax_instance(
syntax: Syntax | BaseSyntax,
) -> BaseSyntax
Get a syntax instance from a Syntax enum or return custom instance.
This helper function allows users to specify built-in syntaxes using the Syntax enum or provide their own custom syntax implementations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
syntax
|
Syntax | BaseSyntax
|
Either a Syntax enum member or a custom BaseSyntax instance |
required |
Returns:
| Type | Description |
|---|---|
BaseSyntax
|
A syntax instance inheriting from BaseSyntax |
Raises:
| Type | Description |
|---|---|
SyntaxConfigError
|
If syntax is neither a Syntax enum nor a BaseSyntax instance |
Example
Using built-in syntax
syntax = get_syntax_instance(Syntax.DELIMITER_PREAMBLE)
Using custom syntax
my_syntax = MySyntax() syntax = get_syntax_instance(my_syntax)