forked from jasder/antlr
[Swift] Suppress "Optional" in the output when printing a value.
Suppress "Optional" in the output when printing a value in the tests and some debugging messages. This is a change in behavior in Swift 4.2 (SE-0054) that implicitly unwrapped optionals are now seen as plain Optional at runtime, and so print doesn't implicitly unwrap them any more.
This commit is contained in:
parent
938883d516
commit
75d4d867ef
|
@ -1,6 +1,6 @@
|
|||
writeln(s) ::= <<print(<s>)>>
|
||||
writeln(s) ::= <<print((<s>) ?? "nil")>>
|
||||
|
||||
write(s) ::= <<print(<s>, terminator: "")>>
|
||||
write(s) ::= <<print((<s>) ?? "nil", terminator: "")>>
|
||||
|
||||
False() ::= "false"
|
||||
|
||||
|
|
|
@ -1754,7 +1754,7 @@ open class ParserATNSimulator: ATNSimulator {
|
|||
}
|
||||
|
||||
if debug {
|
||||
print("config from pred transition=\(String(describing: c))")
|
||||
print("config from pred transition=\(c?.description ?? "nil")")
|
||||
}
|
||||
return c!
|
||||
}
|
||||
|
@ -1796,7 +1796,7 @@ open class ParserATNSimulator: ATNSimulator {
|
|||
}
|
||||
|
||||
if debug {
|
||||
print("config from pred transition=\(String(describing: c))")
|
||||
print("config from pred transition=\(c?.description ?? "nil")")
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
@ -1804,7 +1804,7 @@ open class ParserATNSimulator: ATNSimulator {
|
|||
|
||||
final func ruleTransition(_ config: ATNConfig, _ t: RuleTransition) -> ATNConfig {
|
||||
if debug {
|
||||
print("CALL rule \(getRuleName(t.target.ruleIndex!)), ctx=\(String(describing: config.context))")
|
||||
print("CALL rule \(getRuleName(t.target.ruleIndex!)), ctx=\(config.context?.description ?? "nil")")
|
||||
}
|
||||
|
||||
let returnState = t.followState
|
||||
|
@ -1961,7 +1961,7 @@ open class ParserATNSimulator: ATNSimulator {
|
|||
_ to: DFAState?) -> DFAState? {
|
||||
var to = to
|
||||
if debug {
|
||||
print("EDGE \(String(describing: from)) -> \(String(describing: to)) upon \(getTokenName(t))")
|
||||
print("EDGE \(from?.description ?? "nil")) -> \(to?.description ?? "nil") upon \(getTokenName(t))")
|
||||
}
|
||||
|
||||
if to == nil {
|
||||
|
|
Loading…
Reference in New Issue