2 # A helper class for parsing textual JSON structures into perl
5 # The parser is in JSONNospace.yp, to regenerate you'll need the Parse::YAPP
6 # package. Use 'yapp -m videosite::JSONNospace -s JSONNospace.yp' to regenerate
9 package videosite::JSLexArrayParser;
11 use videosite::JSArrayParser;
12 @ISA = qw(videosite::JSArrayParser);
15 use videosite::JSONNospace;
22 SINGLEQUOTE => '\\\'',
26 QUADHEX => 'u[0-9a-fA-F]{4}',
28 QUOTEDNORMAL => '[nr]',
29 SIMPLECHAR => '[-\w\._\?\+=\&\!%<>;]+',
41 my $self = $class->SUPER::new();
43 $self->{'_PARSER'} = videosite::JSONNospace->new();
44 $self->{'_LEXER'} = Parse::Lex->new(@tokens);
46 return bless($self, $class);
53 my $l = $self->{'_LEXER'};
56 $result = $self->{'_PARSER'}->YYParse(
59 return ('', undef) unless $tok;
60 return ('', undef) if $l->eoi();
61 return ($tok->name(), $tok->text());
67 return ref($result)?$result->[0]:$result;