Skip to content

Commit

Permalink
#21 more symbols in tags
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jan 10, 2023
1 parent 897e019 commit 224fdcb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions bibcop.pl
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,10 @@ sub entries {
$entry{':type'} = substr($acc, 1);
$acc = '';
$s = 'body';
} elsif ($char =~ /[a-zA-Z]/ and $s eq 'body') {
} elsif ($char =~ /[a-zA-Z0-9]/ and $s eq 'body') {
$acc = '';
$s = 'tag';
} elsif ($char =~ /[a-zA-Z0-9_]/ and $s eq 'tag') {
} elsif ($char =~ /[a-zA-Z0-9_\.\-\/]/ and $s eq 'tag') {
# reading the tag
} elsif ($char =~ /[a-zA-Z0-9]/ and $s eq 'value') {
# reading the value without quotes or brackets
Expand Down
9 changes: 5 additions & 4 deletions perl-tests/parsing.pl
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ package bibcop;
assert(entries('@misc{---}')+0, 0);
assert(entries('@misc{hello, ??}')+0, 0);

entries('');
entries('@misc{k1,a={{x}{y}{}},b="{f}{x}",}');
entries('@article{k1_34} @misc{do43ss,Title=,Year=1998}');
entries("\@article{t1}\n\n\n\@misc{ff,year=1998}");
assert(entries('')+0, 0);
assert(entries('@misc{k1,a={{x}{y}{}},b="{f}{x}",}')+0, 1);
assert(entries('@article{k1_34} @misc{do43ss,Title=,Year=1998}')+0, 2);
assert(entries("\@article{t1}\n\n\n\@misc{ff,year=1998}")+0, 2);
assert(entries('@misc{42i-88/7.7,a=hello}')+0, 1);

1;

0 comments on commit 224fdcb

Please sign in to comment.