diff options
author | fesily <fesil@foxmail.com> | 2023-05-10 14:30:22 +0800 |
---|---|---|
committer | fesily <fesil@foxmail.com> | 2023-05-10 14:30:22 +0800 |
commit | ffead777ebf20d29918f3832eb14b94fad4678cf (patch) | |
tree | b8f25bfaa073c1386facd3f45f5494f8057c583e | |
parent | b8057e92271bd6f224001a73af8f3c616dbcde73 (diff) | |
download | lua-language-server-ffead777ebf20d29918f3832eb14b94fad4678cf.zip |
fix test
-rw-r--r-- | script/LuaJIT/c-parser/c99.lua | 4 | ||||
-rw-r--r-- | test/ffi/parser.lua | 7 |
2 files changed, 5 insertions, 6 deletions
diff --git a/script/LuaJIT/c-parser/c99.lua b/script/LuaJIT/c-parser/c99.lua index d2bd05ff..12ccee93 100644 --- a/script/LuaJIT/c-parser/c99.lua +++ b/script/LuaJIT/c-parser/c99.lua @@ -361,7 +361,7 @@ structOrUnionSpecifier <- {| {:type: structOrUnion :} ({:id: IDENTIFIER :})? "{" structOrUnion <- { "struct" } _ / { "union" } _ -anonymousUnion <- {| {:type: {| {:type: { "union" } :} _ "{" _ {:fields: {| structDeclaration+ |} :} "}" _ |} :} |} ";" _ +anonymousUnion <- {| {:type: {| {:type: { "union" } :} _ "{" _ {:fields: {| structDeclaration+ |} :}? "}" _ |} :} |} ";" _ structDeclaration <- anonymousUnion / {| {:type: {| specifierQualifier+ |} :} {:ids: structDeclaratorList :} |} ";" _ @@ -374,7 +374,7 @@ structDeclaratorList <- {| structDeclarator ("," _ structDeclarator)* |} structDeclarator <- declarator? ":" _ constantExpression / declarator -enumSpecifier <- {| {:type: enum :} ({:id: IDENTIFIER :})? "{" _ {:values: enumeratorList :} ("," _)? "}" _ |} +enumSpecifier <- {| {:type: enum :} ({:id: IDENTIFIER :})? "{" _ {:values: enumeratorList :}? ("," _)? "}" _ |} / {| {:type: enum :} {:id: IDENTIFIER :} |} enum <- { "enum" } _ diff --git a/test/ffi/parser.lua b/test/ffi/parser.lua index 0a54ed1f..cf55e1e0 100644 --- a/test/ffi/parser.lua +++ b/test/ffi/parser.lua @@ -50,10 +50,9 @@ TEST { TEST { name = 'enum@anonymous', type = { - name = 'a', type = 'enum', values = { - { name = 'a', value = { 1 } }, + { name = 'a', value = { '1' } }, { name = 'b', value = { 'a' } }, } } @@ -70,7 +69,7 @@ TEST { name = 'a', type = 'enum', values = { - { name = 'b', value = { op = '|', { 1 }, { 2 } } }, + { name = 'b', value = { op = '|', { '1' }, { '2' } } }, } } } [[ @@ -117,7 +116,7 @@ TEST { ]] TEST({ - { name = "struct@nil", type = { type = 'struct' } }, + { name = "struct@anonymous", type = { type = 'struct' } }, { name = 'a', type = { |