"Use of uninitialized value $_[2] in pattern match (m//) at Plugin/Syntax.pm line 39."
####
package Plugin::Syntax;
use strict;
use warnings;
use Data::Dump;
my $code;
my $kw = qr/[A-Za-z_][A-Za-z0-9_-]*/;
my %directives = map { $_ => 1 } (qw|
!some !data !snipped| );
my %commands = map { $_ => 1 } (qw|
some data snipped| );
sub parse_command {
return unless $_[0] =~ /\G\s*($kw)\s*=\s*/cg; # not 'ident ='
my $id = $1;
my ($s,$e) = ($-[1],$+[1]);
if( $id =~ /^(?:ok|e[0-9A-Fa-f]{2})$/ ) {
$code->tagAdd( 'special', "$_[1] +${s}c", "$_[1] +${e}c" );
}
if( $_[0] =~ /\G($kw)\s*\(/cg ) { # parse that command
pos( $_[0] )--; # give back the paren
if( exists $commands{lc $1} ) { # Check if command exists
$code->tagAdd( 'command', "$_[1] +$-[1]c", "$_[1] +$+[1]c" );
}
return lc $1;
}
# This must be an immediate value
&parse_rvalue;
return 'none';
}
sub parse_rvalue {
if( $_[0] =~ /\G[CS]?\d\d-\d\d(?:\s+var\s+[0-9A-Fa-f]{1,2})?/cg ) {
$code->tagAdd('constant', "$_[1] +$-[0]c", "$_[1] +$+[0]c");
}
elsif( $_[0] =~ /\G[CS]?[#][0-9A-Fa-f]{3}/cg ) {
$code->tagAdd('constant', "$_[1] +$-[0]c", "$_[1] +$+[0]c");
}
elsif( $_[0] =~ /\G\$?[0-9A-Fa-f][0-9A-Fa-f ]*(?!\w)/cg ) {
$code->tagAdd('constant', "$_[1] +$-[0]c", "$_[1] +$+[0]c");
}
elsif( $_[0] =~ /\G\$?$kw/cg ) {
# indentifier, no highlight
}
elsif( $_[0] =~ /\G".*?"/cg ) {
$code->tagAdd('constant', "$_[1] +$-[0]c +1c", "$_[1] +$+[0]c -1c");
}
elsif( $_[0] =~ /\G\@[^\s,)]*/cg ) {
$code->tagAdd('constant', "$_[1] +$-[0]c +1c", "$_[1] +$+[0]c");
}
elsif( $_[2] =~ /^(?: hsm | cat | cat8 )$/x and $_[0] =~ /\G[<>;]/cg ) {
}
else {
return;
}
return 1;
}
1;
####
use strict;
use warnings;
use Plugin::Syntax;
Plugin::Syntax::parse_command( "xx = ", "" );