From: Jeff Ober Date: Thu, 9 Jan 2020 17:34:28 +0000 (-0500) Subject: Fix bug in type-annotated output X-Git-Tag: nailing-cargo/1.0.0~234^2~62 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=be8521746409725055d133bb5554b102b5e783f7;p=nailing-cargo.git Fix bug in type-annotated output --- diff --git a/lib/TOML/Tiny/Parser.pm b/lib/TOML/Tiny/Parser.pm index b19c2db..bb159cd 100644 --- a/lib/TOML/Tiny/Parser.pm +++ b/lib/TOML/Tiny/Parser.pm @@ -198,7 +198,23 @@ sub parse_value { my $token = shift // $self->next_token; if ($self->{annotated}) { - return {type => $token->type, value => ''.$token->value}; + for ($token->type) { + when (/inline_table/) { + return $self->parse_inline_table; + } + + when (/inline_array/) { + return $self->parse_inline_array; + } + + when (/float|integer|string|bool|datetime/) { + return { type => $token->type, value => '' . $token->value }; + } + + default{ + $self->parse_error($token, "value expected (bool, number, string, datetime, inline array, inline table), but found $_"); + } + } } else { for ($token->type) {