se strict;
use warnings;
package JSON::Pointer::Marpa;
$JSON::Pointer::Marpa::VERSION = 'v1.0.3';
use Marpa::R2 ();
use URI::Escape qw( uri_unescape );
use JSON::Pointer::Marpa::Semantics ();
m
get {
my ( undef, $json_document, $json_pointer ) = @_;
# FIXME: properly differentiate between the 2 different representations
# (RFC6901 section 5 and section 6) of a JSON pointer. uri_unesca
. Backslash unescaping has to be done for the JSON string
# representation (section 5) type.
$json_pointer = uri_unescape( $json_pointer )
if $json_pointer =~ s/\A#//; ## no critic (RequireExt
use strict;
use warnings;
package JSON::Pointer::Marpa::Semantics;
use subs qw( _index_exists _member_exists );
use constant { ## no critic (ProhibitConstantPragma)
EMPTY => '',
SLASH => '/',
rv, $index ) )
} else {
Marpa::R2::Context::bail(
"Currently referenced type '$crt' isn't a JSON structured type (array or object)!"
)
}
undef
}
sub next_array_index_dereferencing {
rrently referenced type
Marpa::R2::Context::bail(
"Currently referenced type '$crt' isn't a JSON object!" )
unless $crt eq 'HASH';
$self->set_crv( _member_exists( $crv, $member ) );
und
JSON::Pointer::Marpa - Marpa::R2 based JSON Pointer RFC6901 implementation
=head1 SYNOPSIS
use JSON::Pointer::Marpa ();
# $json_document, $json_pointer, and $json_value refer to
# Perl (JSON
decoded) values
my $json_value = JSON::Pointer::Marpa->get( $json_document, $json_pointer );
=head1 SYNTAX
ABNF syntax of JSON Pointer
json-pointer = *( "/" reference-token )
reference-to
m * Currently referenced type '%s' isn't a JSON structured type (array or object)!
=item * Currently referenced type '%s' isn't a JSON object!"
=item * JSON array has been accessed with an index %d