mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
fix for handling [:(lower|upper):] in case-insensitive patterns
This commit is contained in:
parent
80b3b82b54
commit
4bd8f3a5d5
1 changed files with 11 additions and 2 deletions
|
@ -36,6 +36,8 @@ static int my_isprint(int c) { return isprint(c); }
|
||||||
static int my_ispunct(int c) { return ispunct(c); }
|
static int my_ispunct(int c) { return ispunct(c); }
|
||||||
static int my_isspace(int c) { return isspace(c); }
|
static int my_isspace(int c) { return isspace(c); }
|
||||||
static int my_isxdigit(int c) { return isxdigit(c); }
|
static int my_isxdigit(int c) { return isxdigit(c); }
|
||||||
|
|
||||||
|
static int my_is_letter(int c) { return my_islower(c) || my_isupper(c); }
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%option caseless nodefault nostdinit noyywrap
|
%option caseless nodefault nostdinit noyywrap
|
||||||
|
@ -168,15 +170,22 @@ CCL_EXPR ("[:"[[:alpha:]]+":]")
|
||||||
"[:cntrl:]" RET_CCE(my_iscntrl)
|
"[:cntrl:]" RET_CCE(my_iscntrl)
|
||||||
"[:digit:]" RET_CCE(my_isdigit)
|
"[:digit:]" RET_CCE(my_isdigit)
|
||||||
"[:graph:]" RET_CCE(my_isgraph)
|
"[:graph:]" RET_CCE(my_isgraph)
|
||||||
"[:lower:]" RET_CCE(my_islower)
|
|
||||||
"[:print:]" RET_CCE(my_isprint)
|
"[:print:]" RET_CCE(my_isprint)
|
||||||
"[:punct:]" RET_CCE(my_ispunct)
|
"[:punct:]" RET_CCE(my_ispunct)
|
||||||
"[:space:]" RET_CCE(my_isspace)
|
"[:space:]" RET_CCE(my_isspace)
|
||||||
"[:xdigit:]" RET_CCE(my_isxdigit)
|
"[:xdigit:]" RET_CCE(my_isxdigit)
|
||||||
|
|
||||||
|
"[:lower:]" {
|
||||||
|
BEGIN(SC_CCL);
|
||||||
|
yylval.cce_val =
|
||||||
|
case_insensitive ? my_is_letter : my_islower;
|
||||||
|
return TOK_CCE;
|
||||||
|
}
|
||||||
|
|
||||||
"[:upper:]" {
|
"[:upper:]" {
|
||||||
BEGIN(SC_CCL);
|
BEGIN(SC_CCL);
|
||||||
yylval.cce_val =
|
yylval.cce_val =
|
||||||
case_insensitive ? my_islower : my_isupper;
|
case_insensitive ? my_is_letter : my_isupper;
|
||||||
return TOK_CCE;
|
return TOK_CCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue