소스 검색

Allow empty initializer lists

pull/6/head
Max Brunsfeld 9 년 전
부모
커밋
be2676ed3e
3개의 변경된 파일26개의 추가작업 그리고 10개의 파일을 삭제
  1. +3
    -2
      corpus/expressions.txt
  2. +4
    -2
      grammar.js
  3. +19
    -6
      src/grammar.json

+ 3
- 2
corpus/expressions.txt 파일 보기

@ -246,7 +246,7 @@ Compound literals
============================================
int main() {
x = (SomeType) { .f1 = 5, .f2 = 6 };
x = (SomeType) { .f1 = 5, .f2 = 6, .f3 = {} };
y = (struct SomeStruct) { 7, 8 };
}
@ -263,7 +263,8 @@ int main() {
(type_name (identifier))
(initializer_list
(designator (identifier)) (number_literal)
(designator (identifier)) (number_literal)))))
(designator (identifier)) (number_literal)
(designator (identifier)) (initializer_list)))))
(expression_statement (assignment_expression
(identifier)
(compound_literal_expression

+ 4
- 2
grammar.js 파일 보기

@ -549,8 +549,10 @@ module.exports = grammar({
initializer_list: $ => seq(
'{',
$._initializer_list_contents,
optional(','),
optional(seq(
$._initializer_list_contents,
optional(',')
)),
'}'
),

+ 19
- 6
src/grammar.json 파일 보기

@ -2736,16 +2736,29 @@
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "_initializer_list_contents"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ","
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_initializer_list_contents"
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ","
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "BLANK"

불러오는 중...
취소
저장