Skip to content

Commit

Permalink
ini patch to allow 'entry[] = value' entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Harald Radi committed Jan 19, 2003
1 parent a1e6457 commit 697398e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions Zend/zend_ini.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ typedef void (*zend_ini_parser_cb_t)(zval *arg1, zval *arg2, int callback_type,
int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_ini_parser_cb_t ini_parser_cb, void *arg);
#define ZEND_INI_PARSER_ENTRY 1
#define ZEND_INI_PARSER_SECTION 2
#define ZEND_INI_PARSER_POP_ENTRY 3

typedef struct _zend_ini_parser_param {
zend_ini_parser_cb_t ini_parser_cb;
Expand Down
9 changes: 9 additions & 0 deletions Zend/zend_ini_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ int zend_parse_ini_file(zend_file_handle *fh, zend_bool unbuffered_errors, zend_
%pure_parser
%token TC_STRING
%token TC_ENCAPSULATED_STRING
%token BRACK
%token SECTION
%token CFG_TRUE
%token CFG_FALSE
Expand All @@ -200,6 +201,14 @@ statement:
free($1.value.str.val);
free($3.value.str.val);
}
| TC_STRING BRACK '=' string_or_value {
#if DEBUG_CFG_PARSER
printf("'%s'[ ] = '%s'\n", $1.value.str.val, $4.value.str.val);
#endif
ZEND_INI_PARSER_CB(&$1, &$4, ZEND_INI_PARSER_POP_ENTRY, ZEND_INI_PARSER_ARG);
free($1.value.str.val);
free($4.value.str.val);
}
| TC_STRING { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_ENTRY, ZEND_INI_PARSER_ARG); free($1.value.str.val); }
| SECTION { ZEND_INI_PARSER_CB(&$1, NULL, ZEND_INI_PARSER_SECTION, ZEND_INI_PARSER_ARG); free($1.value.str.val); }
| '\n'
Expand Down
5 changes: 4 additions & 1 deletion Zend/zend_ini_scanner.l
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ NEWLINE ("\r"|"\n"|"\r\n")

%%

<INITIAL>[ ]*[\[][ ]*[\]][ ]* {
return BRACK;
}

<INITIAL>[ ]*("true"|"on"|"yes")[ ]* {
ini_lval->value.str.val = zend_strndup("1", 1);
Expand Down Expand Up @@ -166,7 +169,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
}


<INITIAL>[^=\n\r\t;|&~()!"]+ {
<INITIAL>[^=\n\r\t;|&~()!"\[]+ {
/* STRING */
register int i;

Expand Down

0 comments on commit 697398e

Please sign in to comment.