summaryrefslogtreecommitdiff
path: root/ext/json/json_parser.y
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-01-30 18:09:25 +0100
committerMáté Kocsis <kocsismate@woohoolabs.com>2020-01-31 09:52:40 +0100
commit37d0f7d3b3e9d87c4cc2ad1ca5bc26d77f49df38 (patch)
treee8fee00a06e8a132ed4cc2f2e8bd196a4d8545bb /ext/json/json_parser.y
parentb915d68852625b5d67443013f8282764b9cf89f3 (diff)
downloadphp-git-37d0f7d3b3e9d87c4cc2ad1ca5bc26d77f49df38.tar.gz
Use "%empty" in the parsers, instead of comments
The annotation %empty is properly enforced: warnings when it's missing, and errors when it's inappropriate. Support for %empty was introduced in Bison 3.0. Pass -Wempty-rule to Bison. Closes GH-5134
Diffstat (limited to 'ext/json/json_parser.y')
-rw-r--r--ext/json/json_parser.y5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/json/json_parser.y b/ext/json/json_parser.y
index ec5e4e81cf..833a772807 100644
--- a/ext/json/json_parser.y
+++ b/ext/json/json_parser.y
@@ -1,3 +1,4 @@
+%require "3.0"
%code top {
/*
+----------------------------------------------------------------------+
@@ -118,7 +119,7 @@ object_end:
;
members:
- /* empty */
+ %empty
{
if ((parser->scanner.options & PHP_JSON_OBJECT_AS_ARRAY) && parser->methods.object_create == php_json_parser_object_create) {
ZVAL_EMPTY_ARRAY(&$$);
@@ -182,7 +183,7 @@ array_end:
;
elements:
- /* empty */
+ %empty
{
if (parser->methods.array_create == php_json_parser_array_create) {
ZVAL_EMPTY_ARRAY(&$$);