README

jingmo653/sshconfig-resolve/syntax does not have a README file

#
ParseError

pub(all) suberror ParseError {
MissingArgument(location~ : SourceLocation, keyword~ : String)
UnterminatedQuote(location~ : SourceLocation)
DanglingEscape(location~ : SourceLocation)
UnexpectedNul(location~ : SourceLocation)
LineTooLong(location~ : SourceLocation, limit~ : Int)
SourceTooLarge(location~ : SourceLocation, limit~ : Int)
InvalidBlockHeader(location~ : SourceLocation, keyword~ : String)
InvalidDirective(location~ : SourceLocation, message~ : String)
} derive(Eq,
Debug
)

A structured syntax error. Diagnostic messages intentionally describe only syntax and never include a directive's potentially sensitive value.

#
Argument

pub(all) struct Argument {
value : String
span : SourceSpan
} derive(Eq,
Debug
)

A decoded directive argument together with its source range.

Directive.arguments remains available for callers that only need values; use argument_infos when diagnostics must point at an individual argument. This syntax model is not lossless: blank lines, standalone comments, and section-header trivia are intentionally not retained.

#
Config

pub(all) struct Config {
items : Array[ConfigItem]
blocks : Array[HostBlock]
} derive(Eq,
Debug
)

Parsed OpenSSH client configuration.

items is the authoritative, ordered syntax model. blocks is a backwards-compatible projection containing a synthetic Host * block for global directives followed by each Host block; it intentionally excludes Match blocks.

#
ConfigItem

pub(all) enum ConfigItem {
Global(Array[Directive])
Host(HostBlock)
Match(MatchBlock)
} derive(Eq,
Debug
)

An input-order configuration item.

Global is a normalized leading item. Include remains an ordinary directive in the item where it was written; the loader expands it in place.

#
Diagnostic

pub(all) struct Diagnostic {
error : ParseError
location : SourceLocation
summary : String
} derive(Eq,
Debug
)

A parser diagnostic returned by parse_recovering.

#
Directive

pub(all) struct Directive {
keyword : String
arguments : Array[String]
argument_infos : Array[Argument]
location : SourceLocation
span : SourceSpan
raw : String?
} derive(Eq,
Debug
)

One SSH configuration directive. Keywords are canonical ASCII lowercase.

#
HostBlock

pub(all) struct HostBlock {
patterns : Array[String]
directives : Array[Directive]
location : SourceLocation
span : SourceSpan
} derive(Eq,
Debug
)

A Host section. patterns and directives have already been decoded, but their meaning is deliberately left to the pattern and resolver packages.

#
MatchBlock

pub(all) struct MatchBlock {
conditions : Array[String]
directives : Array[Directive]
location : SourceLocation
span : SourceSpan
} derive(Eq,
Debug
)

A Match section. Conditions are retained verbatim (after lexical decoding) so a later evaluator can support new OpenSSH predicates without changing the parser.

#
ParseResult

pub(all) struct ParseResult {
config : Config
diagnostics : Array[Diagnostic]
} derive(Eq,
Debug
)

The result of parsing in recovery mode. Invalid lines are omitted from the syntax tree and represented by one diagnostic each.

#
SourceLocation

pub(all) struct SourceLocation {
path : String
line : Int
column : Int
} derive(Eq,
Debug
)

A logical source position. Lines and columns are one-based; columns count Unicode scalar values rather than UTF-16 code units.

#
SourceSpan

pub(all) struct SourceSpan {
start : SourceLocation
end_ : SourceLocation
} derive(Eq,
Debug
)

A half-open source range. end_ is the first position after the range.

#
parse

fn parse(source : String, path? : String) -> Config raise ParseError

Parse OpenSSH client configuration syntax strictly.

The returned config preserves input-order items and source spans. Global directives are represented by the leading normalized ConfigItem::Global.

#
parse_recovering

fn parse_recovering(source : String, path? : String) -> ParseResult

Parse configuration while collecting per-line syntax diagnostics.

Recovery skips the offending line and continues with the following line, making this entry point suitable for linting and editor integrations.

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io