@@ -46,25 +46,26 @@ struct PARSER_OP_s {
46
46
PARSER_OP_b op ;
47
47
char * regex_pattern ;
48
48
bool * regex_match ;
49
- int regex_match_start ;
50
- int regex_match_length ;
49
+ int regex_match_start ;
50
+ int regex_match_length ;
51
51
char * wc_pattern ;
52
52
char * regex_extracted_chars ;
53
53
bool wc_match ;
54
54
};
55
55
struct PARSER_OP_s parser_ops [] = {
56
56
[PARSER_TYPE_1 ] = {
57
- .op = ^ int (int a , int b ){ return (a - b ); },
58
- .wc_pattern = "ello*" ,
59
- .regex_pattern = "[Hh]ello\\s.*[Ww]orld" ,
60
- .regex_match_start = 0 , .regex_match_length = 0 ,
57
+ .op = ^ int (int a , int b ){ return (a - b ); },
58
+ .wc_pattern = "ello*" ,
59
+ .regex_pattern = "[Hh]ello\\s.*[Ww]orld" ,
60
+ .regex_match_start = 0 , .regex_match_length = 0 ,
61
61
.regex_extracted_chars = NULL ,
62
62
},
63
- [PARSER_TYPES_QTY ] = { 0 },
63
+ [PARSER_TYPES_QTY ] = { 0 },
64
64
};
65
- char * search_strings [] = {
65
+ char * search_strings [] = {
66
66
"Hello world" ,
67
67
"''hello world" ,
68
+ "''hello world" ,
68
69
"ahem.. 'hello\t\nWorld !' .." ,
69
70
".... 'Hello world .........." ,
70
71
NULL ,
@@ -78,10 +79,10 @@ TEST t_blocks_test_parser_ops(void){
78
79
79
80
printf ("[" AC_BLUE "%s" AC_RESETALL "]\n" , strdup_escaped (search_string ));
80
81
for (size_t i = 0 ; i < PARSER_TYPES_QTY ; i ++ ) {
81
- parser_ops [i ].wc_match = wildcardcmp (parser_ops [i ].wc_pattern , search_string );
82
- parser_ops [i ].regex_match_start = re_match (parser_ops [i ].regex_pattern , search_string , & parser_ops [i ].regex_match_length );
83
- parser_ops [i ].regex_extracted_chars = (parser_ops [i ].regex_match_start > 0 )
84
- ? stringfn_substring (search_string ,parser_ops [i ].regex_match_start ,parser_ops [i ].regex_match_length )
82
+ parser_ops [i ].wc_match = wildcardcmp (parser_ops [i ].wc_pattern , search_string );
83
+ parser_ops [i ].regex_match_start = re_match (parser_ops [i ].regex_pattern , search_string , & parser_ops [i ].regex_match_length );
84
+ parser_ops [i ].regex_extracted_chars = (parser_ops [i ].regex_match_start > 0 )
85
+ ? stringfn_substring (search_string , parser_ops [i ].regex_match_start , parser_ops [i ].regex_match_length )
85
86
: NULL ;
86
87
87
88
printf (AC_YELLOW "\tParser #%lu> Wildcard: %s%s\n" AC_RESETALL ,
@@ -91,12 +92,12 @@ TEST t_blocks_test_parser_ops(void){
91
92
);
92
93
printf (AC_MAGENTA "\tParser #%lu> Regex: %s(%s) %s :: (chars %d-%d): " AC_RESETALL AC_CYAN "%s" AC_RESETALL "\n" AC_RESETALL ,
93
94
i ,
94
- (parser_ops [i ].regex_match_start > 0 ) ? AC_GREEN : AC_RED ,
95
+ (parser_ops [i ].regex_match_start > 0 ) ? AC_GREEN : AC_RED ,
95
96
parser_ops [i ].regex_pattern ,
96
97
(parser_ops [i ].regex_match_start > 0 ) ? "Yes" : "No" ,
97
98
(parser_ops [i ].regex_match_start > 0 ) ? (parser_ops [i ].regex_match_start ) : 0 ,
98
99
(parser_ops [i ].regex_match_start > 0 ) ? (parser_ops [i ].regex_match_length ) : 0 ,
99
- (parser_ops [i ].regex_match_start > 0 )
100
+ (parser_ops [i ].regex_match_start > 0 )
100
101
? (strdup_escaped (parser_ops [i ].regex_extracted_chars ))
101
102
: ""
102
103
);
0 commit comments