Skip to content

Commit

Permalink
#47 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Aug 19, 2023
1 parent 22e0d3e commit 35279e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bibcop.pl
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,10 @@ sub entries {
if ($char eq ' ') {
# ignore the white space
} elsif ($char eq '%' and not($s eq 'quote')) {
$interrupted = $s;
$s = 'comment';
if ($pos eq 0 or substr($bib, $pos - 1, 1) ne '\\') {
$interrupted = $s;
$s = 'comment';
}
} elsif ($char eq "\n") {
# ignore the EOL
$lineno = $lineno + 1;
Expand Down
4 changes: 4 additions & 0 deletions perl-tests/parsing.pl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ package bibcop;
# show(@i7);
assert(@i7+0, 1);

my @i8 = entries("\@misc{foo33, title={It's 100\\% true!}}\n");
# show(@i8);
assert(@i8+0, 1);

# These are all parsing errors
assert(entries('no bibs')+0, 0);
assert(entries('@misc{---}')+0, 0);
Expand Down

0 comments on commit 35279e2

Please sign in to comment.