///|
fn Parser::synopsis_request(
self : Parser,
name : String,
args : Array[String],
line : Int32,
) -> Bool {
match name {
"SY" => {
self.begin(Synopsis, line)
if args.is_empty() {
self.warn("missing-command", "SY requires a command name", line)
} else {
let saved = self.font
self.font = Bold
self.append(joined_arguments(args), line)
self.font = saved
}
true
}
"YS" => {
if self.kind != Synopsis {
self.warn("unmatched-synopsis", "YS has no active SY block", line)
}
self.flush()
true
}
"OP" => {
if args.is_empty() {
self.warn("missing-option", "OP requires an option name", line)
return true
}
if !self.current.is_empty() && !self.continues {
self.retain(Inline::text(" "), line)
}
self.retain(Inline::text("["), line)
let saved = self.font
self.font = Bold
self.append(args[0], line, join=false)
if args.length() > 1 {
self.retain(Inline::text(" "), line)
self.font = Italic
self.append(args[1], line, join=false)
}
self.font = saved
self.retain(Inline::text("]"), line)
if args.length() > 2 {
self.warn(
"extra-option-arguments", "OP accepts option and optional argument", line,
)
}
true
}
_ => false
}
}