The list of enum values is now allowed to end in a comma.

Bug: 16490424
Change-Id: Ic3dd5f06efb5cf2dc4aefbd3f2db64c7b59b6b93
Tested: on OS X.
parent 541b0675
...@@ -725,7 +725,7 @@ void Parser::ParseEnum(bool is_union) { ...@@ -725,7 +725,7 @@ void Parser::ParseEnum(bool is_union) {
if (prevsize && enum_def.vals.vec[prevsize - 1]->value >= ev.value) if (prevsize && enum_def.vals.vec[prevsize - 1]->value >= ev.value)
Error("enum values must be specified in ascending order"); Error("enum values must be specified in ascending order");
} }
} while (IsNext(',')); } while (IsNext(',') && token_ != '}');
Expect('}'); Expect('}');
if (enum_def.attributes.Lookup("bit_flags")) { if (enum_def.attributes.Lookup("bit_flags")) {
for (auto it = enum_def.vals.vec.begin(); it != enum_def.vals.vec.end(); for (auto it = enum_def.vals.vec.begin(); it != enum_def.vals.vec.end();
......
...@@ -4,7 +4,7 @@ include "include_test1.fbs"; ...@@ -4,7 +4,7 @@ include "include_test1.fbs";
namespace MyGame.Example; namespace MyGame.Example;
enum Color:byte (bit_flags) { Red = 0, Green, Blue = 3 } enum Color:byte (bit_flags) { Red = 0, Green, Blue = 3, }
union Any { Monster } // TODO: add more elements union Any { Monster } // TODO: add more elements
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment