Skip to content

Commit

Permalink
compilecode: Report unsupported alphanumeric escapes.
Browse files Browse the repository at this point in the history
  • Loading branch information
pfalcon committed May 3, 2019
1 parent 88b30ce commit cf64fdc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions compilecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,21 @@ static int _compilecode(const char **re_loc, ByteProg *prog, int sizecode)

for (; *re && *re != ')'; re++) {
switch (*re) {
case '\\':
case '\\': {
re++;
if (!*re) goto syntax_error; // Trailing backslash
if ((*re | 0x20) == 'd' || (*re | 0x20) == 's' || (*re | 0x20) == 'w') {
char c = *re | 0x20;
if (c == 'd' || c == 's' || c == 'w') {
term = PC;
EMIT(PC++, NamedClass);
EMIT(PC++, *re);
prog->len++;
break;
}
if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z')) {
goto unsupported_escape;
}
}
default:
term = PC;
EMIT(PC++, Char);
Expand Down

0 comments on commit cf64fdc

Please sign in to comment.