abla/yaml/parser

Generated from source.

Source module; follow its importing module's re-export links.

Source: abla/yaml/parser.ab

YamlSourceEntry (class)

class YamlSourceEntry(val key: int, val value: int, val begin: int, val end: int,
    val colon: int = -1, var comma: int = -1)

Internal concrete-source records are retained only for document parsing. Alias values share closed nodes; expansion budgets count each occurrence.

YamlSourceNode (class)

class YamlSourceNode(var value: Yaml, val begin: int, var contentBegin: int,
    var end: int, var style: int, var indent: int,
    val entries: array<YamlSourceEntry>, var anchor: string = "",
    var aliasTarget: int = -1, var closed: bool = false,
    var expandedNodes: int = 1, var expandedBytes: int = 0,
    var expandedDepth: int = 1, var aliasUses: int = 0)

Holds the parsed value, source span, presentation style and alias accounting for one YAML node.

YamlSourceResult (class)

class YamlSourceResult(val value: Yaml, val nodes: array<YamlSourceNode>,
    val root: int, val succeeded: bool, val error: YamlError)

Carries the parsed value and optional retained source graph with any parse error.

YamlParser (class)

class YamlParser(val source: string, val limits: YamlLimits, val keepSource: bool,
    var pos: int, val starts: array<int>, val ends: array<int>, val nexts: array<int>,
    val indents: array<int>, val nodes: array<YamlSourceNode>,
    val anchors: Map<string, int>, var anchorCount: int, var aliasCount: int,
    var work: int, var flowIndent: int, var errorCode: string, var errorMessage: string,
    var errorOffset: int, var lastLine: int)

Tracks the source cursor, limits, anchors, retained nodes and first YAML error.

YamlParser.fail (extension fun)

fun YamlParser.fail(code: string, message: string, offset: int): void

Records the first YAML error code, message and source offset.

YamlParser.tick (extension fun)

fun YamlParser.tick(amount: int): void

Charges parsing work and records an error if the work budget is exceeded.

YamlParser.lineOf (extension fun)

fun YamlParser.lineOf(offset: int): int

Returns the zero-based source line index for a byte offset.

YamlParser.endLine (extension fun)

fun YamlParser.endLine(): int

Returns the byte offset at the end of the current source line.

YamlParser.column (extension fun)

fun YamlParser.column(): int

Returns the current cursor's zero-based byte column.

YamlParser.byte (extension fun)

fun YamlParser.byte(): int

Returns the current source byte or -1 at end of input.

yamlRawInvalid (fun)

fun yamlRawInvalid(source: string, begin: int, end: int): int

Returns the offset of the first disallowed raw control or noncharacter sequence, or -1 if none is found.

YamlParser.printable (extension fun)

fun YamlParser.printable(begin: int, end: int): void

Checks raw text for disallowed non-printable characters and records the first violation.

yamlSpace (fun)

fun yamlSpace(c: int): bool

Returns whether the byte is a space or horizontal tab.

yamlBreak (fun)

fun yamlBreak(c: int): bool

Returns whether the byte is CR or LF.

yamlSeparation (fun)

fun yamlSeparation(c: int): bool

Returns whether the byte is whitespace or the end-of-input sentinel.

yamlFlowEnd (fun)

fun yamlFlowEnd(c: int): bool

Returns whether the byte separates or closes a flow collection.

YamlParser.spaces (extension fun)

fun YamlParser.spaces(): void

Advances past spaces and horizontal tabs.

YamlParser.flowSpace (extension fun)

fun YamlParser.flowSpace(): void

Skips whitespace and comments that can separate flow tokens.

YamlParser.blockSpace (extension fun)

fun YamlParser.blockSpace(): void

Skip presentation-only lines, retaining them as gaps in the source model.

YamlParser.finishLine (extension fun)

fun YamlParser.finishLine(): void

Consumes the remainder of the current line and reports unexpected trailing content.

YamlParser.newNode (extension fun)

fun YamlParser.newNode(begin: int, style: int, indent: int, depth: int): int

Allocates a node index and records an error if depth or node limits are exceeded.

YamlParser.addCost (extension fun)

fun YamlParser.addCost(id: int, child: int): void

Adds a child's expansion cost to its parent and checks the limits.

YamlParser.checkCost (extension fun)

fun YamlParser.checkCost(id: int): void

Records an error if the node exceeds an expanded-node, byte or depth limit.

YamlParser.closeScalar (extension fun)

fun YamlParser.closeScalar(id: int, value: Yaml, end: int): int

Stores the scalar and its ending offset, checking scalar and expansion limits.

YamlParser.properties (extension fun)

fun YamlParser.properties(id: int): void

Consumes supported node properties and records an error for invalid anchors or unsupported tags.

YamlParser.alias (extension fun)

fun YamlParser.alias(id: int): int

Resolves the alias into the supplied node, recording an error for invalid, undefined or cyclic references.

YamlParser.quoted (extension fun)

fun YamlParser.quoted(quote: int, parentIndent: int): string

Returns decoded quoted scalar text, recording malformed quotes or escapes.

YamlParser.documentMarker (extension fun)

fun YamlParser.documentMarker(offset: int): bool

Find a mapping separator, ignoring quoted and nested flow content.

YamlParser.mappingColon (extension fun)

fun YamlParser.mappingColon(start: int): int

Returns the offset of a mapping colon outside nested or quoted content, or -1 if absent.

YamlParser.presentationComment (extension fun)

fun YamlParser.presentationComment(line: int): bool

Returns whether the physical line contains a comment after optional indentation.

YamlParser.presentationBlank (extension fun)

fun YamlParser.presentationBlank(line: int): bool

Returns whether the physical line contains only presentation whitespace.

YamlParser.plain (extension fun)

fun YamlParser.plain(flow: bool, key: bool, parentIndent: int): string

Returns the decoded plain scalar text subject to its flow, key and indentation context.

yamlBufferAppend (fun)

fun yamlBufferAppend(var buffer: ByteBuffer?, text: string): void

Appends to the optional output buffer when one is present.

yamlBufferSize (fun)

fun yamlBufferSize(buffer: ByteBuffer?, otherwise: int): int

Returns the buffer size or the supplied fallback when the buffer is absent.

yamlBufferText (fun)

fun yamlBufferText(buffer: ByteBuffer?, otherwise: string): string

Returns the buffer text or the supplied fallback when the buffer is absent.

YamlParser.blockScalar (extension fun)

fun YamlParser.blockScalar(parentIndent: int): string

Decodes a block scalar according to its indentation, folding and chomping indicators.

YamlParser.scalar (extension fun)

fun YamlParser.scalar(id: int, flow: bool, key: bool, parentIndent: int): int

Parses scalar content into the supplied node and returns its index after applying scalar limits.

YamlParser.implicitKey (extension fun)

fun YamlParser.implicitKey(begin: int, end: int): void

Validates the byte span of an implicit mapping key and records a limit or syntax error.

YamlParser.member (extension fun)

fun YamlParser.member(id: int, key: int, value: int, begin: int, end: int, colon: int,
    var keys: array<Yaml>, var values: array<Yaml>, var seen: Map<string, int>): void

Records a collection member and updates its parent's expansion cost and source spans.

YamlParser.flow (extension fun)

fun YamlParser.flow(id: int, depth: int, parentIndent: int): int

Parses a flow collection and returns its node index, recording the first syntax or limit error.

YamlParser.emptyNode (extension fun)

fun YamlParser.emptyNode(begin: int, depth: int): int

Creates a null node at the supplied offset and returns its index or -1 if allocation is refused.

YamlParser.inlineNode (extension fun)

fun YamlParser.inlineNode(depth: int, flow: bool, key: bool, parentIndent: int): int

Returns the index of the next inline node or records a syntax or limit error.

YamlParser.afterIndicator (extension fun)

fun YamlParser.afterIndicator(parentIndent: int, depth: int, compact: bool): int

Returns the node after a sequence or mapping indicator, using a null node for an omitted value.

YamlParser.blockSpaceIfNewLine (extension fun)

fun YamlParser.blockSpaceIfNewLine(): void

Skips blank and comment lines when the cursor is at the beginning of a line.

YamlParser.dash (extension fun)

fun YamlParser.dash(): bool

Returns whether the current dash is followed by a separator or the end of input.

YamlParser.explicitKey (extension fun)

fun YamlParser.explicitKey(): bool

Returns whether a question mark at the cursor begins an explicit mapping key.

YamlParser.blockNode (extension fun)

fun YamlParser.blockNode(depth: int, existing: int = -1): int

Parses a block node and returns its index, recording the first syntax or limit error.

yamlErrorAt (fun)

fun yamlErrorAt(source: string, code: string, message: string, offset: int): YamlError

Constructs a YAML diagnostic and derives its line and column from the byte offset.

yamlReadSource (fun)

fun yamlReadSource(source: string, limits: YamlLimits, keepSource: bool): YamlSourceResult

Parses one bounded YAML document and optionally retains source nodes, returning the first error on failure.

yamlParse (fun)

fun yamlParse(source: string, limits: YamlLimits = yamlDefaultLimits()): YamlParseResult

Parses one document from source within limits. Returns its YAML value on success, or YAML null and a located error for invalid, unsupported, or over-limit input.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.