X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=videosite%2FJSLexArrayParser.pm;fp=videosite%2FJSLexArrayParser.pm;h=9320d0317f7022b5e1a43600951935c91bceefb8;hb=46f6f77791a6b1df7b56d90c7b3be439451600b8;hp=73a8d7e9a3f4483f5ab3d098b21f15fd4e0c28cf;hpb=c59cc83f944401cdbd8e72809dcc280bc749c9e4;p=videosite.git diff --git a/videosite/JSLexArrayParser.pm b/videosite/JSLexArrayParser.pm index 73a8d7e..9320d03 100644 --- a/videosite/JSLexArrayParser.pm +++ b/videosite/JSLexArrayParser.pm @@ -26,7 +26,7 @@ my @tokens = ( QUADHEX => 'u[0-9a-fA-F]{4}', INTEGER => '[0-9]+', QUOTEDNORMAL => '[nr]', - SIMPLECHAR => '[-\w\._\?\+=\&\!%<>;]+', + SIMPLECHAR => '[-\w\._\?\+=\&\!%<>;\#]+', BACKSLASH => '\\\\', SLASH => '/', COMMA => ',', @@ -38,10 +38,12 @@ my @tokens = ( sub new { my $class = shift; + my %params = @_; my $self = $class->SUPER::new(); $self->{'_PARSER'} = videosite::JSONNospace->new(); $self->{'_LEXER'} = Parse::Lex->new(@tokens); + $self->{'_PARAMS'} = \%params; return bless($self, $class); } @@ -58,12 +60,13 @@ sub parse { my $tok = $l->next(); return ('', undef) unless $tok; return ('', undef) if $l->eoi(); + print STDERR $tok->text(), "\n" if (exists($self->{'_PARAMS'}->{'debug'}) and ($self->{'_PARAMS'}->{'debug'} > 0)); return ($tok->name(), $tok->text()); }, yyerror => sub { $_[0]->YYAbort(); }, - yydebug => 0x0); + yydebug => (exists($self->{'_PARAMS'}->{'debug'})?$self->{'_PARAMS'}->{'debug'}:0x0)); return ref($result)?$result->[0]:$result; }