Handle const struct declarations

This commit is contained in:
Doyle 2019-02-23 13:19:36 +11:00
parent 51d30eb3bd
commit 2acaebaf77
2 changed files with 18 additions and 1 deletions

View File

@ -793,6 +793,8 @@ void ParseCPPStruct(CPPTokeniser *tokeniser)
{ {
if (token.type == CPPTokenType::Identifier) if (token.type == CPPTokenType::Identifier)
{ {
if (IsIdentifierToken(token, STR_LITERAL("const")))
token = CPPTokeniser_NextToken(tokeniser);
#if 0 #if 0
int asterisks_count = 0; int asterisks_count = 0;
@ -809,6 +811,12 @@ void ParseCPPStruct(CPPTokeniser *tokeniser)
{ {
CPPToken const variable_type = token; CPPToken const variable_type = token;
CPPToken variable_name = peek_token; CPPToken variable_name = peek_token;
if (IsIdentifierToken(variable_name, STR_LITERAL("const")))
{
token = CPPTokeniser_NextToken(tokeniser);
variable_name = CPPTokeniser_PeekToken(tokeniser);
}
for (;;) for (;;)
{ {
auto *link = MEM_ARENA_ALLOC_STRUCT(&global_main_arena, CPPDeclLinkedList<CPPVariableDecl>); auto *link = MEM_ARENA_ALLOC_STRUCT(&global_main_arena, CPPDeclLinkedList<CPPVariableDecl>);

View File

@ -28,7 +28,11 @@ DQN_INSPECT struct OpenGLState
{ {
// #if 0 // #if 0
// #endif // #endif
u32 ebo DQN_INSPECT_META(DisplayName = "Element Buffer Object"), vbo, vao DQN_INSPECT_META(DisplayName = "Vertex Array Object", OpenGLVersion = "330"); const int c;
int const d;
// void *win32_handle;
int ebo DQN_INSPECT_META(DisplayName = "Element Buffer Object"), vbo, vao DQN_INSPECT_META(DisplayName = "Vertex Array Object", OpenGLVersion = "330");
// u32 shaders[(int)OpenGLShader::Count]; // u32 shaders[(int)OpenGLShader::Count];
V4 draw_color DQN_INSPECT_META(DisplayName = "HelloWorld"); V4 draw_color DQN_INSPECT_META(DisplayName = "HelloWorld");
V3 lighting_ambient_coeff; V3 lighting_ambient_coeff;
@ -36,4 +40,9 @@ DQN_INSPECT struct OpenGLState
// FixedArray<RendererLight, 32> lights; // FixedArray<RendererLight, 32> lights;
// FixedArray<Mat4, 32> camera_matrixes; // FixedArray<Mat4, 32> camera_matrixes;
int draw_call_count; int draw_call_count;
// const int *const a;
// int const *const b;
// int *const e;
// int const* f;
}; };