change: rename OP_EXPECT_NOLINEBREAKS to OP_GREEDY_ANY.

This commit is contained in:
Yuansheng 2019-07-20 22:49:25 +08:00
parent d516237aab
commit db91289ab6
3 changed files with 4 additions and 4 deletions

View file

@ -209,7 +209,7 @@ int r3_pattern_to_opcode(const char * pattern, unsigned int len);
enum { NODE_COMPARE_STR, NODE_COMPARE_PCRE, NODE_COMPARE_OPCODE };
enum { OP_EXPECT_MORE_DIGITS = 1, OP_EXPECT_MORE_WORDS, OP_EXPECT_NOSLASH,
OP_EXPECT_NODASH, OP_EXPECT_MORE_ALPHA, OP_EXPECT_NOLINEBREAKS};
OP_EXPECT_NODASH, OP_EXPECT_MORE_ALPHA, OP_GREEDY_ANY};

View file

@ -312,13 +312,13 @@ R3Node * r3_tree_matchl(const R3Node * n, const char * path, unsigned int path_l
case OP_EXPECT_NODASH:
while (*pp != '-' && pp < pp_end) pp++;
break;
case OP_EXPECT_NOLINEBREAKS:
case OP_GREEDY_ANY:
while (*pp != '\n' && pp < pp_end) pp++;
break;
}
// check match
if (e->opcode != OP_EXPECT_NOLINEBREAKS) {
if (e->opcode != OP_GREEDY_ANY) {
if ((pp - path) > 0) {
if (entry) {
str_array_append(&entry->vars , path, pp - path);

View file

@ -44,7 +44,7 @@ int r3_pattern_to_opcode(const char * pattern, unsigned int len) {
return OP_EXPECT_NODASH;
}
if ( strncmp(pattern, ".*", len) == 0 ) {
return OP_EXPECT_NOLINEBREAKS;
return OP_GREEDY_ANY;
}
return 0;
}