Skip to content

Commit

Permalink
compilecode: Support char classes with dangling '-'.
Browse files Browse the repository at this point in the history
Previously, only "[-a-c]" was handled correctly. Now, "[a-c-]" works
correctly too.
  • Loading branch information
pfalcon committed Sep 23, 2017
1 parent 46a847c commit bbfe74a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compilecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static const char *_compilecode(const char *re, ByteProg *prog, int sizecode)
for (cnt = 0; *re != ']'; re++, cnt++) {
if (!*re) return NULL;
EMIT(PC++, *re);
if (re[1] == '-') {
if (re[1] == '-' && re[2] != ']') {
re += 2;
}
EMIT(PC++, *re);
Expand Down

0 comments on commit bbfe74a

Please sign in to comment.