From ea40b7b025ad66915340d8f99a3718bbd7365778 Mon Sep 17 00:00:00 2001 From: Caleb White Date: Mon, 1 Jan 2024 19:28:20 -0600 Subject: [PATCH] Allow enums to use heredocs and double quoted strings --- common/define-grammar.js | 2 +- common/test/corpus/declarations.txt | 16 +- php/src/grammar.json | 2 +- php/src/node-types.json | 12 + php/src/parser.c | 38800 +++++++++++++------------- php_only/src/grammar.json | 2 +- php_only/src/node-types.json | 12 + php_only/src/parser.c | 34680 +++++++++++------------ 8 files changed, 36794 insertions(+), 36732 deletions(-) diff --git a/common/define-grammar.js b/common/define-grammar.js index 6284c19f..acf7d43a 100644 --- a/common/define-grammar.js +++ b/common/define-grammar.js @@ -314,7 +314,7 @@ module.exports = function defineGrammar(dialect) { optional(field('attributes', $.attribute_list)), keyword('case'), field('name', $.name), - optional(seq('=', field('value', choice($.string, $.integer)))), + optional(seq('=', field('value', choice($._string, $.integer)))), $._semicolon, ), diff --git a/common/test/corpus/declarations.txt b/common/test/corpus/declarations.txt index 179f4c25..f71abb58 100644 --- a/common/test/corpus/declarations.txt +++ b/common/test/corpus/declarations.txt @@ -391,7 +391,7 @@ class B { name: (name) parameters: (formal_parameters (simple_parameter - attributes: (attribute_list + attributes: (attribute_list (attribute_group (attribute (name))) ) name: (variable_name (name)) @@ -651,8 +651,10 @@ enum Suit: string { case Hearts = 'H'; case Diamonds; - case Clubs = 'C'; - case Spades = 'S'; + case Clubs = "C"; + case Spades = <<